This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
Re: Cann't print local vars when nesting functions
- From: "Eli Zaretskii" <eliz at gnu dot org>
- To: Jeff <wd4nmq at comcast dot net>
- Cc: gdb at sources dot redhat dot com
- Date: Sat, 19 Feb 2005 13:17:28 +0200
- Subject: Re: Cann't print local vars when nesting functions
- References: <42167219.8070507@comcast.net>
- Reply-to: Eli Zaretskii <eliz at gnu dot org>
> Date: Fri, 18 Feb 2005 17:54:17 -0500
> From: Jeff <wd4nmq@comcast.net>
>
> int main(int argc, char *argv[]){
> int i,j;
>
> int inside(void){
> int k,l;
> k = 3;
> l = 4;
> }
>
> i = 0;
> j = 1;
> }
>
> Now set the break point to the same line, j =1, and this happens:
> Breakpoint 1, main () at test.c:25
> 25 j = 1;
> (gdb) p i
> No symbol "i" in current context.
> (gdb)
>
> What gives? Is there something you need to special when nesting functions?
Please tell the details: what platform is this, what versions of GCC
and GDB you use, and how (with what command-line options) you compiled
and linked the program. Also, since the line "j = 1;" is not line 25
in the source you posted, could it be that the program you actually
compiled was different?
FWIW, I tried this with GCC 3.3.3, naive compiler command line, and
GDB 6.3, and couldn't reproduce the problem with the source you
posted.