$ gcc -g -o membreak testMemBreak.c
$ gdb ./membreak.exe
GNU gdb 6.3.50_2004-12-28-cvs (cygwin-special)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.Type "show warranty" for details.
This GDB was configured as "i686-pc-cygwin"...
(gdb) l
1#include
2#include
3
4int main()
5{
6int i,j;
7char buf[256]={0};
8char* pp = buf;
9
10printf("buf addr= 0x%x\r\n",buf);
(gdb)
11for(i=0;i<16;i++)
12{
13printf("addr = 0x%x ~ 0x%x\r\n",pp+i*16,pp+i*16+15);
14for(j=0;j<16;j++)
15*(pp+i*16+j)=i*16+j;
16}
17
18printf("ASCII table:\n");
19for(i=0;i<16;i++)
20{
(gdb)
21for(j=0;j<16;j++)
22printf("%c", *(pp+i*16+j));
23printf("\n");
24}
25
26return 0;
27}
(gdb) b 10
Breakpoint 1 at 0x4010ae: file testMemBreak.c, line 10.
(gdb) r
Starting program: /cygdrive/e/study/programming/linux/2009-12-28 testMemBreak/membreak.exe
Breakpoint 1, main () at testMemBreak.c:10
10printf("buf addr= 0x%x\r\n",buf);
(gdb) step
buf addr= 0x22cb70
11for(i=0;i<16;i++)
(gdb) p buf
$1 = '\0'
(gdb) p &buf
$2 = (char (*)[256]) 0x22cb70
(gdb) display &buf
1: &buf = (char (*)[256]) 0x22cb70
(gdb) p/x *0x22cb70@64
$3 = {0x0 }
(gdb) x/64w 0x22cb70
0x22cb70:0x000000000x000000000x000000000x00000000
0x22cb80:0x000000000x000000000x000000000x00000000
0x22cb90:0x000000000x000000000x000000000x00000000
0x22cba0:0x000000000x000000000x000000000x00000000
0x22cbb0:0x000000000x000000000x000000000x00000000
0x22cbc0:0x000000000x000000000x000000000x00000000
0x22cbd0:0x000000000x000000000x000000000x00000000
0x22cbe0:0x000000000x000000000x000000000x00000000
0x22cbf0:0x000000000x000000000x000000000x00000000
0x22cc00:0x000000000x000000000x000000000x00000000
0x22cc10:0x000000000x000000000x000000000x00000000
0x22cc20:0x000000000x000000000x000000000x00000000
0x22cc30:0x000000000x000000000x000000000x00000000
0x22cc40:0x000000000x000000000x000000000x00000000
0x22cc50:0x000000000x000000000x000000000x00000000
0x22cc60:0x000000000x000000000x000000000x00000000