Tired of doing a ‘p/x *this’ only to be confounded by a bunch of gibberish about std:: etc? Maybe you want to add this to your ~/.gdbinit:
cat ~/.gdbinit python import sys sys.path.insert(0, '/usr/share/gcc-8/python') from libstdcxx.v6.printers import register_libstdcxx_printers register_libstdcxx_printers (None) end
Now when you print a string or a list or deque, it works. What sourcery is this? Well, you may have this installed:
$ dpkg -S /usr/share/gcc-8/python/libstdcxx/v6/printers.py libstdc++6:amd64: /usr/share/gcc-8/python/libstdcxx/v6/printers.py
Its a pretty printer. Disabled and sad. You can tell by running the command ‘info pretty-printer’. If its enabled, you’ll see something like this:
global pretty-printers: builtin mpx_bound128 libstdc++-v6 __gnu_cxx::_Slist_iterator __gnu_cxx::__8::_Slist_iterator __gnu_cxx::__8::__normal_iterator __gnu_cxx::__8::slist __gnu_cxx::__normal_iterator __gnu_cxx::slist __gnu_debug::_Safe_iterator std::_Deque_const_iterator std::_Deque_iterator std::_Fwd_list_const_iterator std::_Fwd_list_iterator std::_List_const_iterator
Looks like fun.
Leave a Reply