Printing STL List Entries in GDB

Paolo Carlini pcarlini@suse.de
Tue Jun 26 00:58:00 GMT 2007


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>' *)

Paolo.



More information about the Libstdc++ mailing list