Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gdb pretty printing is not working

I am trying to view the contents of C++ STL Containers. I read here that the recent versions of gcc and gdb support pretty printing by default but when I tried to display a map I got the following:

enter image description here

Then, I tried to set up pretty printing according to this answer but still it shows the same output. Can someone please help me out? Thanks.

I am using Ubuntu 16.04, g++ 5.4.1, GDB 7.11.1 and python 2.7.12 (installed from their official sources).

like image 484
piyukr Avatar asked Nov 28 '25 00:11

piyukr


1 Answers

Mark was correct. I built my own version of gdb 8.0 with --with-python option but still I was not able to see container contents. gdb was showing all complex structure. So I followed Mark's suggestion.

You need to create a soft link (auto-load) in your gdb install directory. If your gdb install directory is $HOME/gdb_install then

cd $HOME/gdb_install/share/gdb

ln -s /usr/share/gdb/auto-load auto-load

/usr/share/gdb/auto-load already exists on my Ubuntu installation. It's the gdb version 7.11.1.

After that gdb is showing container contents. Thanks Mark.

like image 188
swanand arjunwadkar Avatar answered Nov 29 '25 14:11

swanand arjunwadkar