This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Is it possible to access shadowed variables?
- From: Marc Khouzam <marc dot khouzam at ericsson dot com>
- To: "'gdb at sourceware dot org'" <gdb at sourceware dot org>
- Date: Fri, 12 Nov 2010 14:35:58 -0500
- Subject: Is it possible to access shadowed variables?
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.
Marc