From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24727 invoked by alias); 15 Mar 2004 18:47:01 -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 24689 invoked from network); 15 Mar 2004 18:47:00 -0000 Received: from unknown (HELO localhost.redhat.com) (66.30.197.194) by sources.redhat.com with SMTP; 15 Mar 2004 18:47:00 -0000 Received: from gnu.org (localhost [127.0.0.1]) by localhost.redhat.com (Postfix) with ESMTP id C71932B92; Mon, 15 Mar 2004 13:46:59 -0500 (EST) Message-ID: <4055FA23.5020100@gnu.org> Date: Mon, 15 Mar 2004 18:47:00 -0000 From: Andrew Cagney User-Agent: Mozilla/5.0 (X11; U; NetBSD macppc; en-GB; rv:1.4.1) Gecko/20040217 MIME-Version: 1.0 To: Daniel Jacobowitz 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 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> <20040310222918.GA12667@nevyn.them.org> In-Reply-To: <20040310222918.GA12667@nevyn.them.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2004-03.o/txt/msg00320.txt >>>> >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. GDB can't tell the difference - for a variable that has gone out of scope, gdb can't tell if it has or hasn't been destroyed -- it has to trust GCC. However [to play sick mind games] there's nothing in the rule book saying that GDB/GCC need to follow the language rules. It should be possible for GCC to manipulate things such that a variable remains visible until its location has been reused. > 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 } Andrew From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24727 invoked by alias); 15 Mar 2004 18:47:01 -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 24689 invoked from network); 15 Mar 2004 18:47:00 -0000 Received: from unknown (HELO localhost.redhat.com) (66.30.197.194) by sources.redhat.com with SMTP; 15 Mar 2004 18:47:00 -0000 Received: from gnu.org (localhost [127.0.0.1]) by localhost.redhat.com (Postfix) with ESMTP id C71932B92; Mon, 15 Mar 2004 13:46:59 -0500 (EST) Message-ID: <4055FA23.5020100@gnu.org> Date: Fri, 19 Mar 2004 00:09:00 -0000 From: Andrew Cagney User-Agent: Mozilla/5.0 (X11; U; NetBSD macppc; en-GB; rv:1.4.1) Gecko/20040217 MIME-Version: 1.0 To: Daniel Jacobowitz 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 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> <20040310222918.GA12667@nevyn.them.org> In-Reply-To: <20040310222918.GA12667@nevyn.them.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2004-03/txt/msg00320.txt.bz2 Message-ID: <20040319000900.6pbg5q-U-93tLiYeWQVLV5_iZO4yDgiGmxDKIMGHxvI@z> >>>> >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. GDB can't tell the difference - for a variable that has gone out of scope, gdb can't tell if it has or hasn't been destroyed -- it has to trust GCC. However [to play sick mind games] there's nothing in the rule book saying that GDB/GCC need to follow the language rules. It should be possible for GCC to manipulate things such that a variable remains visible until its location has been reused. > 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 } Andrew