This is the mail archive of the gdb-prs@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

pending/906: Re: pr gdb/810: can't see local variables inside brackets


>Number:         906
>Category:       pending
>Synopsis:       Re: pr gdb/810: can't see local variables inside brackets
>Confidential:   yes
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   unknown
>Arrival-Date:   Tue Dec 31 23:48:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     
>Release:        
>Organization:
>Environment:
>Description:
 Printing local variables and 'info locals' work for me.  I am appending
 a small typescript showing everything that I did in one configuration.
 I believe this is not a bug in gdb.
 
 Did you remember to specify '-g' when compiling and also when linking?
 You need '-g' in order to get symbols for local variables.
 
 Also, the program may need to be stopped at a statement inside the inner
 block in order to see the locals for that block.
 
 I tested eight configurations:
 
   target    => native
   host      => i686-pc-linux-gnu
   osversion => red-hat-8.0
   gdb       => 5.2.1, 5.3
   gcc       => 2.95.3, 3.2.1
   binutils  => 2.13.2
   libc      => vendor
   gformat   => dwarf-2, stabs+
 
 If you want to pursue this, please use the 'script' command to make
 a typescript file like the one below.  The script file needs to have
 the whole program text, all the gcc commands to build the executable,
 and the whole gdb session.  Just reply to this message and throw in
 the script file.
 
 Or let me know if 'info locals' is working for you now so that I can
 close the PR.
 
 Regards,
 
 Michael C
 
 ===
 
   Script started on Wed Jan  1 02:28:29 2003
 
   bash-2.05b$ cat local.c
   int Bar ()
   {
     static int counter = 0;
     return ++counter;
   }
 
   void Foo ()
   {
     int a = Bar ();
     {
       int b = Bar();
       b++;
     }
   }
 
   int main ()
   {
     Foo ();
     return 0;
   }
 
   bash-2.05b$ /berman/migchain/install/target/native/gcc-3.2.1-binutils-2.13.2/bin/gcc -g local.c
 
   bash-2.05b$ /berman/migchain/install/target/native/gdb-5.2.1/bin/gdb a.out
   GNU gdb 5.2.1
   Copyright 2002 Free Software Foundation, Inc.
   GDB is free software, covered by the GNU General Public License, and you are
   welcome to change it and/or distribute copies of it under certain conditions.
   Type "show copying" to see the conditions.
   There is absolutely no warranty for GDB.  Type "show warranty" for details.
   This GDB was configured as "i686-pc-linux-gnu"...
   (gdb) break Foo
   Breakpoint 1 at 0x804831e: file local.c, line 9.
   (gdb) run
   Starting program: /berman/home/mec/gdb-pr-810/a.out 
 
   Breakpoint 1, Foo () at local.c:9
   9	  int a = Bar ();
   (gdb) next
   11	    int b = Bar();
   (gdb) 
   12	    b++;
   (gdb) info locals
   b = 2
   a = 1
   (gdb) next
   14	}
   (gdb) info locals
   b = 3
   a = 1
   (gdb) next
   main () at local.c:19
   19	  return 0;
   (gdb) info locals
   No locals.
   (gdb) quit
   The program is running.  Exit anyway? (y or n) y
   bash-2.05b$ exit
   exit
 
   Script done on Wed Jan  1 02:29:55 2003
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]