This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
Cann't print local vars when nesting functions
- From: Jeff <wd4nmq at comcast dot net>
- To: gdb at sources dot redhat dot com
- Date: Fri, 18 Feb 2005 17:54:17 -0500
- Subject: Cann't print local vars when nesting functions
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