Debugging an application on Linux
I want to debug an application on Linux. The application is created in C ++. The GUI is built using QT. The GUI is linked to a static library that can be viewed as the back side of the application.
I want to debug a static library, but not sure how.
I tried using gdb
gdb GUI
But how can I attach the library?
Does anyone have experience with debugging libraries on Linux?
source to share
gdb automatically debugs functions in the library when they are called. just call it like
gdb ./foo
run
:). Make sure you create foo with debug flags ( -g3
will include all debug files for gcc :). You shouldn't optimize when debugging (go max to -O1
in gcc, don't optimize further). This can be confusing to the debugger.
source to share
If you want to debug the library code itself, you will need to create the library with a -g
compiler flag (and also create an executable with -g
as Little noted ). Otherwise, gdb will be good at understanding your code, but will hand out hands every time you make a library call.
source to share
You can try KDbg , DDD - Data Display Debugger, Code :: Blocks
Evidence from DDD, others are IDEs with an integrated debugger, but the main debugger [gdb] remains the same in those IDEs. the only thing is that you get an oval representation of the debugger view in the GUI.
Also try Eclipse + CDT pluggin. this is also good.
source to share