HP WDB v6.3 Base Reference Card (August 2012)

2
info module [
addr
] Identify load module whose text or data
section contains given address addr.
info locals Display the local variables of the selected
frame of current stack.
info register [
reg
] Display value all or that of given register reg
in the selected frame.
info all-register [
reg
] Same as info register, the only difference is
that it also includes information for floating
point registers.
Display
print[/fmt] [
expr
] Show value of expr [or last value $] according
to format fmt.
x[/
fmt
] [
expr
] Examine memory at address expr in given
format fmt.
disassemble [
addr1
]
[
addr2
] Display memory as machine instructions.
Expressions
expr Represents an expression in C, C++ (including
function calls).
[
addr
]@[
len
] An array of length len elements beginning at
memory address addr.
[file]::[
nm
] A variable or function nm defined in file.
(type)
addr
Read memory at address addr as type type.
$ Represents most recent displayed value.
$n Represents the nth displayed value.
$
$
Represents value displayed previous to $.
$
$n
Represents the nth displayed value backwards
from $.
$var Convenience variable; can assign any value.
show values [
n
] Show last 10 values [or surrounding $n].
show convenience Show all convenience variables.
Symbol Table
info address [
sym
] Show where symbol sym is stored.
info functions [
regex
] Show signature of all [or only those] functions
whose names match regex.
info variables [
regex
] Show all [or only those] global variables (with
type information) whose names match regex.
whatis [
expr
] Show data type of expr [or $] without
evaluating it.
ptype [
arg
] Show definition of type of arg (arg can be a
data-type or an expr).
which [sym] Prints the scope, file and line details of
symbol except for global symbols and type
name.
GDB Input Scripts
source [
file
] Read commands from a file named file.
define [
cm d
] Define a new script/command with name cmd
[
cmdlist
] containing command-list cmdlist (one per line)
end Specify end of command-list.
document [
cm d
] Create online documentation for user defined
[help-text] command cmd with help-text.
end End of help-text.
Signals
handle
sig
[
arg1
] [
arg2
] …
Change the way GDB handles signal sig.
print or noprint Announce or be silent for signal.
stop or nostop Halt or do not halt execution on signal.
pass or nopass Pass or no pass of signal to program.
info signals [
sig
] or Show all or a particular signal sig, with GDB
info handle [
sig
] action.
Controlling GDB
set param [
value
] Set value to GDB’s internal parameter param.
show [
param
] Display current setting of parameter param
Parameters understood by
set
and
show
commands are as shown below:
complaint limit Number of messages on unusual symbols.
confirm [
on/off
] Enable or disable cautionary queries.
height
lpp
Number of lines before pause in display.
listsize [
n
] Number of lines shown by list.
prompt [
str
] Use str as GDB prompt.
radix base Octal, decimal, or hex number representation.
verbose [
on/off
] Control messages when loading symbols.
width cpl Number of characters before line folds.
print [
options
]
or p [
options
] Groups with the following options:
p address [
on/off
] Print memory addresses in stacks, values.
p array [
on/off
] Compact or attractive format for arrays.
p demangle Source (demangled) or internal form for
[
on/off
] C++ symbols.
p asm-dem [
on/off
] Demangle C++ symbols in machine-instruction
output.
p elements [
lim it
] Number of array elements to display.
p object [
on/off
] Print C++ actual type for object.
p pretty [
on/off
] Structure display: compact or indented.
p union [
on/off
] Display of union members.
p vtbl [
on/off
] Display of C++ virtual function tables.
show commands [
n
/+] Show last 10 commands [or those around
command number n or show next 10
commands]
Files/Modules
file [file] Use file as program to be debugged.
exec-file [
file
] Use file as program for getting contents of
pure memory.
symbol [
file
] Load symbol table from executable file file.
load [
file
] Dynamically link file and add its symbols.
add-sym
file
[
addr
] Read additional symbols from file file
dynamically loaded at address addr.
info files Display working files.
info target Display targets in use.
path [
dirs
] Add directories dirs to the beginning of
search path for executable and object files.
show paths Display executable and object file path.
info share Display all the shared libraries currently
loaded.
set mapshared [
on/off
] Set the shared library loading mode in GDB.
Source Files
dir [
nam es
] Add directory names before the source path.
dir Clear and set source path to default directory.
show dir Show current source path.
list [-] Show next or previous [-] ten lines of source.
list [
arg
] Display source code as per arg shown below:
[file:]
line
Surrounding line [in file].
[
file
:][
func
] Beginning of function func [in file].
list [+
off
| -
off
] Offset after or previous to the last print.
[*
addr
] Surrounding the address addr.
line1
,
line2
From line1 to line2.
info line [
n
] Display core addresses of source code line n.
info source List the current source file.
info sources List all source files in use.
search [
regex
] or Search following source lines for expression
forward-search [
regex
] regex.
reverse-search [
regex
] Search preceding source lines for regular-
expression regex.
Logging Commands
set logging file [
file
] Set log-file to file (default: . gdb_output).
set logging [
on
|
off
] Enable or disable logging of GDB output.
set logging overwrite
[
on
|
off
] Allow overwrite or append to the log-file.
set logging redirect
[
on
|
off
] Redirect GDB output to log-file only.
Or, you can use the following set of commands:
set redirect [
on/off
] Enable or disable logging of GDB output.
set redirect-file [
file
] Set log-file to file (default: . gdb_output).
set redirect-mode
overwrite | append
Allow overwrite or append to the log-file.
© Copyright 2012 Hewlett-Packard Development Company, L.P.