Reputation: 1511
In order to make eclipse debug with pretty printing I followed the answer that was given to this question:
Ubuntu 14.04, gcc 4.8.4: gdb pretty printing doesn't work because of Python issue
However I inserted the command inside the ~/.gdbinit file and it didn't work. By running the .gdbinit with sh -x I got that Syntax error: "(" unexpected .
It seems to be a bash error in correlation with the python command. Every solution I search and tried did not fix the problem(e.x use single quotes or without the ; or use #!/usr/bin/python or #!/usr/bin/env python at the beginning of the file). Does anyone have an idea on how to deal with this?
Upvotes: 1
Views: 753
Reputation: 9476
To enable pretty printing on ubuntu 16.04 (default gcc, gdb) this script was required:
python
sys.path.insert(0, '/usr/share/gcc-5/python')
from libstdcxx.v6.printers import register_libstdcxx_printers
register_libstdcxx_printers (None)
end
You will probably need gcc-6 in there.
After this, you need to enter full path to above script in eclipse debug configuration's debugger tab "gdb command file" field and apply the change.
Once this is set up launch via this debug configuration and examine containers in variables view.
For reference, here is CDT FAQ explaining this.
Upvotes: 1