This is the mail archive of the
insight@sources.redhat.com
mailing list for the Insight project.
Re: Question concerning "Local Variables" window and missing variables
- To: Fernando Nasser <fnasser at cygnus dot com>
- Subject: Re: Question concerning "Local Variables" window and missing variables
- From: "Donna S. Womble" <dsw at mbay dot net>
- Date: Wed, 30 May 2001 14:29:08 -0700
- CC: insight at sources dot redhat dot com
- References: <3B141708.A6137EEE@mbay.net> <3B141BA3.4F6B3051@cygnus.com>
Thanks you, Fernando.
The problem is (as you correctly diagnosed) associated with GDB
directly, and not Insight. It is NOT an optimization issue. I turned
all optimizing off and the problem remains as initially described...
the local variables are missing.
I will proceed on to ask the GDB gurus and see what they come up with.
Cheers, Donna.
Fernando Nasser wrote:
>
> Donna,
>
> The GUI (Insight) just asks GDB which are the local variables (and GDB, on its turn, gets this information from the compiler).
>
> Try invoking gdb without the GUI:
> gdb -nw <your prog>
>
> It will give you a (gdb) prompt. Set a breakpoint on line 11 (if the cout is on line 11) with the command:
> (gdb) break 11
>
> And then try:
> (gdb) info locals
>
> It will, most certainly, not show anything in the first example and show the locals in the second.
>
> You can them post the same message, removing all references to Windows of any sort and adding the command line commands and output printed, to:
>
> gdb@sources.redhat.com
>
> The people that work with the GDB core may be able to help you. Or at least this will become a bug report for GDB's handling of C++.
>
> Regards,
> Fernando
>
> Donna S Womble wrote:
> >
> > Hello,
> >
> > Please forgive my naivete... I have generated a very simple C++ program
> > to outline my question/problem. When I run the following with Insight,
> > and I pull up the "Local Variables" window, it shows that I have
> > absolutely no local variables no matter where I set a breakpoint.
> >
> > #include <iostream>
> > int main()
> > {
> > for (int i(0); i < 10; i++)
> > {
> > double foo(100.);
> > for (int j(10); j < 20; j++)
> > {
> > double goo(i*1000.);
> > double hoo(j*500.);
> > cout << i << "\t" << j << "\t" << goo << "\t" << hoo << endl;
> > }
> > }
> > return 0;
> > }
> >
> > Shouldn't one be able to *see* the variable "i" as a local from within
> > the scope of the i-loop (e.g. at line 6 = double foo(100.); )???
> > Likewise for "j", "goo", and "hoo" inside the j-loop.
> >
> > Strangely enough, if I define foo, goo, and hoo as doubles before the
> > "i" loop, then I can *see* ALL the variables (including i and j) as in
> > the same code (modified) below:
> >
> > #include <iostream>
> > int main()
> > {
> > double foo, goo, hoo;
> > for (int i(0); i < 10; i++)
> > {
> > foo = 100.;
> > int j;
> > for ( j = 10 ; j < 20; j++)
> > {
> > goo = i*1000.;
> > hoo = j*500.;
> > cout << i << "\t" << j << "\t" << goo << "\t" << hoo << endl;
> > }
> > }
> > return 0;
> > }
> >
> > Am I missing something really simple here??? Please help.
> > Thanks, Donna Womble.
> >
> > P.S. I am using Insight version 5.0 with gcc version 2.96 (20000731) on
> > RedHat Linux 7.0
>
> --
> Fernando Nasser
> Red Hat - Toronto E-Mail: fnasser@redhat.com
> 2323 Yonge Street, Suite #300
> Toronto, Ontario M4P 2C9