- 论坛徽章:
- 0
|
(gdb) l 1
1 #include<stdio.h>
2 #include<string.h>
3 int main()
4 {
5 int i;
6 char str[20]="This is a test";
7 for(i=0;i<5;i++)
8 {
9 strcat(str,"!\0");
10 printf("%s",str);
(gdb)
11 }
12 return 0;
13 }
14
15
(gdb) info breakpoints
Num Type Disp Enb Address What
1 breakpoint keep y 0x080483ce in main at test.c:7
breakpoint already hit 1 time
2 breakpoint keep y 0x080483ff in main at test.c:10
breakpoint already hit 5 times
3 breakpoint keep y 0x0804841c in main at test.c:12
breakpoint already hit 1 time
(gdb) r
Starting program: /root/driver_study/test
Breakpoint 1, main () at test.c:7
7 for(i=0;i<5;i++)
(gdb) watch str
Watchpoint 5: str
(gdb) c
Continuing.
Breakpoint 2, main () at test.c:10
10 printf("%s",str);
(gdb) c
Continuing.
Watchpoint 5 deleted because the program has left the block in
which its expression is valid.
0x0048fce3 in _dl_fixup () from /lib/ld-linux.so.2
(gdb)
Continuing.
Breakpoint 2, main () at test.c:10
10 printf("%s",str);
(gdb)
Continuing.
Breakpoint 2, main () at test.c:10
10 printf("%s",str);
(gdb)
Continuing.
Breakpoint 2, main () at test.c:10
10 printf("%s",str);
(gdb)
Continuing.
Breakpoint 2, main () at test.c:10
10 printf("%s",str);
(gdb)
Continuing.
Breakpoint 3, main () at test.c:12
12 return 0;
(gdb)
Continuing.
This is a test!This is a test!!This is a test!!!This is a test!!!!This is a test!!!!!
Program exited normally.
(gdb)
//////////////////////////////////////////
这地方的watch怎么用,我要看str的值。。 |
|