I'm trying to accomplish pretty printers (for viewing variables of type vectors,lists etc, STL containers) for debugging C++ using Eclipse (Version: Kepler Service Release 1) and CDT in Mac OSX Mountain Lion. I know I can use XCODE to debug, but want to debug using Eclipse. I appreciated any help. Thanks.
I tried the following, but failed debugging:
Downloaded GNU gdb from
ftp://ftp.gnu.org/gnu/gdb/gdb-7.6.tar.gzInstalled GNU GDB with python the following way
./configure --prefix=/usr/local/gdb7.6 --with-python=/usr/bin/python make make installChecked-out the latest Python libstdc++ printers to a folder ~/gdb_printers
svn co svn://gcc.gnu.org/svn/gcc/trunk/libstdc++-v3/pythonCreated ~/gdb_printers/.gdbinit and added the following in the .gdbinit file
python import sys sys.path.insert(0, '/Users/ravi/gdb_printers/python') from libstdcxx.v6.printers import register_libstdcxx_printers register_libstdcxx_printers (None) endEclipse Setup
In Windows > Preferences > C/C++ > Debug > GDB
Where it Says GDB Debugger /usr/local/gdb7.6/bin/gdb
Where it says GDB Command File: /Users/ravi/gdb_printers/.gdbinit
Now, when I try to debug, I get the following error.
Error in final launch sequence Failed to execute MI command: source /Users/ravi/gdb_printers/.gdbinit Error message from debugger back end: /Users/ravi/gdb_printers/.gdbinit:6: Error in sourced command file:\nError while executing Python code. /Users/ravi/gdb_printers/.gdbinit:6: Error in sourced command file:\nError while executing Python code.