This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: how to view content in stl vector
> Date: Tue, 12 Jun 2007 11:05:21 -0400
> From: kdsfinger@gmail.com
>
> hi, all
> How may I view the content in a stl vector in ddd? (or the command to
> print it in gdb?). It seems I can only view the first element. I
> searched google but did not find answer. Thanks for help.
There isn't a simple way. You'll have to dig through the data
structure yourself, which requires knowledge about the particulat stl
implementation. In a running program you might be able to call the
appropriate member functions (like operator[]), but doing so in the
right way isn't easy for heavily templated code used in most stl
implementations. And that doesn't work in core dumps.
I generally consider C++ code to be undebuggable.
Mark