Prerequisites
To debug a launched application:
/usr/bin/native-gdb /usr/bin/applauncherd.bin $(pgrep [launched_app_name])
(gdb) break main.cpp:42
(gdb) ...
(gdb) c
Continuing.
If you use the pkg-config
when building your binaries, they are linked with the -pie
flag. The -pie
flag makes your binaries position-independent executables. This means that the executables can be either used as a normal shared library or run, for example, from the command line.
This creates problems when debugging your application with gdb older than version 7.1 which introduced the support for PIE binaries.
To use gdb 7.0 or earlier, link your binaries as libraries by using -shared
instead of -pie
. After this, you cannot execute your binaries directly, you have to use invoker
.
Setting correct linker flags with qmake:
QMAKE_CXXFLAGS += -fPIC -fvisibility=hidden -fvisibility-inlines-hidden QMAKE_LFLAGS += -shared -rdynamic
Remember to remove the CONFIG += qdeclarative-boostable, if used (the same applies for meegotouch-boostable or qt-boostable).