This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
Taking the address of a convenience variable value
- From: Paul Dubuc <pdubuc at cas dot org>
- To: GDB Mailing List <gdb at sources dot redhat dot com>
- Date: Tue, 25 May 2004 12:55:46 -0400
- Subject: Taking the address of a convenience variable value
- Organization: Chemical Abstracts Service (CAS)
In the June 2004 issue of the C/C++ User's Journal (p. 24) there is an article
on how to write user-defined commands for gdb to examine the contents of STL
vectors, sets and maps. It looks extremely useful, so I decided to try it
modifying the commands for use with the GCC STL, but I can't get some of the
commands for sets and maps to work. It relies on a tecnique that involves being
able to take the address of a convenience variable value, for example:
set $maptype = &$arg0._M_t._M_header->_M_value_field
set $maptypep = &$maptype
When I try this the 2nd statement gives me the error message
Attempt to take address of value not located in memory.
It doesn't work with gdb 5.3 or 6.1 on Solaris. The author claims that it works
on HP-UX, but I don't know why it would be any different.
Is there a way around this? Or is there another source of user-defined commands
that can be used to print the contents of STL containers in gdb? Any help would
be very much appreciated.
Thanks,
Paul Dubuc