When using CDT I would like to have std::string show up in the 'variable' debug window with the string it contains. For instance if it is currently holding the word "history" I would like to see history in the debugger window labeled "variables".
I think that there is a general way to have it drill down into objects but I can't put my finger on it. Does anyone out there know how to do this?
This would also be useful for me to use when outputting just a single field from a complex object.
Thanks, Bill
Displaying stl containers with eclipse/gdb was also a major pain for me for a long time.
But now I've just discovered that the latest version of gdb with python enabled can help with that.
It follows what I've done (using Ubuntu Linux 8.10):
Create a file named .gdbinit in your project root with the following content:
python import gdb.libstdcxx.v6.printers
Now the stl containers will be pretty printed.
If you want to check if you already have a python enabled gdb (or if your new installation have worked):
On the gdb prompt execute the following
(gdb) python print 'Python enabled GDB is working!'
If the above command produces what we are expecting then it is working.
For more details check this blog.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With