You can use the EXAMINE command (abbreviated as X) to view the value in the memory address. The syntax of the X command is as follows:
X/<n/f/u> <ADDR>
N, f, and u are optional parameters.
N is a positive integer that shows the memory length, that is, the content of several addresses is displayed from the current address to the back.
F indicates the display format. See the preceding figure. If the address refers to a string, the format can be S. If location 10 is the instruction address, the format can be I.
U indicates the number of bytes requested from the current address. If not specified, GDB defaults to four bytes. The U parameter can be replaced by the following characters. B represents a single byte, H represents a double byte, W represents a four-character section, and G represents an eight-character section. When we specify the byte length, GDB reads and writes the specified byte starting from the memory address specified by the memory and takes it as a value.
<ADDR> indicates a memory address.
The n/f/U parameters can be used together. For example:
Command: X/3uh 0x54320 indicates that the content is read from the memory address 0x54320, h indicates that the two bytes are used as a unit, and 3 indicates that three units are output, the u table is displayed in hexadecimal format.
Output Format
Generally, GDB outputs the value of a variable based on the type of the variable. However, you can also customize the output format of GDB. For example, you want to output a hexadecimal integer or a binary value to view the bitwise of the integer variable. To do this, you can use the gdb data display format:
X displays variables in hexadecimal format.
D. Display variables in decimal format.
U displays unsigned integers in hexadecimal format.
O display variables in octal format.
T display variables in binary format.
A displays variables in hexadecimal format.
C. Display variables in character format.
F. Display variables in floating point format.
(GDB) P record
$10 = {12, 76, 48, 62, 94, 17, 32, 37, 52, 69}
(GDB) P & record
$11 = (INT (*) [10]) 0x8049740
(GDB) x/4uw 0x8049740
0x8049740 <record>: 12 76 48 62
(GDB) x/6ow 0x8049740
0x8049740 <record>: 014 0114 060 076
0x8049750 <record + 16>: 0136 021
Copy From:
Http://mooncome.blog.hexun.com/13684978_d.html