Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

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



Standard GDB command summary


Purpose

GNU Debugger (GDB) commands can be entered from the GDB command prompt, from the Insight GUI command console, or (in some cases) from the gdb initialisation file.

This document provides a brief GDB command summary, listing of a few standard GDB commands that are useful for setting up connections to a Symbian device for debugging. The "See also" section below provides links to on-line resources related to GDB and GDB commands.


See also

[Top]


GDB command syntax

break BreakPoint

b BreakPoint

Sets a breakpoint at a given function or line number. b is the shorthand form of break.

Examples:

break Meadebug.cpp:110

b CMeadebugAppUi::HandleCommandL

info breakpoints

Displays a list of the current breakpoints.

delete BreakPointNumber

Removes the breakpoint BreakPointNumber.

delete 1

clear LineNumber | Function

Deletes a breakpoint from the specified target function or line number.

clear Meadebug.cpp:110

clear CMeadebugAppUi::HandleCommandL

run

r

Runs the program on the debuggee that was specified using the epoc-exe-file command. r is the shorthand form of run.

step

s

Steps into the function on the current line, tracing into other functions where necessary.

stepi

si

As for step, only though disassembled code.

next

n

Executes the current function and moves to the next one. Unlike step it does not trace into the function.

nexti

ni

As for next, only though disassembled code.

continue

c

Executes all code until a breakpoint is reached or the debuggee exits.

until

Executes all code until a specified function or line of code is reached.

Examples:

until MyFunction

until Interface.cpp:407

info sources

Lists all the files that GDB knows about.

Ctrl + C

Interrupts the debuggee.

This does not work from the Insight GUI.

set var VariableName

Sets the value of a specified variable.

set var console=0x1234

print VariableName

p VariableName

Prints the type and value of a variable.

print console

backtrace [NumberLines]

bt [NumberLines]

Performs a backtrace of the stack, showing the history of function calls. The number of previous functions to be displayed can also (optionally) be specified.

backtrace

backtrace 2

list [FileName:LineNumber]

l [FileName:LineNumber]

Lists the section of code around the current cursor position, or if given, around the specified file/line number.

list

list File.cpp:120

disassemble Function | AddressRange

disas Function | AddressRange

Disassembles code starting at the specified function or over the specified address range.

info reg pc

Displays the value of the program counter.

(gdb) info reg pc

pc 0x20000238 536871480

set args Arguments

Sets the command-line of the debuggee.

When the debuggee is an application, the command-line is the path of the document to open or create — if it does not already exist. If no argument is specified, then the application will open or create the default document if any. If no default document is specified the application may panic during its execution.

If the document path contains blanks, then it should be double-quoted.

Examples:

set args document_name.suffix

set args "document name with blanks.suffix"

set remotebaud BaudRate

Sets the connection speed to BaudRate.

By default the connection speed is 115200 baud. This default can also be over-ridden using using a command line flag to start GDB.

Example:

set remotebaud 9600

show args

Displays the command-line of the debuggee.

show remotebaud

Displays the current connection speed in baud.

source GDB-Script

Loads GDB scripts into GDB.

This command is included here because it must be used to load the script used for descriptor debugging. This allows the command epoc-print-des16 to be used to debug descriptors. The line below should be included in the GDB initialisation file to add the GDB script epoc-des.ini, where x is the correct path for your installation of the SDK.

source //x/epoc32/gcc/share/epoc-des.ini

symbol-file SymbolFileName

Load debugging information for the debuggee.

SymbolFileName is the path and filename of the file containing the program's debugging information. Symbol files are stored along with the binaries under \epoc32\release\ in files ending with .sym.

Example:

symbol-file //x/epoc32/release/armi/udeb/foobar.sym

quit

q

Closes the GDB session:

This closes the debuggee and moves the GDB stub into the background.