From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25223 invoked by alias); 14 Nov 2010 13:22:43 -0000 Received: (qmail 25212 invoked by uid 22791); 14 Nov 2010 13:22:42 -0000 X-SWARE-Spam-Status: No, hits=-0.7 required=5.0 tests=BAYES_00,RCVD_NUMERIC_HELO,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from lo.gmane.org (HELO lo.gmane.org) (80.91.229.12) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 14 Nov 2010 13:22:38 +0000 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1PHcXT-0001uD-O8 for gdb@sources.redhat.com; Sun, 14 Nov 2010 14:22:35 +0100 Received: from 41.91.183.84 ([41.91.183.84]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 14 Nov 2010 14:22:35 +0100 Received: from vladimir by 41.91.183.84 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 14 Nov 2010 14:22:35 +0100 To: gdb@sources.redhat.com From: Vladimir Prus Subject: Re: Is it possible to access shadowed variables? Followup-To: gmane.comp.gdb.devel Date: Sun, 14 Nov 2010 13:22:00 -0000 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7Bit User-Agent: KNode/4.4.6 X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2010-11/txt/msg00061.txt.bz2 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