public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/12383] New: error printing elements in vector from C++ program
@ 2011-01-10 13:39 lberk at redhat dot com
2011-02-17 21:46 ` [Bug c++/12383] " keiths at redhat dot com
2011-11-10 19:51 ` tromey at redhat dot com
0 siblings, 2 replies; 3+ messages in thread
From: lberk at redhat dot com @ 2011-01-10 13:39 UTC (permalink / raw)
To: gdb-prs
http://sourceware.org/bugzilla/show_bug.cgi?id=12383
Summary: error printing elements in vector from C++ program
Product: gdb
Version: 7.1
Status: NEW
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned@sourceware.org
ReportedBy: lberk@redhat.com
CC: swagiaal@redhat.com
Using GDB (7.1-34.fc13) in Fedora 13 x86-64
gdb was configured as "x86_64-redhat-linux-gnu"
gcc version 4.4.5 20101112 (Red Hat 4.4.5-2) (GCC)
While debugging a program written in c++ I was attempting to print the elements
of a std::vector using p MyVector[x] and was unable to (where x <
MyVector.size() , in my specific case; 2). The error: 'No symbol "operator[]"
in current context.' was received. If I use p MyVector._M_impl._M_start I can
access and print the first element of the std vector as needed however
accessing the rest of the vector would be desirable.
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/12383] error printing elements in vector from C++ program
2011-01-10 13:39 [Bug c++/12383] New: error printing elements in vector from C++ program lberk at redhat dot com
@ 2011-02-17 21:46 ` keiths at redhat dot com
2011-11-10 19:51 ` tromey at redhat dot com
1 sibling, 0 replies; 3+ messages in thread
From: keiths at redhat dot com @ 2011-02-17 21:46 UTC (permalink / raw)
To: gdb-prs
http://sourceware.org/bugzilla/show_bug.cgi?id=12383
Keith Seitz <keiths at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |keiths at redhat dot com
--- Comment #1 from Keith Seitz <keiths at redhat dot com> 2011-02-17 21:46:31 UTC ---
The problem here is that the user's program does not use
std::vector::operator[], so the compiler omits it.
Unfortunately, in order to use operator[] at the command prompt, your program
*must* include it. Or more specifically, the compiler/linker must include it.
If you add a call to operator[] in your program, everything should just
"magically" work (at least it does for me):
(gdb) p myvector[0]
$1 = (int &) @0x603010: 0
Various ideas are floating around on how to further address this issue, but
nothing definitive has been decided yet.
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/12383] error printing elements in vector from C++ program
2011-01-10 13:39 [Bug c++/12383] New: error printing elements in vector from C++ program lberk at redhat dot com
2011-02-17 21:46 ` [Bug c++/12383] " keiths at redhat dot com
@ 2011-11-10 19:51 ` tromey at redhat dot com
1 sibling, 0 replies; 3+ messages in thread
From: tromey at redhat dot com @ 2011-11-10 19:51 UTC (permalink / raw)
To: gdb-prs
http://sourceware.org/bugzilla/show_bug.cgi?id=12383
Tom Tromey <tromey at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
CC| |tromey at redhat dot com
Resolution| |DUPLICATE
--- Comment #2 from Tom Tromey <tromey at redhat dot com> 2011-11-10 19:50:53 UTC ---
Marking this one as a dup since the other has more info.
*** This bug has been marked as a duplicate of bug 12937 ***
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-11-10 19:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-10 13:39 [Bug c++/12383] New: error printing elements in vector from C++ program lberk at redhat dot com
2011-02-17 21:46 ` [Bug c++/12383] " keiths at redhat dot com
2011-11-10 19:51 ` tromey at redhat dot com
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).