From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32662 invoked by alias); 11 Jan 2012 10:59:32 -0000 Received: (qmail 32651 invoked by uid 22791); 11 Jan 2012 10:59:31 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from syracuse.mckusick.com (HELO syracuse.mckusick.com) (70.36.157.236) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 11 Jan 2012 10:59:18 +0000 Received: from syracuse.mckusick.com (localhost [127.0.0.1]) by syracuse.mckusick.com (8.14.3/8.14.3/Debian-9.1ubuntu1) with ESMTP id q0BAwtW0018044; Wed, 11 Jan 2012 02:58:55 -0800 Received: (from hilfingr@localhost) by syracuse.mckusick.com (8.14.3/8.14.3/Submit) id q0BAwt7c018043; Wed, 11 Jan 2012 02:58:55 -0800 From: Hilfinger@adacore.com To: gdb-patches@sourceware.org Cc: Paul Hilfinger Subject: [PATCH 3/3] Add test for use of "::" syntax for locals in watch. Date: Wed, 11 Jan 2012 10:59:00 -0000 Message-Id: <1326279522-18004-3-git-send-email-Hilfinger@adacore.com> In-Reply-To: <1326279522-18004-2-git-send-email-Hilfinger@adacore.com> References: <20120110102729.GA5070@adacore.com> <1326279522-18004-1-git-send-email-Hilfinger@adacore.com> <1326279522-18004-2-git-send-email-Hilfinger@adacore.com> Reply-To: Hilfinger@adacore.com MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------3141592718281828" 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: 2012-01/txt/msg00351.txt.bz2 From: Paul Hilfinger This is a multi-part message in MIME format. --------------3141592718281828 Content-Type: text/plain; charset=UTF-8; format=fixed Content-Transfer-Encoding: 8bit Content-length: 919 I have committed this patch. First, fix a technical problem with the function recurser. The test sets a watch on local_x at a point where its value is technically undefined. The test is written assuming that the value is not initially 2, but nothing in the C standard guarantees that. Second, augment the existing test for variables in recursive calls to check an equivalent expression that explicitly sets the scope of the local variable being tracked. 2012-01-11 Paul Hilfinger * gdb.base/watchpoint.c (recurser): Initialize local_x. (main): Repeat recurser call. * gdb.base/watchpoint.exp: Check that 'watch recurser::local_x' is equivalent to 'local_x'. --- gdb/testsuite/ChangeLog | 7 +++++++ gdb/testsuite/gdb.base/watchpoint.c | 8 +++++++- gdb/testsuite/gdb.base/watchpoint.exp | 14 ++++++++++++++ 3 files changed, 28 insertions(+), 1 deletions(-) --------------3141592718281828 Content-Type: text/x-patch; name="0003-Add-test-for-use-of-block-variable-syntax-for-locals.patch" Content-Transfer-Encoding: 8bit Content-Disposition: attachment; filename="0003-Add-test-for-use-of-block-variable-syntax-for-locals.patch" Content-length: 3168 diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 8c811c9..6e18dfc 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,4 +1,11 @@ 2012-01-11 Paul Hilfinger + + * gdb.base/watchpoint.c (recurser): Initialize local_x. + (main): Repeat recurser call. + * gdb.base/watchpoint.exp: Check that 'watch recurser::local_x' is + equivalent to 'local_x'. + +2012-01-11 Paul Hilfinger Joel Brobecker * gdb.base/recpar.c, gdb.base/recpar.exp: New files. diff --git a/gdb/testsuite/gdb.base/watchpoint.c b/gdb/testsuite/gdb.base/watchpoint.c index 50f0a83..88c110f 100644 --- a/gdb/testsuite/gdb.base/watchpoint.c +++ b/gdb/testsuite/gdb.base/watchpoint.c @@ -80,7 +80,7 @@ void recurser (int x) void recurser (x) int x; #endif { - int local_x; + int local_x = 0; if (x > 0) recurser (x-1); @@ -232,6 +232,12 @@ int main () marker6 (); recurser (2); + /* This invocation is used for watches of a local variable with explicitly + specified scope when recursion happens. + */ + marker6 (); + recurser (2); + marker6 (); func3 (); diff --git a/gdb/testsuite/gdb.base/watchpoint.exp b/gdb/testsuite/gdb.base/watchpoint.exp index f321de5..1860368 100644 --- a/gdb/testsuite/gdb.base/watchpoint.exp +++ b/gdb/testsuite/gdb.base/watchpoint.exp @@ -580,6 +580,7 @@ proc test_complex_watchpoint {} { # gdb_test "tbreak recurser" ".*breakpoint.*" gdb_test "cont" "Continuing.*recurser.*" + gdb_test "next" "if \\(x > 0.*" "next past local_x initialization" gdb_test "watch local_x" ".*\[Ww\]atchpoint \[0-9\]*: local_x" \ "set local watch in recursive call" gdb_test "cont" "Continuing.*\[Ww\]atchpoint .*: local_x.*New value = 2.*" \ @@ -587,6 +588,19 @@ proc test_complex_watchpoint {} { gdb_test "cont" "Continuing.*\[Ww\]atchpoint .* deleted because the program has left the block in.*which its expression is valid.*" \ "self-delete local watch in recursive call" + # Repeat the preceding test, but this time use "recurser::local_x" as + # the variable to track. + gdb_test "cont" "Continuing.*marker6.*" + gdb_test "tbreak recurser" ".*breakpoint.*" + gdb_test "cont" "Continuing.*recurser.*" + gdb_test "next" "if \\(x > 0.*" "next past local_x initialization" + gdb_test "watch recurser::local_x" ".*\[Ww\]atchpoint \[0-9\]*: recurser::local_x" \ + "set local watch in recursive call with explicit scope" + gdb_test "cont" "Continuing.*\[Ww\]atchpoint .*: recurser::local_x.*New value = 2.*" \ + "trigger local watch with explicit scope in recursive call" + gdb_test "cont" "Continuing.*\[Ww\]atchpoint .* deleted because the program has left the block in.*which its expression is valid.*" \ + "self-delete local watch with explicit scope in recursive call (2)" + # Disable everything so we can finish the program at full speed gdb_test_no_output "disable" "disable in test_complex_watchpoint" --------------3141592718281828--