Henok Tesfaye
Henok Tesfaye

Reputation: 9570

examine command in gdb?

A number can also be prepended to the format of the examine command to examine multiple units at the target address.

source: hacking the art of exploration

(gdb) x/2x $eip
0x8048384 <main+16>:   0x00fc45c7 0x83000000

(gdb) x/x $eip
0x8048384 <main+16>:   0x00fc45c7

I know that the second examine command returns the memory address that eip is currently locating. What about the first one which returns two memory address?

Upvotes: 3

Views: 1535

Answers (1)

kalehmann
kalehmann

Reputation: 5011

The examine command of gdb has the following syntax:

x/[n][f][u]

where n, f and u are optional and n is the length, f the format and u the unit size.

Possible formats are:

  • s (null terminated string)
  • i (machine code instruction)
  • x (hexadecimal value)

If no unit size can be one of the following values:

  • b (bytes)
  • h (2 bytes)
  • w (4 bytes)
  • g (8 bytes)

where w is the default.

Therefore x/2x prints 2 hexadecimal values with a size of 4 bytes from your code segment.

Upvotes: 2

Related Questions