From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23016 invoked by alias); 9 Mar 2004 15:11:20 -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 23009 invoked from network); 9 Mar 2004 15:11:19 -0000 Received: from unknown (HELO hall.mail.mindspring.net) (207.69.200.60) by sources.redhat.com with SMTP; 9 Mar 2004 15:11:19 -0000 Received: from user-119a90a.biz.mindspring.com ([66.149.36.10] helo=berman.michael-chastain.com) by hall.mail.mindspring.net with esmtp (Exim 3.33 #1) id 1B0ism-0003qn-00; Tue, 09 Mar 2004 10:11:00 -0500 Received: by berman.michael-chastain.com (Postfix, from userid 502) id DE3094B104; Tue, 9 Mar 2004 10:11:11 -0500 (EST) To: carlton@kealia.com, drow@mvista.com, vinschen@redhat.com Subject: Re: [RFC/RFA] gdb.cp/classes.exp: Don't try to print local variable out of scope Cc: gdb-patches@sources.redhat.com Message-ID: <20040309151111.DE3094B104@berman.michael-chastain.com> Date: Tue, 09 Mar 2004 15:11:00 -0000 From: mec.gnu@mindspring.com (Michael Elizabeth Chastain) X-SW-Source: 2004-03.o/txt/msg00192.txt Message-ID: <20040309151100.HMCY1ycsK6LgFzMkP8efC6sxOkL5AU0I7VUO59SCrkI@z> Hi Corinna, cv> Basically, the testsuite tries to print the value of a local variable cv> on a closing brace. This fails due to the debug info given in this cv> case: I have been seeing this also on native i686-pc-linux-gnu. cv> When the testsuite steps to the closing brace of the function, $pc is cv> set to the first instruction of the epilogue. This is exactly the cv> first instruction which doesn't belong to the lexical block anymore. cv> Logically, the local variable doesn't exist anymore at this point. Right. I want to raise the question: is this really a bug in the gdb test suite, or is it a bug in gcc? 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. 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? 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. Michael C