Qtopia Home - Classes - 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 changing the .pro file CONFIG settings:

CONFIG = qt warn_on debug

Then rebuild the makefiles:

$ tmake -o Makefile thefile.pro

And rebuild the application:

$ make clean
$ make

Install the new binary into the /opt/Qtopia/bin directory (/bin). GDB reference

Run the debugging environment

Start the virtual framebuffer environment:

$ qvfb &

Start gdb and ensure that the application hooks to the virtual frame buffer:

$ 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-2004 Trolltech Trademarks
Qtopia version 2.0.1