[PATCH v2 16/23] Fix signal-while-stepping-over-bp-other-thread.exp on targets always in non-stop

Pedro Alves
2015-04-07T12:50:14Z

With "maint set target-non-stop on" we get:

-PASS: gdb.threads/signal-while-stepping-over-bp-other-thread.exp: step
+FAIL: gdb.threads/signal-while-stepping-over-bp-other-thread.exp: step

The issue is simply that switch_back_to_stepped_thread is not used in
non-stop mode, thus infrun doesn't output the expected "signal arrived
while stepping over breakpoint" log.

gdb/testsuite/ChangeLog:
2015-04-07 Pedro Alves <palves@redhat.com>

* signal-while-stepping-over-bp-other-thread.exp: Use
gdb_test_sequence. Expect "restart threads" as alternative to
"switching back to stepped thread".
---
.../signal-while-stepping-over-bp-other-thread.exp | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/gdb/testsuite/gdb.threads/signal-while-stepping-over-bp-other-thread.exp b/gdb/testsuite/gdb.threads/signal-while-stepping-over-bp-other-thread.exp
index bb00c50..1d5eabd 100644
--- a/gdb/testsuite/gdb.threads/signal-while-stepping-over-bp-other-thread.exp
+++ b/gdb/testsuite/gdb.threads/signal-while-stepping-over-bp-other-thread.exp
@@ -95,19 +95,19 @@ gdb_test "set scheduler-locking off"
# Make sure we're exercising the paths we want to.
gdb_test "set debug infrun 1"

-gdb_test \
- "step" \
- ".*need to step-over.*resume \\(step=1.*signal arrived while stepping over breakpoint.*switching back to stepped thread.*stepped to a different line.*callme.*" \
- "step"
+set test "step"
+gdb_test_sequence $test $test {
+ "need to step-over \[^\r\n\]* first"
+ "resume \\(step=1"
+ "Program received signal SIGUSR1"
+ "(restart threads|signal arrived while stepping over breakpoint)"
+ "stepped to a different line"
+ "callme \\(\\);"
+}

set cnt_after [get_value "args\[$my_number\]" "get count after step"]

# Test that GDB doesn't inadvertently resume the stepped thread when a
# signal arrives while stepping over a breakpoint in another thread.

-set test "stepped thread under control"
-if { $cnt_before + 1 == $cnt_after } {
- pass $test
-} else {
- fail $test
-}
+gdb_assert { $cnt_before + 1 == $cnt_after } "stepped thread under control"
--
1.9.3