Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* Still problems with gdb and nested functions.
@ 2005-02-22 19:31 tj
  2005-02-22 20:27 ` Paul Hilfinger
  2005-02-22 20:50 ` Eli Zaretskii
  0 siblings, 2 replies; 8+ messages in thread
From: tj @ 2005-02-22 19:31 UTC (permalink / raw)
  To: gdb

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



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

end of thread, other threads:[~2005-02-22 21:02 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-02-22 19:31 Still problems with gdb and nested functions tj
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

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