t2Print as integer in binary. The letter 't' stands for “two”2.

aPrint 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>

cRegard as an integer and print it as a character constant.

fRegard 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 98)), 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, Use the x command to examine memory.

xaddr, x

[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.

hHalfwords (two bytes).

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 87).

8.5 Examining memory 87

Page 87
Image 87
HP gnu source-level debugger 5992-4701 manual Examining memory, Print, s null-terminated string, or