I need to debug a C++ application (compiled with g++-4.5) with gdb on interactive console. I know very little about it, except the start, list and bt commands. I’m not asking for a tutorial about it, as I’ve found plenty with my old friend google. I just need a little bit help with something I cannot find in the help or references.
The C++ application is a UnitTest++ runner, that links several shared libraries. All these libraries have been built with the appropiate flags for debug information (-ggdb -O0) and I just need a way to set a breakpoint at a certain source file of one of the shared libraries. I’m not sure how I am supposed to navigate to that listing and set the breakpoints
Any gdb guru still out there wanting to lend a hand?
To set breakpoint use
breakcommand in gdb. You can use the aliasbalso.Example if you want to break at line 61 in
file.cpp(gdb) b file.cpp:61OR
(gdb) b "file.cpp":61If you want to break at a method in a class, type the class name at the gdb prompt and press tab, it will show you all the methods in the class, you can then set breakpoint like this.
Example a method
display()inclass Foo(gdb) b Foo::display()If you want a more interacive/GUI mode then use Data Display Debugger(DDD) or go for Eclipse CDT
To see the status of shared libraries loaded, use
info shared