From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24553 invoked by alias); 15 Nov 2010 10:19:54 -0000 Received: (qmail 24541 invoked by uid 22791); 15 Nov 2010 10:19:53 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp.nokia.com (HELO mgw-da02.nokia.com) (147.243.128.26) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 15 Nov 2010 10:19:48 +0000 Received: from gar.localnet (berwst16747.europe.nokia.com [172.25.167.47]) by mgw-da02.nokia.com (Switch-3.4.3/Switch-3.4.3) with ESMTP id oAFAJkXX028629 for ; Mon, 15 Nov 2010 12:19:46 +0200 From: =?iso-8859-1?q?Andr=E9_P=F6nitz?= To: gdb@sourceware.org Subject: Re: Is it possible to access shadowed variables? Date: Mon, 15 Nov 2010 10:19:00 -0000 User-Agent: KMail/1.13.2 (Linux/2.6.32-21-generic; KDE/4.4.2; i686; ; ) References: In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201011151117.42597.andre.poenitz@nokia.com> X-Nokia-AV: Clean 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/msg00063.txt.bz2 On Friday 12 November 2010 20:35:58 ext 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 > } You can get the blocks of a frame using gdb.Frame.block(), iterate the nested blocks using block.superblock and use gdb.Frame.read_var(name, block) to access the shadowed variables. > 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"}] I don't think the functionality exists for MI varobjs. Andre'