This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: Printing STL List Entries in GDB
- From: "Eric Chun" <eric dot chun at amd dot com>
- To: "Paolo Carlini" <pcarlini at suse dot de>
- Cc: libstdc++ at gcc dot gnu dot org
- Date: Mon, 25 Jun 2007 17:58:38 -0700
- Subject: Re: Printing STL List Entries in GDB
- References: <46804EDD.5090107@amd.com> <46806058.2000404@suse.de>
I tried using single quotes as well, but it still won't print the value:
p (('std::_List_node' *) $curNode)->_M_data
No symbol "std::_List_node" in current context.
Do I need to the type of list entries I'm trying to print? I'm trying
to create a user-defined command in gdb for printing stl lists so I'd
rather keep the command general so that I could reuse this command for
any other lists I might want to print.
Paolo Carlini wrote:
Eric Chun wrote:
Does anybody know how to print list entries in gdb? I've tried all
the following:
set $curNode = &$list->_M_impl._M_node
p ((_List_node *) $curNode)->_M_data
p ((std::_List_node_base *) $curNode)->_M_data
p *($curNode)
but none of these give me the value of the list entries.
Unfortunately, due to gdb/1588, you have to use quotes for nested names
in casts. For example:
('std::_List_node<int>' *)