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

Note: This reference card contains frequently used advanced commands with brief
explanation. For more information, see Debugging with GDB Manual.
For any suggestions or help, write to: wdb-help@cup.hp.com
Conventions followed in this card
Convention Description
[ ]
User input required; May be optional.
BOLD
Strings written in bold characters are commands.
“a/b” or a|b”
Either “a” or “b” can be used.
Core-file Debugging
core-file
file
Use core-file file to examine memory and
registers.
packcore [
basenam e
] Create a tar file for executable, libraries and
core-file. Default basename is packcore. So,
the resultant tar file is packcore.tar.Z. Take
the tar file to a different system, examine core
file.
unpackcore Unpacks tar file created with packcore.
[
pack core- file
]
getcore [
pack core- dir
] Examine core-file that is previously imported
with unpackcore.
dumpcore [
file
] Generate a core-file with name file (or by
default core.pid) without modifying the
process’s state.
add-sym [
file
] [
addr
] Read additional symbols from file file
dynamically loaded at address addr.
info rtti [
addr
] Display run-time type information of C++
polymorphic object at address addr.
disassemble [
addr1
] Disassemble a section of the memory of a
[
addr2
]|[
fu nc
] function func.
x[/
fm t
] [
addr
] Display memory content at specified address
addr in any of the format fmt shown below:
x hexadecimal, s string, d decimal.
info registers [
reg
] or Display value of all or that of given register
info all-register [
reg
] reg at the time of core-dump; all-register
also displays floating-point register
information.
set debug-aries [
on
|
of f
] Enable or disable core file debugging in
mixed-mode applications.
set unwind-all-frames Enable or disable limitation on number of
[
on
|
of f
] frames to be unwounded beyond 10000.
print $natr[
reg- nbr
] Print NaT bit corresponding to a register with
number reg-nbr for integrity systems only.
set debug-aries [on|off] Enable or disable core file debugging in
mixed-mode applications.
mmapfile [filename] To add mmap-ed sections while debugging
[map-address] core files, if the core file does not contain
[file-offset] [length] mmap-ed regions from the live run.
(only on Integrity systems)
Debugging Memory Errors
set heap-check [
opt ion
] [
on
/
of f
] Set heap checking options opt:
leaks [
on
/
of f
] Toggle the leak detection capability.
free [
on
/
of f
] Toggle validation of calls to free().
scramble [
on
/
of f
] Scramble freed blocks when on.
bounds [
on
/
of f
] Toggle bounds check on heap blocks.
string [
on
/
of f
] Toggle validation of calls to strcpy(), strncpy(),
memcpy(), memccpy(), memset(),memmove(),
bzero(), bcopy().
frame-count [
nu m
] Set the number num of frames to be printed
for leak and heap profiles.
min-heap-size [
nu m
] Specify minimum size of a block for stack
trace collection. GDB will report blocks of
size greater than or equal to num.
min-leak-size [
nu m
] Specify minimum size of a block for stack
trace collection. GDB will still be able to
report leaks of blocks lesser than num.
watch [
addr
] Stop program execution when a block at the
given address addr is allocated or de-
allocated.
null-check [
n
] Force malloc() to return NULL after n
invocations of malloc().
null-check random Forces malloc to return NULL after a random
number of invocations of malloc().
null-check-size [
n
] Force malloc() to return NULL after n bytes are
allocated by the program.
seed-value [
nu m
] Define seed-value for generating random null-
check-count.
random-range [
nu m
] Specify the range of random null-check-count.
high-mem-count
[
nu m
] Stop when brk() value has moved num times.
retain-freed-blocks
[
on
/
of f
] Specify whether freed blocks have to be
retained which enables advanced corruption
detection.
interval [
nu m
] Specifies the time interval num to be used for
incremental memory profile.
repeat [
nu m
] Perform incremental profile for num cycles.
The default value is 100.
reset Discard incremental heap growth data from
internal data file.
header-size [
nu m
] Specify the header guard bytes for detecting
boundary corruptions.
footer-size [
nu m
] Specify the footer guard bytes for detecting
boundary corruptions.
info leaks [
id
]|[
file
] Display memory leak report for all leaks, or
for a specified leak id, or write in file file if
specified.
info heap [
id
]|[
file
] Display complete heap report or for specified
heap id, or write report to file file.
info heap-interval [
file
] Display incremental memory profile report of
all allocations or write it in a file file.
info heap process Display high level memory usage of a
process.
info heap arenas Display high level memory usage for all
arenas.
info heap arenas [
n
]
blocks Block level and overall memory usage.
info heap arenas [
n
] Block level and overall memory usage details
blocks [m] with stack trace for specified arena and
Block.
info heap arena [
n
] Block level and overall memory usage
blocks stacks with stack trace where applicable.
info dangling Display dangling block report for all dangling
[
blk
]|[
file
] pointers and blocks (which are potential
sources of memory corruption), or for a
specified block blk, or write in file file.
info corruption Memory profile report of all allocations which
appear to be corrupted.
catch nomem Set catchpoint to catch events to gain control
over an out-of-memory event.
catch leaks Set catchpoint to catch events to detect
memory leaks.
Threads Debugging
Gdb [-thread |-threads] Invoke and attach debugger to a process
-p [pid] or gdb [-thread | and enable thread debugging.
-threads]
pid
gdb [-thread |-threads]
[
ex ecu table
] [
pid
]
info threads [
thread- id
] Display information on all current threads
[or a specific thread with a thread-id].
thread [
thread- id
] Switch to the context of thread thread-id.
thread disable
all | [
thread- id
] Disable all threads or a thread thread-id.
thread enable
all | [
thread- id
] Enable all threads or a thread thread-id.
thread apply all [
cm d
] Apply command cmd to all threads.
thread apply [
thread- id1
] Apply command cmd to a list of threads.
[
thread- id2
] …[
cm d
]
backtrace_other_thread Print the backtrace of all stack frames
[
SP
] [
P C
] [
BSP
] for a thread with stack pointer SP,
program counter PC and address
gr32 in the backing store BSP.
break [
linespec
] thread Set breakpoints on all threads or on a
[
thread- id
] if … particular thread with a thread-id.
HP WDB Version 6.3
Advanced Reference Card
HP-UX Specific Commands
http://www.hp.com/go/wdb

Summary of content (2 pages)