This is the mail archive of the gdb@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]

Re: Cann't print local vars when nesting functions


> 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.


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