当我尝试遵循程序进行调试时,我的GDB无法显示变量的变化。
我尝试安装不同版本的GDB,但仍然遇到相同的问题。
GNU gdb (GDB) 7.6.1
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "mingw32".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from C:\Users\china\Documents\LU\SCC.150\practicals\week20\mystrtest.exe...done.
(gdb) break main
Breakpoint 1 at 0x401602: file mystrtest.c, line 26.
(gdb) run
Starting program: C:\Users\china\Documents\LU\SCC.150\practicals\week20/mystrtest.exe
[New Thread 21152.0x4fa8]
[New Thread 21152.0x5670]
Breakpoint 1, main () at mystrtest.c:26
26 char test_string_1[] = "hello world!";
(gdb) watch test_string_1
Hardware watchpoint 2: test_string_1
(gdb) cont
Continuing.
Hardware watchpoint 2: test_string_1
Old value = <error reading variable>
New value = <error reading variable>
0x00401612 in main () at mystrtest.c:26
26 char test_string_1[] = "hello world!";
(gdb)
我想查看变量的旧状态和新状态,而不是出错。