From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11548 invoked by alias); 10 Mar 2004 22:29:21 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 11541 invoked from network); 10 Mar 2004 22:29:20 -0000 Received: from unknown (HELO nevyn.them.org) (66.93.172.17) by sources.redhat.com with SMTP; 10 Mar 2004 22:29:20 -0000 Received: from drow by nevyn.them.org with local (Exim 4.30 #1 (Debian)) id 1B1CCU-0003Mu-GG; Wed, 10 Mar 2004 17:29:18 -0500 Date: Fri, 19 Mar 2004 00:09:00 -0000 From: Daniel Jacobowitz To: Andrew Cagney Cc: gdb-patches@sources.redhat.com, Michael Elizabeth Chastain , vinschen@redhat.com Subject: Re: [RFC/RFA] gdb.cp/classes.exp: Don't try to print local variable out of scope Message-ID: <20040310222918.GA12667@nevyn.them.org> Mail-Followup-To: Andrew Cagney , gdb-patches@sources.redhat.com, Michael Elizabeth Chastain , vinschen@redhat.com References: <20040309161507.9FBF54B104@berman.michael-chastain.com> <404E2B2C.8030201@gnu.org> <20040309212736.GA8404@nevyn.them.org> <404E45EC.4030205@gnu.org> <20040310005631.GA13440@nevyn.them.org> <404E7489.4010209@gnu.org> <20040310030528.GB16230@nevyn.them.org> <20040310032351.GA16933@nevyn.them.org> <404F4BB6.4010207@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <404F4BB6.4010207@gnu.org> User-Agent: Mutt/1.5.1i X-SW-Source: 2004-03/txt/msg00255.txt.bz2 Message-ID: <20040319000900.qlFCgg5XV7dN__KTtT9M-VtKLxSS46uLb9wwY7bJ39s@z> On Wed, Mar 10, 2004 at 12:09:10PM -0500, Andrew Cagney wrote: > >On Tue, Mar 09, 2004 at 10:05:29PM -0500, Daniel Jacobowitz wrote: > > > >>>Think about this for a moment. I'm going to give addresses so that I > >>>can be more precise. > >>> > >>>0x10 : ret stuff(int) { } > >>>0x20
: push main() { > >>>0x21 : push { > >>>0x22 : move arg1, i stuff(i) > >>>0x23 : call stuff " > >>>0x24 : pop } > >>>0x25 : pop } > >>>0x26 : ret " > >>> > >>>The inner scope is probably to inclusive. > > It is "pc in [,]" -- only after executing the > instuction at is the inner most scope destroyed. Hmm, you're right and that matches GCC behavior - for inner scopes! Takes a lot out of my argument. > Now consider this example: > > >>> 10 0x10 : ret stuff(int) { } > >>> 11 0x20
: push main() { > >>> 12 0x21 : push { > >>> 13 0x22 : move arg1, i stuff(i) > >>> 14 0x23 : call stuff " > >>> 15 } > >>> 16 0x25 : pop 2; ret } > > Note how that closing brace @15 doesn't have code associated with it. > Its possible to breakpoint @14 or @16 only. Consequently: > > - the return address will be @16 and is _out_ of scope > hence "@16 - 1" is needed to find the correct block when doing a backtrace > > - once returned from stuff(), the pc is clearly @16 which, to the user, > will visibly reflect the departure from the inner scope It would be nice to be able to query i at this point, since it hasn't been clobbered. I think the consensus is that we can't. > >BTW, my proposed replacement is woefully inaccurate, which I should > >have realized before posting. I do not have a good solution to this > >problem without actually turning back time :) > > I'm wondering what the 3.4 wierdness MichaelC's refering to is. I dunno. But the problem here appears to be that there is a lexical block which ends before the epilogue, containing the local variables. Unlike the inner scope blocks, this one ends before they are destroyed. Maybe that's a bug after all. -- Daniel Jacobowitz MontaVista Software Debian GNU/Linux Developer