user1040229
user1040229

Reputation: 501

Getting GDB pretty printing for C++ stl containers to work on Eclipse

gdb shows the following when I type "show version":

GNU gdb (GDB) Red Hat Enterprise Linux (7.0.1-23.el5_5.2)

I followed the instructions on this website for setting up pretty printing with Eclipse:

http://wiki.eclipse.org/CDT/User/FAQ#How_can_I_inspect_the_contents_of_STL_containers.3F

When I attempt to start gdb with my new .gdbinit file, I get the following error:

Error in sourced command file:
Python scripting is not supported in this copy of GDB

So then I researched around for a way to enable this. I have over version 7.0 so it should be able to support Python scripting. GDB's website mentions calling the GDB configure script with the --with-python option. However, I don't see a configure script anywhere in my system. There are multiple developers using this machine so I don't want to have to reinstall GDB or anything like that. Is there a way to configure the existing GDB installation to enable python scripting? Thanks!

Upvotes: 3

Views: 4829

Answers (1)

dwerner
dwerner

Reputation: 6602

To get you started, you can compile GDB in a separate directory, and run it from there.

Grab the sources for the version you want: http://sources.redhat.com/gdb/

Run ./configure with the --with-python, and then make, but don't install it over your system copy.

At that point, you should be able to invoke gdb where it has been built with ./builddir/gdb, rather than the one in your path. (This is where you should point eclipse debugging to, if you want to invoke it from there)

Upvotes: 5

Related Questions