Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[gdb-6.8.50] Enabling pretty printing for STL containers
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Unsupported Software
View previous topic :: View next topic  
Author Message
Leander256
l33t
l33t


Joined: 05 Jul 2003
Posts: 909
Location: Singapour

PostPosted: Fri Jun 19, 2009 5:57 pm    Post subject: [gdb-6.8.50] Enabling pretty printing for STL containers Reply with quote

Hello,

Yesterday night I installed the masked version of gdb which includes support for python scripting. The feature I'm trying to use is "pretty printing" for the STL. Looks like the main author blogged about it. So far, I found some information scattered on stackoverflow.com but I didn't manage to make it work.

This is my ~/.gdbinit (for the sake of simplicity I do my testing in ~/):
Code:
python import gdb.libstdcxx.v6.printers


Then during the debugging session, I do the following:

Code:
(gdb) print myVector
$1 = {<std::_Vector_base<long, std::allocator<long> >> = {
    _M_impl = {<std::allocator<long>> = {<__gnu_cxx::new_allocator<long>> = {<No data fields>}, <No data fields>}, _M_start = 0x604100,
      _M_finish = 0x604150, _M_end_of_storage = 0x604180}}, <No data fields>}

(gdb) set print pretty on

(gdb) print myVector
$2 = {
  <std::_Vector_base<long, std::allocator<long> >> = {
    _M_impl = {
      <std::allocator<long>> = {
        <__gnu_cxx::new_allocator<long>> = {<No data fields>}, <No data fields>},
      members of std::_Vector_base<long, std::allocator<long> >::_Vector_impl:
      _M_start = 0x604100,
      _M_finish = 0x604150,
      _M_end_of_storage = 0x604180
    }
  }, <No data fields>}


Obviously, it doesn't get any better. Does somebody have a clue about how to make it work?
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Unsupported Software All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum