Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Jeff <wd4nmq@comcast.net>
To: gdb@sources.redhat.com
Subject: Cann't print local vars when nesting functions
Date: Sat, 19 Feb 2005 01:00:00 -0000	[thread overview]
Message-ID: <42167219.8070507@comcast.net> (raw)

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



             reply	other threads:[~2005-02-18 22:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-19  1:00 Jeff [this message]
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

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=42167219.8070507@comcast.net \
    --to=wd4nmq@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