Debugging gdb,突破vs突破和观察点
有人能告诉我关于观察点的突破和突破有什么区别吗 A有一个简单的测试代码:Debugging gdb,突破vs突破和观察点,debugging,gdb,watchpoint,Debugging,Gdb,Watchpoint,有人能告诉我关于观察点的突破和突破有什么区别吗 A有一个简单的测试代码: #include <stdlib.h> #include <stdio.h> int main(int argc, char **argv) { int toto; toto = 1; toto = 2; toto = 3; return (EXIT_SUCCESS); } 但当我使用tbreak时,手表似乎起作用: (gdb) tbreak main Temporary
#include <stdlib.h>
#include <stdio.h>
int main(int argc, char **argv) {
int toto;
toto = 1;
toto = 2;
toto = 3;
return (EXIT_SUCCESS);
}
但当我使用tbreak时,手表似乎起作用:
(gdb) tbreak main
Temporary breakpoint 1 at 0x804839a: file pp.c, line 6.
(gdb) r
Starting program: /mnt/mega20/SRC/C/gdb/pp
Temporary breakpoint 1, main (argc=1, argv=0xbffff4f4) at pp.c:6
6 toto = 1;
(gdb) watch toto
Hardware watchpoint 2: toto
(gdb) c
Continuing.
Hardware watchpoint 2: toto
Old value = 0
New value = 1
main (argc=1, argv=0xbffff4f4) at pp.c:7
7 toto = 2;
(gdb) c
Continuing.
Hardware watchpoint 2: toto
Old value = 1
New value = 2
main (argc=1, argv=0xbffff4f4) at pp.c:8
8 toto = 3;
(gdb)
与start命令的结果相同,它可以工作 我建议您阅读以下内容:
我建议您阅读以下内容:
和。。。你用什么来编译开关?什么gdb版本?你查过gdb命令的含义了吗。。。“gcc-g3-O0”和Debian上的GDB7.2,是的。如果在main上添加断点,运行、删除断点,在toto上添加观察点并继续,一点问题都没有。只有在main.And上定义了断点时,toto=1上的观察点才会丢失。。。你用什么来编译开关?什么gdb版本?你查过gdb命令的含义了吗。。。“gcc-g3-O0”和Debian上的GDB7.2,是的。如果在main上添加断点,运行、删除断点,在toto上添加观察点并继续,一点问题都没有。只有在main上定义了断点时,toto=1上的观察点才会丢失。
(gdb) tbreak main
Temporary breakpoint 1 at 0x804839a: file pp.c, line 6.
(gdb) r
Starting program: /mnt/mega20/SRC/C/gdb/pp
Temporary breakpoint 1, main (argc=1, argv=0xbffff4f4) at pp.c:6
6 toto = 1;
(gdb) watch toto
Hardware watchpoint 2: toto
(gdb) c
Continuing.
Hardware watchpoint 2: toto
Old value = 0
New value = 1
main (argc=1, argv=0xbffff4f4) at pp.c:7
7 toto = 2;
(gdb) c
Continuing.
Hardware watchpoint 2: toto
Old value = 1
New value = 2
main (argc=1, argv=0xbffff4f4) at pp.c:8
8 toto = 3;
(gdb)