Turn from: http://mooncome.blog.hexun.com/13684978_d.html
You can use the examine command ( abbreviated x) to view the values in the memory address. The syntax for the x command looks like this:
X/<n/f/u> <addr>
N, F, and u are optional parameters.
n is a positive integer that indicates the length of memory displayed , that is, the contents of several addresses are displayed backwards from the current address.
The f represents the displayed format , see above. If the address refers to a string , then the format can be s, and if the address is the instruction address , then the format can be i.
U represents the number of bytes requested from the current address and, if not specified, gdb defaults to 4 bytes. The u parameter can be replaced with the following characters, b for Single-byte, H for Double-byte, W for four bytes, and G for eight bytes. When we specify the byte length, GDB starts with the memory address of the memory, reads and writes the specified byte, and takes it out as a value.
<addr> represents a memory address.
N/f/u three parameters can be used together. For example:
Command:x/3uh 0x54320 indicates that the content is read from the memory address 0x54320 ,h means a double byte as a unit,3 represents three units,u represents a hexadecimal display.
Output format
In general, GDB outputs the value of a variable based on its type. But you can also customize the format of GDB's output. For example, you want to output the hexadecimal of an integer, or binary to see the position of the bit in the integer variable. To do this, you can use GDB's data display format:
x displays variables in hexadecimal format.
D displays variables in decimal format.
U displays the unsigned integer in hexadecimal format.
o Display variables in octal format.
T displays variables in binary format.
A the variable is displayed in hexadecimal format.
C displays variables in character format.
F displays variables in floating-point format.
(GDB) P I
$21 = 101
(GDB) p/a I
$22 = 0x65
(GDB) P/C I
$23 = ' E '
(GDB) p/f i
$24 = 1.41531145e-43
(GDB) p/x i
$ = 0x65
(GDB) p/t i
$26 = 1100101
====================================
"Yasi"
1) use X command to view memory
x/3uh 0x54320 start with address 0x54320, read 3 double-byte (h), display in 16-Way (u)
3 can be replaced with any positive integer
You can substitute for:
d display variables in decimal format
x display variables in hexadecimal format
A variable is displayed in hexadecimal format
U show unsigned integer in hexadecimal format
o Display variables in octal format
t display variables in binary format
c Display variables by character format
f Display variables by floating-point number format
h can be replaced by:
B is single byte, h is double Byte, W is four Byte, G is eight bytes
2 The P command adds a parameter to print the value of the variable in different forms
(GDB) p/a I or (gdb)p/x i
$22 = 0x65
(GDB) P/C I
$23 = ' E '
(GDB) p/f i
$24 = 1.41531145e-43
(GDB) p/t i
$26 = 1100101