From: tj <999alfred@comcast.net>
To: gdb@sources.redhat.com
Subject: Still problems with gdb and nested functions.
Date: Tue, 22 Feb 2005 19:31:00 -0000 [thread overview]
Message-ID: <421B8556.6070905@comcast.net> (raw)
I posted before about gdb not printing local variables when within
nested functions and I thought the problem had been solved when it was
mentioned my demo worked when using gdb 6.1, which I upgraded to.
BUt, now I have discovered even it has a problem.
Sample file:
#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;
}
Now, run gdb and do the following:
(gdb) b test.c:12
Breakpoint 1 at 0x8048352: file test.c, line 12.
(gdb) b test.c:19
Breakpoint 2 at 0x804838d: file test.c, line 19.
(gdb) run
Starting program: /home/wd4nmq/src/test/test/a.out
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.
(gdb) continue
Continuing.
inside, k = 1, l = 1
Breakpoint 2, main (argc=1, argv=0xbffff964) at test.c:19
19 j = 1;
(gdb) p i
$1 = 0
(gdb)
While it now prints the value of i, which it wasn't pre v6.1, but it
still doesn't print the k value when stopped within the inside()
function, where it is in scope.
Oh well, at least is some progress :-).
gcc 3.23
gdb 6.1
tj
next reply other threads:[~2005-02-22 19:17 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-02-22 19:31 tj [this message]
2005-02-22 20:27 ` Paul Hilfinger
2005-02-22 20:45 ` Cal Erickson
2005-02-22 20:53 ` Eli Zaretskii
2005-02-22 21:02 ` Cal Erickson
2005-02-22 21:43 ` Cal Erickson
2005-02-22 20:56 ` Eli Zaretskii
2005-02-22 20:50 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=421B8556.6070905@comcast.net \
--to=999alfred@comcast.net \
--cc=gdb@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox