How do you debug a Qt app with gdb?
A little advice from http://doc.qt.nokia.com/4.7-snapshot/debug.html#command-line-options-recognized-by-qt...
Without Frameworks:
When you tell qmake to generate a Makefile with the debug config, it will link against the _debug version of the libraries and generate debug symbols for the app. Running this program in GDB will then work like running GDB on other platforms, and you will be able to trace inside Qt.
...and http://stackoverflow.com/questions/8949956/build-qt-project-in-debug-mode-from-command-line-aka-bash-script-in-linux helped bring me to this solution:
First pass CONFIG+=debug to your typical qmake -project command.
qmake -project CONFIG+=debug
Then:
qmake -spec macx-g++
(This is the proper qmake command on mac. It might just be "qmake" for other systems.)
Next:
make
Now let's say your app is called "Game":
gdb ./Game.app/Contents/MacOS/Game
(For Mac, the executable is here for whatever reason. Also, note the . in ./)
If you're not on Mac, then just do
gdb ./yourGameExecutable
or wherever your game executable is.
No comments:
Post a Comment
Please be considerate in what you say.