我watch
在 gdb 中使用时遇到问题。我正在尝试监视m
我的代码中的变量。但由于某种原因,我收到以下消息
no symbol m in current context
。我在第 7 行保留了一个断点,以便知道 m 的范围。
steps performed by me :-
1>g++ -g a.cpp
2>gdb a.out
3>(gdb)break 7
4>(gdb)watch m
以下是我的程序:-
# include<iostream>
# include<stdio.h>
using namespace std;
int main()
{
int m=10;
char *abc = (char *)"ritesh";
cout << abc << endl ;
m=11;
m=13;
abc=NULL;
cout << *abc <<endl;
return 0;
}
我也看到了如何使用“watch” GDB?但这对我没有多大帮助。有人可以解释我面临的这个问题吗?以下是与我的 GNU 相关的信息
ritesh@ubuntu:~$ gdb a.out
GNU gdb (Ubuntu/Linaro 7.3-0ubuntu2) 7.3-2011.08
Copyright (C) 2011 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 "i686-linux-gnu".
For bug reporting instructions, please see:
<http://bugs.launchpad.net/gdb-linaro/>...
Reading symbols from /home/ritesh/a.out...done.