watch
gdb で使用中に問題に直面しています。コード内の変数を監視しようとしてm
います。しかし、何らかの理由で次のメッセージが表示されます
no symbol m in current context
。m のスコープがわかるように、7 行目にブレークポイントを設定しました。
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;
}
また、「ウォッチ」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.