From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26645 invoked by alias); 16 Sep 2014 17:05:10 -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 Received: (qmail 26631 invoked by uid 89); 16 Sep 2014 17:05:09 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.5 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 16 Sep 2014 17:05:07 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s8GH54Ul030723 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 16 Sep 2014 13:05:04 -0400 Received: from localhost (dhcp-10-15-16-169.yyz.redhat.com [10.15.16.169]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s8GH52qq029986 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=NO); Tue, 16 Sep 2014 13:05:03 -0400 From: Sergio Durigan Junior To: Pedro Alves Cc: Patrick Palka , gdb-patches@sourceware.org Subject: Re: [PATCH v2] Fix PR12526: -location watchpoints for bitfield arguments References: <1408563606-24314-1-git-send-email-patrick@parcs.ath.cx> <1408591949-29689-1-git-send-email-patrick@parcs.ath.cx> <54087F68.8020606@redhat.com> <87zjebyoey.fsf@redhat.com> <87oaurynsx.fsf@redhat.com> <54186B53.7020809@redhat.com> X-URL: http://www.redhat.com Date: Tue, 16 Sep 2014 17:05:00 -0000 In-Reply-To: <54186B53.7020809@redhat.com> (Pedro Alves's message of "Tue, 16 Sep 2014 17:54:43 +0100") Message-ID: <874mw7ts1u.fsf@redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes X-SW-Source: 2014-09/txt/msg00546.txt.bz2 On Tuesday, September 16 2014, Pedro Alves wrote: > Hey Sergio, > > For some odd reason, I completely missed your replies to Patrick, > and wanting to keep this moving, ended up redoing most of your > patch from scratch. Gah. /me bangs head in wall :-P. No worries :-). > As penance, I salvaged pieces from both patches, which I think > ends up being better than either version was. > > - function names a bit more concise > - gdb.sum output is more concise too and shows patterns more clearly. > - putting things in procedures allows run_to_main returning with > canceling the other branch of the test (and allows easy hacking > away part of the test when debugging it). > - uses gdb_continue_to_end > > This is what we have currently: > [...] > > WDYT? Looks neat, thanks for doing that! > ---------- > From d3f6e7f2ab3238ed98133d1f484da623dc55e8aa Mon Sep 17 00:00:00 2001 > From: Sergio Durigan Junior > Date: Tue, 16 Sep 2014 17:32:04 +0100 > Subject: [PATCH] gdb.base/watch-bitfields.exp: Improve test > > Make test messages unique, and a couple other tweaks. > > gdb/testsuite/ > 2014-09-16 Sergio Durigan Junior > Pedro Alves > > * gdb.base/watch-bitfields.exp: Pass string other than test file > name to prepare_for_testing. > (watch): New procedure. > (expect_watchpoint): Use with_test_prefix. > (top level): Factor out tests to ... > (test_watch_location, test_regular_watch): ... these new > procedures, and use with_test_prefix and gdb_continue_to_end. > --- > gdb/testsuite/gdb.base/watch-bitfields.exp | 77 ++++++++++++++++++++---------- > 1 file changed, 51 insertions(+), 26 deletions(-) > > diff --git a/gdb/testsuite/gdb.base/watch-bitfields.exp b/gdb/testsuite/gdb.base/watch-bitfields.exp > index 3f25384..7b7fa22 100644 > --- a/gdb/testsuite/gdb.base/watch-bitfields.exp > +++ b/gdb/testsuite/gdb.base/watch-bitfields.exp > @@ -17,40 +17,65 @@ > > standard_testfile > > -if {[prepare_for_testing $testfile.exp $testfile $srcfile debug]} { > +if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} { > return -1 > } > > -if {![runto_main]} { > - return -1 > +# Set a watchpoint watching EXPR. > +proc watch { expr } { > + global decimal > + > + set expr_re [string_to_regexp $expr] > + gdb_test "watch $expr" \ > + "\(Hardware \)?\[Ww\]atchpoint $decimal: $expr_re" > } > > # Continue inferior execution, expecting the watchpoint EXPR to be triggered > # having old value OLD and new value NEW. > proc expect_watchpoint { expr old new } { > - set expr_re [string_to_regexp $expr] > - gdb_test "print $expr" "\\$\\d+ = $old\\s" > - gdb_test "cont" "$expr_re\\s.*Old value = $old\\s+New value = $new\\s.*" > - gdb_test "print $expr" "\\$\\d+ = $new\\s" > + with_test_prefix "$expr: $old->$new" { > + set expr_re [string_to_regexp $expr] > + gdb_test "print $expr" "\\$\\d+ = $old\\s" "print expression before" > + gdb_test "continue" "$expr_re\\s.*Old value = $old\\s+New value = $new\\s.*" > + gdb_test "print $expr" "\\$\\d+ = $new\\s" "print expression after" > + } > } > > # Check that -location watchpoints against bitfields trigger properly. > -gdb_test "watch -l q.a" > -gdb_test "watch -l q.e" > -expect_watchpoint "q.a" 0 1 > -expect_watchpoint "q.e" 0 5 > -expect_watchpoint "q.a" 1 0 > -expect_watchpoint "q.e" 5 4 > -gdb_test "cont" ".*exited normally.*" > - > -# Check that regular watchpoints against expressions involving bitfields > -# trigger properly. > -runto_main > -gdb_test "watch q.d + q.f + q.g" > -expect_watchpoint "q.d + q.f + q.g" 0 4 > -expect_watchpoint "q.d + q.f + q.g" 4 10 > -expect_watchpoint "q.d + q.f + q.g" 10 3 > -expect_watchpoint "q.d + q.f + q.g" 3 2 > -expect_watchpoint "q.d + q.f + q.g" 2 1 > -expect_watchpoint "q.d + q.f + q.g" 1 0 > -gdb_test "cont" ".*exited normally.*" > +proc test_watch_location {} { > + with_test_prefix "-location watch against bitfields" { > + if {![runto_main]} { > + return -1 > + } > + > + watch "-location q.a" > + watch "-location q.e" > + expect_watchpoint "q.a" 0 1 > + expect_watchpoint "q.e" 0 5 > + expect_watchpoint "q.a" 1 0 > + expect_watchpoint "q.e" 5 4 > + gdb_continue_to_end > + } > +} > + > +# Check that regular watchpoints against expressions involving > +# bitfields trigger properly. > +proc test_regular_watch {} { > + with_test_prefix "regular watch against bitfields" { > + if {![runto_main]} { > + return -1 > + } > + > + watch "q.d + q.f + q.g" > + expect_watchpoint "q.d + q.f + q.g" 0 4 > + expect_watchpoint "q.d + q.f + q.g" 4 10 > + expect_watchpoint "q.d + q.f + q.g" 10 3 > + expect_watchpoint "q.d + q.f + q.g" 3 2 > + expect_watchpoint "q.d + q.f + q.g" 2 1 > + expect_watchpoint "q.d + q.f + q.g" 1 0 > + gdb_continue_to_end > + } > +} > + > +test_watch_location > +test_regular_watch > -- > 1.9.3 The patch looks good to me. Thanks! -- Sergio GPG key ID: 0x65FC5E36 Please send encrypted e-mail if possible http://sergiodj.net/