This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
GDB doesn't like vectors
- From: Phillip Susi <psusi at cfl dot rr dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Wed, 05 Dec 2001 16:51:24 -0500
- Subject: GDB doesn't like vectors
I've been trying to get gdb to print the contents of a vector, and so far,
the only way I've found to make this work is to print myvector, which shows
the members _M_start, and _M_finish. Printing myvect._M_finish -
myvect._M_start shows the size of the vector, and print myvect._M_start[0,
1, 2... n] shows the contents of the vector, one at a time. This takes an
awfull lot of typing, so I was wondering, why don't things like print
myvect.size() and print myvect[0] not work? When I try these I get errors
like this:
(gdb) print TreatmentRooms.size()
Cannot resolve method vector<TreatmentRoom *,allocator<TreatmentRoom
*> >::size to any overloaded instance
Does anyone know how to make this work? Also, does gdb support any kind of
scripting or plug ins to aid in debugging? For instance, it would be
really nice to be able to have some shorthand for printing the full
contents of the vector, instead of manually doing all of the manual
printing to figure out the size of the vector, and then look up each
element one at a time.