View memory with GDB
2007-12-08 12:43
View memory with GDB Format: X/nfu <addr> Description X is the abbreviation of examine n indicates the number of memory units to display F represents the display mode, the following values are preferable x Displays the variable in hexadecimal format. D Displays the variable in decimal format. u displays unsigned integers in decimal format. o Displays the variable in octal format. T displays the variable in binary format. A displays the variable in hexadecimal format. I instruction address format C Displays the variable in character format. F Displays the variable in floating-point number format. U represents the length of an address unit b represents a single byte, H represents double-byte, W represents four bytes, g = Eight bytes Format Letters is O (octal), X (hex), D (decimal), U (unsigned decimal), T (binary), F (float), a (address), I (instruction), C (char) and S (String). Size Letters is B (byte), H (Halfword), W (word), G (Giant, 8 bytes)
Example X/3uh BUF Indicates that the contents are read from the memory address buf. H represents a unit in double-byte, 3 means three units, U indicates hexadecimal display |
Detailed Examples:
(gdb) List
1 #include <stdio.h>
2 int Main ()
3 {
4
5 //char A[1];
6 //a[0]= ' a ';
7 unsigned Long Long md5=14126471717450151013;
8
9 //printf (" %d\n ", a[0]);
10 return 0;
(GDB) break ten
Breakpoint 1 at 0x8048372:file test.c, line.
(GDB) Run
Starting program:/data/compiler/g_platform/bradenwu/md5/test.out
Breakpoint 1, Main () at Test.c:10
return 0;
(GDB) X/8XB MD5
0x8837f465:cannot access memory at address 0x8837f465
(GDB) X/8xb &md5
0xbfffefa0:0x65 0xf4 0x37 0x88 0x2e 0x4f 0x0b 0xc4
x/nfu-viewing memory with GDB