This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH v2 08/23] Test step-over-{lands-on-breakpoint|trips-on-watchpoint}.exp with displaced stepping
- From: Pedro Alves <palves at redhat dot com>
- To: gdb-patches at sourceware dot org
- Date: Fri, 10 Apr 2015 15:54:30 +0100
- Subject: Re: [PATCH v2 08/23] Test step-over-{lands-on-breakpoint|trips-on-watchpoint}.exp with displaced stepping
- Authentication-results: sourceware.org; auth=none
- References: <1428410990-28560-1-git-send-email-palves at redhat dot com> <1428410990-28560-9-git-send-email-palves at redhat dot com>
On 04/07/2015 01:49 PM, Pedro Alves wrote:
> 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 <palves@redhat.com>
>
> * 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.
I went ahead and pushed this one in too. If this exposes problems on
other ports, the sooner we know them the better...
---
>From c79d856c88fbc58584d811c04b4812618aa6ac7b Mon Sep 17 00:00:00 2001
From: Pedro Alves <palves@redhat.com>
Date: Fri, 10 Apr 2015 15:22:38 +0100
Subject: [PATCH] Test step-over-{lands-on-breakpoint|trips-on-watchpoint}.exp
with displaced stepping
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.
Tested on x86-64 Fedora 20.
gdb/testsuite/ChangeLog:
2015-04-10 Pedro Alves <palves@redhat.com>
* 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/testsuite/ChangeLog | 10 +++++++++
.../gdb.threads/step-over-lands-on-breakpoint.exp | 22 +++++++++++++++++---
.../gdb.threads/step-over-trips-on-watchpoint.exp | 24 +++++++++++++++-------
3 files changed, 46 insertions(+), 10 deletions(-)
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index ec319ab..0d5d07f 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,15 @@
2015-04-10 Pedro Alves <palves@redhat.com>
+ * 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.
+
+2015-04-10 Pedro Alves <palves@redhat.com>
+
* gdb.threads/step-over-trips-on-watchpoint.c (child_function):
Remove comment.
* gdb.threads/step-over-trips-on-watchpoint.exp (do_test): Find
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..52b59ec 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,14 @@ foreach command {"step" "next" "continue" } {
gdb_test "$command" "step-over here.*"
}
}
+
+foreach displaced { "off" "on" } {
+ if { $displaced != "off" && ![support_displaced_stepping] } {
+ continue
+ }
+
+ # 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 17cd758..aa983f7 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
global gdb_prompt
global hex
@@ -41,7 +45,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 {
@@ -51,6 +55,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"
@@ -99,9 +105,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.
gdb_test "b *$after_address_triggers_watch thread 1"
}
@@ -120,5 +123,12 @@ proc do_test { with_bp } {
}
}
-do_test 0
-do_test 1
+foreach displaced { "off" "on" } {
+ if { $displaced != "off" && ![support_displaced_stepping] } {
+ continue
+ }
+
+ foreach with_bp { 0 1 } {
+ do_test $displaced $with_bp
+ }
+}
--
1.9.3