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: Still problems with gdb and nested functions.


> #include <stdio.h>
> 
> int main(int argc, char *argv[]){
> 
>   int i,j;
> 
>   int inside(void){
>     int k,l;
> 
>     k = 1;
>     l = k;
>     printf("inside, k = %d, l = %d\n", k,l);
>     return 0;
> 
>   }
> 
>   inside();
>   i = 0;
>   j = 1;
> }
> 
....
> Breakpoint 1, inside.0 () at test.c:12
> 12          printf("inside, k = %d, l = %d\n", k,l);
> (gdb) p k
> No symbol "k" in current context.

I presume you have confirmed that k is actually there (since it is set
only from a constant, it could be folded away even without fancy
optimization).

Paul Hilfinger


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