Qtopia Home - Classes - Hierachy - Annotated - Functions - Qt Embedded

Debugging Qtopia Application With Gdb

Introduction

GDB is the GNU Debugger. It is used to monitor a program while it executes and to examine what a program was doing when it crashed.

For more information on what GDB is, please refer to the GNU site http://www.gnu.org/software/gdb/gdb.html

The rest of this page provides instructions how to debug Qtopia applications using gdb in a Linux environment.

Rebuild the application with Debug symbols

This is done by passing -debug to configure. Alternatively, by adding 'debug' the .pro file CONFIG settings:

CONFIG += debug

And rebuild the application and install the application binary into the /opt/Qtopia/bin directory (/bin):

$ make clean
$ make
$ make install

GDB reference

Run the debugging environment

Start the virtual framebuffer environment and the qtopia environment, then start gdb:

$ qvfb &
$ qpe &
$ gdb theProgram
(gdb) r # run

Alternatively to debug an application outside of the qtopia environment, start the virtual framebuffer environment and ensure that the application hooks into the virtual frame buffer:

$ qvfb &
$ gdb theProgram
(gdb) set args - qws # we need this to hook to the virtual frame buffer.
(gdb) list # if you want to list the main.cpp file
(gdb) b 6 # break at line six
(gdb) r # run
(gdb) s # step into
(gdb) r # continue

Debug crashes

If the application crashes, it should produce a core file. To examine this core file (assuming the build was done as a debug build so the symbolic information is present to figure out what happened), do the following:

$ gdb theapplication core
(gdb) backtrace full

Other References


Copyright © 2001-2005 Trolltech Trademarks
Qtopia version 2.1.1