This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Debugging STL containers


Hello,

I'm a C++ developer with an MS windows background, developing a G++
application on Linux which makes extensive use of the STL. There are
many nested templates in this application. I'd like to be able to
inspect the contents of the container in debug mode, as in visual
studio. Using <debug/map> rather then <map> looked promising. However,
due, presumably, to inlining and other optimisations, the value of the
maps are still resolved to things like:

( variable is a
__gnu_debug::map<int,__gnu_debug::map<int,__gnu_debug::map<int,int> >
>  , incidentally)

{<__gnu_norm::map<int,__gnu_debug_def::map<int,
__gnu_debug_def::map<int, int, std::less<int>,
std::allocator<std::pair<const int, int> > >, std::less<int>,
std::allocator<std::pair<const int, __gnu_debug_def::map<int, int,
std::less<int>, std::allocator<std::pair<const int, int> > > > >
>,std::less<int>,std::allocator<std::pair<const int,
__gnu_debug_def::map<int, __gnu_debug_def::map<int, int,
std::less<int>, std::allocator<std::pair<const int, int> > >,
std::less<int>, std::allocator<std::pair<const int,
__gnu_debug_def::map<int, int, std::less<int>,
std::allocator<std::pair<const int, int> > > > > > > > >> = {_M_t =
{_M_impl = {<std::allocator<std::_Rb_tree_node<std::pair<const int,
__gnu_debug_def::map<int, __gnu_debug_def::map<int, int,
std::less<int>, std::allocator<std::pair<const int, int> > >,
std::less<int>, std::allocator<std::pair<const int,
__gnu_debug_def::map<int, int, std::less<int>,
std::allocator<std::pair<const int, int> > > > > > > > >> =
{<__gnu_cxx::new_allocator<std::_Rb_tree_node<std::pair<const int,
__gnu_debug_def::map<int, __gnu_debug_def::map<int, int,
std::less<int>, std::allocator<std::pair<const int, int> > >,
std::less<int>, std::allocator<std::pair<const int,
__gnu_debug_def::map<int, int, std::less<int>,
std::allocator<std::pair<const int, int> > > > > > > > >> = {<No data
fields>}, <No data fields>}, _M_key_compare = {<> = {<No data
fields>}, <No data fields>}, _M_header = {_M_color = std::_S_red,
_M_parent = 0x8165d50, _M_left = 0x8165d50, _M_right = 0x8165d50},
_M_node_count = 1}}},
<__gnu_debug::_Safe_sequence<__gnu_debug_def::map<int,
__gnu_debug_def::map<int, __gnu_debug_def::map<int, int,
std::less<int>, std::allocator<std::pair<const int, int> > >,
std::less<int>, std::allocator<std::pair<const int,
__gnu_debug_def::map<int, int, std::less<int>,
std::allocator<std::pair<const int, int> > > > > >, std::less<int>,
std::allocator<std::pair<const int, __gnu_debug_def::map<int,
__gnu_debug_def::map<int, int, std::less<int>,
std::allocator<std::pair<const int, int> > >, std::less<int>,
std::allocator<std::pair<const int, __gnu_debug_def::map<int, int,
std::less<int>, std::allocator<std::pair<const int, int> > > > > > > >
> >> = {<__gnu_debug::_Safe_sequence_base> = {_M_iterators = 0x0,
_M_const_iterators = 0x0, _M_version = 1}, <No data fields>}, <No data
fields>}

I have this preprocessor declaration:

#ifndef _GLIBCXX_DEBUG_MAP
#include <debug/map.h>
#define _GLIBCXX_DEBUG_MAP 1
#endif

Why is there a member in the "__gnu_norm" namespace? Will I ever be
able to inspect the contents of my maps *at all* using
__gnu_debug::map? If not, is there an alternative way to inspect the
contents of libstdc++ STL containers?

Regards,
Peter Geoghegan


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]