Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* Cann't print local vars when nesting functions
@ 2005-02-19  1:00 Jeff
  2005-02-19 16:25 ` Eli Zaretskii
  0 siblings, 1 reply; 5+ messages in thread
From: Jeff @ 2005-02-19  1:00 UTC (permalink / raw)
  To: gdb

I am having problems printing local stack variables when nesting 
functions. Here is a test app:
int main(int argc, char *argv[]){
  int i,j;
    i = 0;
    j = 1;
}

Now, run it to break on line:
    j = 1;
and then:
(gdb) p i
$2 = 0

and all is ok. but change to this:
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?

tj



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2005-02-19 23:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-02-19  1:00 Cann't print local vars when nesting functions Jeff
2005-02-19 16:25 ` Eli Zaretskii
2005-02-19 19:03   ` tj
2005-02-19 22:27     ` Eli Zaretskii
2005-02-20  8:35       ` tj

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox