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

5 answers

gdb automatically debugs functions in the library when they are called. just call it like

gdb ./foo


:). 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.



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.



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.



A little known alternative to gdbtui that uses curses.



You can also use Kdbg or ddd



All Articles