Home · All Classes · Annotated · Functions

Debugging Qtopia Applications

Introduction

Qtopia provides GNU Debugger gdb to monitor program execution and to examine program status in the event of a crash and the qlog function to provide categorized logging of debug information. The following sections describe how to used gdb in a Linux environment and how to call implement the qlog function.

Using gdb

This section provides instructions on how to debug Qtopia applications using igdb in a Linux environment.

Build the Application with Debug Symbols

To build an application with debug symbols:

Run the Debugging Environment

To run the debugging environmnent:

using the following commands:

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

Alternatively to debug an application outside of the Qtopia environment:

using the following commands:

    $ 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 an application built with debug crashes, a core file is produced. Use the following commands to examine the core file contents:

    $ gdb theapplication core
    (gdb) backtrace full

qlog - Categorized Logging

Qtopia provides the qlog(CategoryIdentifier) function for categorized logging.

The syntax for logging is:

         qLog(I18n) << "Language loaded:" << lang;

The categories are declared by use of one of these macros:

The CategoryIdentifier has _QLog appended within the macros, so it can be any identifier you choose. The associated type name might be a useful choice:

         qLog(QWidget) << "Created" << name;

Example mechanisms by which your expr might choose whether logging is enabled include:

References


Copyright © 2006 Trolltech Trademarks
Qtopia 4.1.7