I have a simple template class:
namespace test
{
template< class Key, class Value, class Container = std::map< Key, Value > >
class DB
{
public:
static DB& instance()
{
static DB _instance;
return _instance;
}
private:
DB(){};
DB( DB const& ){};
void operator=( DB const& ){};
Container _db_internal;
};
}
When I debug in gdb I want to see the _db_internal container, but don't know how to access it.
I tried writing in gdb:
p 'test::DB<std::string, someclass*, std::tr1::unordered_map< std::string, someclass* > >::instance()::_instance'._db_internal
and it gives me: No symbol ... in current context
also tried without single quotes but no luck.
How to print that container in gdb? I'm using gdb version: 7.6.1
Thanks
As suggested using gdb autocomplete I was able to get this:
p 'test::DB<std::string, std::string, std::map<std::string, std::string, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > > >::instance()::_instance'
but that gives me 0 which is not good
then if I tried:
p 'test::DB<std::string, std::string, std::map<std::string, std::string, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > > >::instance()::_instance._db_internal'
I also got an error saying:
No symbol "test::DB<std::string, std::string, std::map<std::string, std::string, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > > >::instance()::_instance._db_internal" in current context.
p 'test::DB<std::string, someclass*, std::tr1::unordered_map< std::string, someclass* > >::instance()._db_internal'?