Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

[Index] [Glossary] [Previous] [Next]



How to use GDB

This section provides a brief guide of some of the common debugging operations that can be performed with GDB. It is assumed that, before starting to debug, a connection has already been set up, as discussed in How to set up remote debugging, and that the target application, symbol file, initial breakpoint etc. have been set up as described in How to configure the GDB initialisation file.

All commands are entered on the CLI command line or on the Insight Console, unless otherwise specified. Further information on the commands discussed in this section is provided in the GDB command summary.


How to run the debuggee

Enter run to start the debuggee on the target device and begin debugging.

Note:

[Top]


How to step through code

This section describes the commands used to navigate through code while debugging:

[Top]


How to set and clear breakpoints

The following commands are used to set, clear and get information about breakpoints

[Top]


How to examine and change variables

The following commands are used to display and set variable values:

[Top]


How to perform a stack trace

The backtrace command is used to perform a backtrace of the stack, showing the history of function calls:

[Top]


How to list source files

Enter list to display the section of code around the current cursor position.

list

Enter list FileName:LineNumber to display the code around the specified line in the specified file. If a file is specified, then a line number must also be specified.

list File.cpp:120

Note that this provides a limited method of displaying code being debugged. It is usually easier to the GUI for this purpose.

[Top]


How to disassemble code

The following commands are used to disassemble a chunk of code, step through, and get the value of the program counter.

[Top]


How to close a debug session

To close the debug session:

  1. On the host: type "q" or "quit" on the GDB command prompt.

    This shuts down GDB and closes the debuggee. Note that the GDB stub is still running, although it is moved into the background when GDB is closed.

    (gdb) q

  2. On the GDB stub: Press "q" twice.

    It may be necessary to bring the GDB stub to the foreground in order to close it. Note that the method used to bring the stub forward may need to be different on different devices. See the Symbian Developer Network for device-specific information.