From patchwork Tue Apr 7 12:49:35 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 6060 Received: (qmail 34489 invoked by alias); 7 Apr 2015 12:57:38 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 34479 invoked by uid 89); 7 Apr 2015 12:57:37 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL, BAYES_00, SPF_HELO_PASS, SPF_PASS, T_RP_MATCHES_RCVD 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, 07 Apr 2015 12:57:36 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id A224838590A for ; Tue, 7 Apr 2015 12:50:00 +0000 (UTC) Received: from brno.lan (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t37Cnows022139 for ; Tue, 7 Apr 2015 08:50:00 -0400 From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH v2 08/23] Test step-over-{lands-on-breakpoint|trips-on-watchpoint}.exp with displaced stepping Date: Tue, 7 Apr 2015 13:49:35 +0100 Message-Id: <1428410990-28560-9-git-send-email-palves@redhat.com> In-Reply-To: <1428410990-28560-1-git-send-email-palves@redhat.com> References: <1428410990-28560-1-git-send-email-palves@redhat.com> These tests exercise the infrun.c:proceed code that needs to know to start new step overs (along with switch_back_to_stepped_thread, etc.). That code is tricky to get right in the multitude of possible combinations (at least): (native | remote) X (all-stop | all-stop-but-target-always-in-non-stop) X (displaced-stepping | in-line step-over). The first two above are properties of the target, but the different step-over-breakpoint methods should work with any target that supports them. This patch makes sure we always test both methods on all targets. gdb/testsuite/ChangeLog: 2015-04-07 Pedro Alves * gdb.threads/step-over-lands-on-breakpoint.exp (do_test): New procedure, factored out from ... (top level): ... here. Add "set displaced-stepping" testing axis. * gdb.threads/step-over-trips-on-watchpoint.exp (do_test): New parameter "displaced". Use it. (top level): Use foreach and add "set displaced-stepping" testing axis. --- .../gdb.threads/step-over-lands-on-breakpoint.exp | 18 +++++++++++++++--- .../gdb.threads/step-over-trips-on-watchpoint.exp | 20 +++++++++++++------- 2 files changed, 28 insertions(+), 10 deletions(-) diff --git a/gdb/testsuite/gdb.threads/step-over-lands-on-breakpoint.exp b/gdb/testsuite/gdb.threads/step-over-lands-on-breakpoint.exp index 1e12314..4d27059 100644 --- a/gdb/testsuite/gdb.threads/step-over-lands-on-breakpoint.exp +++ b/gdb/testsuite/gdb.threads/step-over-lands-on-breakpoint.exp @@ -24,15 +24,20 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" \ return -1 } -# Cover both stepping and non-stepping execution commands. -foreach command {"step" "next" "continue" } { - with_test_prefix $command { +# The test proper. DISPLACED is true if we should try with displaced +# stepping. COMMAND is the execution command to test. +proc do_test {displaced command} { + global executable + + with_test_prefix "displaced=$displaced: $command" { clean_restart $executable if ![runto_main] { continue } + gdb_test_no_output "set displaced-stepping $displaced" + gdb_breakpoint [gdb_get_line_number "set wait-thread breakpoint here"] gdb_continue_to_breakpoint "run to wait-thread breakpoint" gdb_test "info threads" "2 .*\\\* 1.*" "info threads shows all threads" @@ -60,3 +65,10 @@ foreach command {"step" "next" "continue" } { gdb_test "$command" "step-over here.*" } } + +foreach displaced { "off" "on" } { + # Cover both stepping and non-stepping execution commands. + foreach command { "step" "next" "continue" } { + do_test $displaced $command + } +} diff --git a/gdb/testsuite/gdb.threads/step-over-trips-on-watchpoint.exp b/gdb/testsuite/gdb.threads/step-over-trips-on-watchpoint.exp index b8fc6a8..7a0fb79 100644 --- a/gdb/testsuite/gdb.threads/step-over-trips-on-watchpoint.exp +++ b/gdb/testsuite/gdb.threads/step-over-trips-on-watchpoint.exp @@ -31,7 +31,11 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" \ return -1 } -proc do_test { with_bp } { +# The test proper. DISPLACED is true if we should try with displaced +# stepping. WITH_BP is true if we should try with a thread-specific +# breakpoint (for the wrong thread) right after the instruction that +# triggers the watchpoint. +proc do_test { displaced with_bp } { global executable if ${with_bp} { @@ -39,7 +43,7 @@ proc do_test { with_bp } { } else { set prefix "no thread-specific bp" } - with_test_prefix $prefix { + with_test_prefix "displaced=$displaced: $prefix" { # Cover both stepping and non-stepping execution commands. foreach command {"step" "next" "continue" } { with_test_prefix $command { @@ -49,6 +53,8 @@ proc do_test { with_bp } { continue } + gdb_test_no_output "set displaced-stepping $displaced" + gdb_breakpoint [gdb_get_line_number "set wait-thread breakpoint here"] gdb_continue_to_breakpoint "run to wait-thread breakpoint" gdb_test "info threads" "2 .*\\\* 1.*" "info threads shows all threads" @@ -65,9 +71,6 @@ proc do_test { with_bp } { gdb_test "watch watch_me" "Hardware watchpoint .*" if ${with_bp} { - # Set a thread-specific breakpoint (for the wrong - # thread) right after instruction that triggers - # the watchpoint. set linenum [gdb_get_line_number "set thread-specific breakpoint here"] gdb_test "b $linenum thread 1" } @@ -86,5 +89,8 @@ proc do_test { with_bp } { } } -do_test 0 -do_test 1 +foreach displaced { "off" "on" } { + foreach with_bp { 0 1 } { + do_test $displaced $with_bp + } +}