MeeGo 1.2 Harmattan Developer Documentation Develop for the Nokia N9

Debugging boosted applications

Debugging

Prerequisites

  • Enable developer mode from Settings->Security->Developer Mode
  • Install the Debugging tools
  • Establish an ssh connection between your host and device

To debug a launched application:

  1. Attach the debugger (gdb) to the already running application. For instance, on the terminal, run the following command:
    /usr/bin/native-gdb /usr/bin/applauncherd.bin $(pgrep [launched_app_name])
    
  2. Set a breakpoint(s) to the application code in the gdb prompt and then continue:
    (gdb) break main.cpp:42
    (gdb) ...
    (gdb) c
    Continuing.
    
  3. Start debugging the application

PIE binaries and debugging

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