public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* GDB doesn't like vectors
@ 2001-12-05 13:55 Phillip Susi
  0 siblings, 0 replies; only message in thread
From: Phillip Susi @ 2001-12-05 13:55 UTC (permalink / raw)
  To: gcc-help

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.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2001-12-05 21:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-12-05 13:55 GDB doesn't like vectors Phillip Susi

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).