How can I use “watch” GDB?
问题 I tried to watch the change of the "int a" by the command "watch a". However, the program does not stop, when it changes to 12. Why? /* FILE: test.c */ #include <stdio.h> #include <stdlib.h> int main(int argc, char** argv){ printf("Hello world\n"); int a = 12; a = 10; return 0; } 回答1: It may help to specify your platform, version of GDB, and exact sequence of GDB commands you used. Here is what I see (GDB appears to work just fine): $ gcc -g test.c $ gdb a.out GNU gdb (GDB) 6.8.50.20090430