[ fromfile: debugging.xml id: builddebug ]
For gdb
to work, debugging symbols must be built into the code at compile time.
Otherwise, the machine instructions will not be mapped to locations in C++ source files.
This is easily accomplished by using the appropriate command-line switch (-g
) when invoking the compiler:
g++ -g filename.cpp
This often results in a significantly larger executable file.
Generally, the growth is proportional to the size and complexity of the source code files.
The expanded executable contains symbol table information that the debugger can use to find source code that corresponds to machine instructions.
To get qmake
to generate makefiles with the debugging options switched on, add the following line to your qmake
project file:
CONFIG += debug
When the Qt library has been built with debugging symbols, you can step through the Qt source code just as easily as your own code. You may need to build Qt with debugging symbols to debug programs that contain code called from the Qt library (most GUI programs, for example).
Building Qt with Debugging Symbols | |
---|---|
In Win32, it's a menu choice you can click on. On *nix platforms, after unpacking the source code tarball, pass a parameter to the ./configure --enable-debug make make install |
Generated: 2012-03-02 | © 2012 Alan Ezust and Paul Ezust. |