From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4441 invoked by alias); 9 Mar 2004 15:40:30 -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 4433 invoked from network); 9 Mar 2004 15:40:30 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sources.redhat.com with SMTP; 9 Mar 2004 15:40:30 -0000 Received: from int-mx2.corp.redhat.com (nat-pool-rdu-dmz.redhat.com [172.16.52.200] (may be forged)) by mx1.redhat.com (8.12.10/8.12.10) with ESMTP id i29FeSST004809 for ; Tue, 9 Mar 2004 10:40:29 -0500 Received: from potter.sfbay.redhat.com (potter.sfbay.redhat.com [172.16.27.15]) by int-mx2.corp.redhat.com (8.11.6/8.11.6) with ESMTP id i29FeSM29698 for ; Tue, 9 Mar 2004 10:40:28 -0500 Received: from cygbert.vinschen.de (vpn50-24.rdu.redhat.com [172.16.50.24]) by potter.sfbay.redhat.com (8.11.6/8.11.6) with ESMTP id i29FeQR02909 for ; Tue, 9 Mar 2004 07:40:26 -0800 Received: by cygbert.vinschen.de (Postfix, from userid 500) id C5671580E2; Tue, 9 Mar 2004 16:40:19 +0100 (CET) Date: Fri, 19 Mar 2004 00:09:00 -0000 From: Corinna Vinschen To: gdb-patches@sources.redhat.com Subject: Re: [RFC/RFA] gdb.cp/classes.exp: Don't try to print local variable out of scope Message-ID: <20040309154019.GA24481@cygbert.vinschen.de> Reply-To: gdb-patches@sources.redhat.com Mail-Followup-To: gdb-patches@sources.redhat.com References: <20040309151111.DE3094B104@berman.michael-chastain.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20040309151111.DE3094B104@berman.michael-chastain.com> User-Agent: Mutt/1.4.2i X-RedHat-Spam-Score: -4.9 X-SW-Source: 2004-03/txt/msg00196.txt.bz2 Message-ID: <20040319000900.S6AwpwEtJZeSTf9mNmJQgz7dBYHJ3eLNldvfCffrU4I@z> Hi Michael, On Mar 9 10:11, Michael Elizabeth Chastain wrote: > That is: is a local variable required to exist at the closing brace of a > function? > > I think your answer is "no, it's not required to exist, therefore the > gdb test suite should change". My answer is "reluctantly, no, > it's not required to exist"; I don't think the famous gcc -O0 > debug info clause covers this case. I'm curious what drow and > carlton and other people have to say. basically this problem is similar to the "having the same variable defined twice in a function" problem: 1 void foo () 2 { 3 int i = 1; 4 { 5 int i = 2; 6 bar(i); 7 } 8 bar (i); 9 } Is line 7 still in the scope of the inner definition of variable `i'? Which `i' should be printed at that point? > void foo () > { > int i; > i = 1; > bar (i); > } > > (gdb) break bar > (gdb) run > (gdb) finish > (gdb) print i > > Is it okay for gcc to emit debug info that "i" is out of scope here? IMHO yes. Keep in mind that it's a *local* variable. It's practically dead at this point. $pc sits already in the epilogue which destroys the variable anyway. Just one `stepi' would perhaps *really* destroy the variable and GDB might print some entirely confused value. > cv> I'd suggest to change the testsuite case to add another line to the > cv> function enums1(), so that it's sure to be still in the scope of the > cv> local variable obj_with_enum. > > misc.cc is used by three *.exp files so I do not want to touch it > at all, so I am dis-approving your patch. I will write a patch to > remove the "gdb_test next" in test_enums instead. I tested the whole gdb.cp testsuite on linux-x-sh with and without the patch and the only difference in the testsuite output where the tests directly affected by this change: 7c7,10 < (gdb) KFAIL: gdb.cp/classes.exp: ptype obj_with_enum (PRMS: gdb/57) --- > (gdb) FAIL: gdb.cp/classes.exp: print obj_with_enum (2) > (gdb) FAIL: gdb.cp/classes.exp: print obj_with_enum.priv_enum > (gdb) FAIL: gdb.cp/classes.exp: ptype obj_with_enum.priv_enum > (gdb) FAIL: gdb.cp/classes.exp: ptype obj_with_enum Corinna -- Corinna Vinschen Cygwin Developer Red Hat, Inc.