Debugging with GDB Manual HP WDB v6.3 (5900-2180, August 2012)

u Print as integer in unsigned decimal.
o Print as integer in octal.
t
2
Print as integer in binary. The letter 't' stands for “two
2
.
a Print as an address, both absolute in hexadecimal and as an offset from the nearest preceding
symbol. You can use this format used to discover where (in what function) an unknown address
is located:
((gdb)) p/a 0x54320
$3 = 0x54320 <_initialize_vx+396>
c Regard as an integer and print it as a character constant.
f Regard the bits of the value as a floating point number and print using typical floating point
syntax.
For example, to print the program counter in hex (see “Registers” (page 74)), type
p/x $pc
Note that no space is required before the slash; this is because command names in GDB cannot
contain a slash.
To reprint the last value in the value history with a different format, you can use the print command
with just a format and no expression. For example, 'p/x' reprints the last value in hex.
8.5 Examining memory
You can use the command x (for “examine”) to examine memory in any of several formats,
independent of your program data types.
x/nfu addr,
x addr, x
Use the x command to examine memory.
[n],[ f], and [u] are all optional parameters that specify how much memory to display and how
to format it; addr is an expression giving the address where you want to start displaying memory.
If you use defaults for nfu, you need not type the slash '/'. Several commands set convenient
defaults for addr.
[n], the repeat count The repeat count is a decimal integer and the default is 1.
It specifies how much memory (counting by units u) to
display.
[f], the display format The display format is one of the formats used by print,
's' (null-terminated string), or 'i' (machine instruction). The
default is 'x' (hexadecimal) initially. The default changes
each time you use either x or print.
[u], the unit size The unit size is any of
b Bytes.
h Halfwords (two bytes).
w Words (four bytes). This is the initial default.
g Giant words (eight bytes).
Each time you specify a unit size with x, that size
becomes the default unit the next time you use x. (For
the 's' and 'i' formats, the unit size is ignored and is
normally not written.)
addr, starting display address addr is the address where you want GDB to begin
displaying memory. The expression need not have a pointer
2. 'b' cannot be used because these format letters are also used with the x command, where 'b' stands for “byte”; see
“Examining memory” (page 66).
66 Examining Data