Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Vladimir Prus <vladimir@codesourcery.com>
To: gdb@sources.redhat.com
Subject: Re: Is it possible to access shadowed variables?
Date: Sun, 14 Nov 2010 13:22:00 -0000	[thread overview]
Message-ID: <ibonqe$gge$1@dough.gmane.org> (raw)
In-Reply-To: <F7CE05678329534C957159168FA70DEC572E5B34B0@EUSAACMS0703.eamcs.ericsson.se>

Marc Khouzam wrote:

> Hi,
> 
> I'm trying to figure out a way to deal with shadowed
> variables in Eclipse.  But I can't find a way to
> access them from GDB.
> 
> If I'm at line 3 of:
> 
> int a = 1; //line 1
> {
>   bool a = true; // line 3
> }
> 
> The only thing I found is to use
> -stack-list-locals 2
> which will show me both variables with their types
> and both their values.
> 
> -stack-list-locals 2
> ^done,locals=[{name="a",type="bool",value="true"},
>               {name="a",type="int",value="1"}]
> 
> Anything else I can do to tell GDB I want access to
> some shadowed variable?
> 
> Note that floating variable objects don't help
> (I think) because I'm already at line 3 by the
> time I create the varObject, so it will point
> to the inner-most variable.
> 
> Thanks for any suggestions.

There are no suggestions, I'm afraid. This requires the
ability to create varobj, or evaluate the expression, in
specific "block", or at specific line. I don't know any
way to do this in FSF GDB. Apple version had a way to
specify either address or line -- don't remember exactly.

- Volodya



  reply	other threads:[~2010-11-14 13:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-12 19:36 Marc Khouzam
2010-11-14 13:22 ` Vladimir Prus [this message]
2010-11-15 10:19 ` André Pönitz

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='ibonqe$gge$1@dough.gmane.org' \
    --to=vladimir@codesourcery.com \
    --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