From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14512 invoked by alias); 28 Dec 2011 01:38:44 -0000 Received: (qmail 14503 invoked by uid 22791); 28 Dec 2011 01:38:43 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 28 Dec 2011 01:38:30 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id A0D002BB241; Tue, 27 Dec 2011 20:38:29 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id Xio7tTN4r1IB; Tue, 27 Dec 2011 20:38:29 -0500 (EST) Received: from kwai.gnat.com (kwai.gnat.com [205.232.38.4]) by rock.gnat.com (Postfix) with ESMTP id 8EDBB2BB235; Tue, 27 Dec 2011 20:38:29 -0500 (EST) Received: by kwai.gnat.com (Postfix, from userid 1345) id 7A58D92BF6; Tue, 27 Dec 2011 20:38:29 -0500 (EST) From: Paul Hilfinger To: Doug Evans CC: gdb-patches@sourceware.org In-reply-to: (message from Doug Evans on Tue, 27 Dec 2011 16:58:14 -0800) Subject: Re: [RFA] Add testcase for locals identified with FUNCTION::VAR syntax. Reply-to: Hilfinger@adacore.com References: <20111227195924.187BF92BF6@kwai.gnat.com> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Message-Id: <20111228013829.7A58D92BF6@kwai.gnat.com> Date: Wed, 28 Dec 2011 03:43:00 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-12/txt/msg00859.txt.bz2 > Date: Tue, 27 Dec 2011 16:58:14 -0800 > From: Doug Evans > Cc: gdb-patches@sourceware.org > Content-Type: text/plain; charset=ISO-8859-1 > > On Tue, Dec 27, 2011 at 11:59 AM, Paul Hilfinger wrote: > > > > This test (from Joel Brobecker) stops inside a recursive function > > after a few levels of recursion, goes up some frames, and then > > accesses a local variable with 'print foo::val' rather than the usual > > 'print val' to see if the former pays attention to the selected frame. > > ... > > + > > +# Some convenient regular expressions... > > +set num "\[0-9\]+" > > Delete, use $decimal. OK. > > +set addr "0x\[0-9a-zA-Z\]+" > > This could be replaced with $hex, or do "set addr $hex". Either is > fine with me. OK. > > > + > > +gdb_test "break $srcfile:[gdb_get_line_number BREAK $srcfile] if n == 3" \ > > +         "Breakpoint $num at $addr: file .*recpar\\.c, line $num\\." > > + > > +gdb_test "continue" \ > > +         "Breakpoint .* foo \\(n=3\\) at .*$srcfile:$num.*" > > + > > +gdb_test "backtrace" \ > > +         "#0 +foo \\(n=3\\).*\r\n#1.* foo \\(n=4\\).*\r\n#2.* foo \\(n=5\\).*#3.* main \\(\\).*" > > + > > +gdb_test "frame 2" \ > > +         "#2 .* foo \\(n=5\\) .*" > > + > > +# In the currently selected frame, n=5, and thus foo::val should be 5 > > +# as well. > > +gdb_test "print foo::val" \ > > +         " = 5" > > -- > I notice scope.exp has similar tests. > Would it make sense to move this there? > I defer to whatever consensus develops. All the tests in scope.c that use "::" stick to static variables, whereas the new test uses :: in an admittedly undocumented fashion and concerns dynamic, rather than static, scoping. However, I don't know what criteria there are for grouping tests. Thanks for your comments. -- Paul N. Hilfinger (Hilfinger@adacore.com)