Qt-UI

Debugging

Compilation with CMake | | Using SVN

With a QMake project we can use the QtCreater IDE to manage the projects, edit the source code and UI or add break points.

With CMake we have 2 options to debug Qt code:

  • Import the CMake list into the KDevelop IDE and set break points there.
  • Configure the CMake project manually to create debug code instead of release code and use the GNU command line debugger to debug it:
cmake -DCMAKE_BUILD_TYPE=Debug .
make
gdb myqtapp

Alternatively, we can use the ccmake curses configuration tool to set the CMAKE_BUILD_TYPE or other compiler flags manually:

ccmake .
make
gdb myqtapp

On the gdb command line we can set break points:

break main

and run the program until the break point is hit:

run

or list the call stack (e.g. after a crash):

where

or print variables:

p var

or simply step over the next line of code:

n

or simply step into the next command or function:

s


Compilation with CMake | | Using SVN

Options: