diff options
author | Markus Metzger <markus.t.metzger@intel.com> | 2015-09-16 09:05:22 +0200 |
---|---|---|
committer | Markus Metzger <markus.t.metzger@intel.com> | 2015-09-18 14:33:16 +0200 |
commit | d2939ba2b40daa89b501d4b81484ea888ef17139 (patch) | |
tree | 12f688476388b1eaf825613f434067b19212dcbc /gdb/testsuite | |
parent | f2665db5f2c20f3f47673ad5343738b10ce81dde (diff) | |
download | gdb-d2939ba2b40daa89b501d4b81484ea888ef17139.zip gdb-d2939ba2b40daa89b501d4b81484ea888ef17139.tar.gz gdb-d2939ba2b40daa89b501d4b81484ea888ef17139.tar.bz2 |
btrace: honour scheduler-locking for all-stop targets
In all-stop mode, record btrace maintains the old behaviour of an implicit
scheduler-locking on.
Now that we added a scheduler-locking mode to model this old behaviour, we
don't need the respective code in record btrace anymore. Remove it.
For all-stop targets, step inferior_ptid and continue other threads matching
the argument ptid. Assert that inferior_ptid matches the argument ptid.
This should make record btrace honour scheduler-locking.
gdb/
* record-btrace.c (record_btrace_resume): Honour scheduler-locking.
testsuite/
* gdb.btrace/multi-thread-step.exp: Test scheduler-locking on, step,
and replay.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r-- | gdb/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/testsuite/gdb.btrace/multi-thread-step.exp | 227 |
2 files changed, 158 insertions, 74 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 23a957b..1b8e0e8 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,5 +1,10 @@ 2015-09-18 Markus Metzger <markus.t.metzger@intel.com> + * gdb.btrace/multi-thread-step.exp: Test scheduler-locking on, step, + and replay. + +2015-09-18 Markus Metzger <markus.t.metzger@intel.com> + * gdb.btrace/non-stop.c: New. * gdb.btrace/non-stop.exp: New. diff --git a/gdb/testsuite/gdb.btrace/multi-thread-step.exp b/gdb/testsuite/gdb.btrace/multi-thread-step.exp index 2295f71..74748cc 100644 --- a/gdb/testsuite/gdb.btrace/multi-thread-step.exp +++ b/gdb/testsuite/gdb.btrace/multi-thread-step.exp @@ -37,9 +37,29 @@ set bp_2 [gdb_get_line_number "bp.2" $srcfile] set bp_3 [gdb_get_line_number "bp.3" $srcfile] proc gdb_cont_to_line { line } { - gdb_breakpoint $line - gdb_continue_to_breakpoint "cont to $line" ".*$line\r\n.*" - delete_breakpoints + gdb_breakpoint $line + gdb_continue_to_breakpoint "cont to $line" ".*$line\r\n.*" + delete_breakpoints +} + +proc check_replay_insn { thread insn } { + gdb_test "thread apply $thread info record" \ + "Replay in progress\. At instruction $insn\." +} + +proc check_not_replaying { thread } { + global gdb_prompt + + set test "thread $thread not replaying" + + gdb_test_multiple "thread apply $thread info record" $test { + -re "Replay in progress" { + fail $test + } + -re "$gdb_prompt $" { + pass $test + } + } } # trace the code between the two breakpoints @@ -50,86 +70,145 @@ gdb_test "info threads" ".*" gdb_test_no_output "record btrace" gdb_cont_to_line $srcfile:$bp_2 -# navigate in the trace history for both threads -with_test_prefix "navigate" { - gdb_test "thread 1" ".*" - with_test_prefix "thread 1" { - gdb_test "record goto begin" ".*" - gdb_test "info record" ".*Replay in progress\. At instruction 1\." - } - gdb_test "thread 2" ".*" - with_test_prefix "thread 2" { - gdb_test "record goto begin" ".*" - gdb_test "info record" ".*Replay in progress\. At instruction 1\." - } +proc test_navigate {} { + with_test_prefix "navigate" { + gdb_test "thread 1" ".*" + with_test_prefix "thread 1" { + gdb_test "record goto begin" ".*" + + check_replay_insn 1 1 + check_not_replaying 2 + } + gdb_test "thread 2" ".*" + with_test_prefix "thread 2" { + gdb_test "record goto begin" ".*" + + check_replay_insn 1 1 + check_replay_insn 2 1 + } + } } -# step both threads -with_test_prefix "step" { - gdb_test "thread 1" ".*" - with_test_prefix "thread 1" { - gdb_test "info record" ".*Replay in progress\. At instruction 1\." - gdb_test "stepi" ".*" - gdb_test "info record" ".*Replay in progress\. At instruction 2\." - } - gdb_test "thread 2" ".*" - with_test_prefix "thread 2" { - gdb_test "info record" ".*Replay in progress\. At instruction 1\." - gdb_test "stepi" ".*" - gdb_test "info record" ".*Replay in progress\. At instruction 2\." - } +proc test_step {} { + with_test_prefix "step" { + gdb_test "thread 1" ".*" + with_test_prefix "thread 1" { + gdb_test "stepi" ".*" + + check_replay_insn 1 2 + check_replay_insn 2 1 + } + gdb_test "thread 2" ".*" + with_test_prefix "thread 2" { + gdb_test "stepi" ".*" + + check_replay_insn 1 2 + check_replay_insn 2 2 + } + } } -# run to the end of the history for both threads -with_test_prefix "cont" { - gdb_test "thread 1" ".*" - with_test_prefix "thread 1" { - gdb_test "info record" ".*Replay in progress\. At instruction 2\." - gdb_test "continue" "No more reverse-execution history.*" - } - gdb_test "thread 2" ".*" - with_test_prefix "thread 2" { - gdb_test "info record" ".*Replay in progress\. At instruction 2\." - gdb_test "continue" "No more reverse-execution history.*" - } +proc test_cont {} { + with_test_prefix "cont" { + gdb_test "thread 1" ".*" + with_test_prefix "thread 1" { + gdb_test "continue" "No more reverse-execution history.*" + + check_not_replaying 1 + check_replay_insn 2 2 + } + gdb_test "thread 2" ".*" + with_test_prefix "thread 2" { + gdb_test "continue" "No more reverse-execution history.*" + + check_not_replaying 1 + check_not_replaying 2 + } + } } -# reverse-step both threads -with_test_prefix "reverse-step" { - gdb_test "thread 1" ".*" - with_test_prefix "thread 1" { - gdb_test "reverse-stepi" ".*" - gdb_test "info record" ".*Replay in progress\..*" - } - gdb_test "thread 2" ".*" - with_test_prefix "thread 2" { - gdb_test "reverse-stepi" ".*" - gdb_test "info record" ".*Replay in progress\..*" - } +proc test_cont_all {} { + with_test_prefix "cont-all" { + gdb_test "continue" "No more reverse-execution history.*" + + # this works because we're lock-stepping threads that executed exactly + # the same code starting from the same instruction. + + check_not_replaying 1 + check_not_replaying 2 + } } -# both threads are still replaying -with_test_prefix "check" { - gdb_test "thread 1" ".*" - with_test_prefix "thread 1" { - gdb_test "info record" ".*Replay in progress\..*" - } - gdb_test "thread 2" ".*" - with_test_prefix "thread 2" { - gdb_test "info record" ".*Replay in progress\..*" - } +proc test_rstep {} { + with_test_prefix "reverse-step" { + gdb_test "thread apply all record goto 3" + + gdb_test "thread 1" ".*" + with_test_prefix "thread 1" { + gdb_test "reverse-stepi" ".*" + + check_replay_insn 1 2 + check_replay_insn 2 3 + } + gdb_test "thread 2" ".*" + with_test_prefix "thread 2" { + gdb_test "reverse-stepi" ".*" + + check_replay_insn 1 2 + check_replay_insn 2 2 + } + } +} + +proc test_goto_end {} { + with_test_prefix "goto-end" { + gdb_test "thread apply all record goto end" + + check_not_replaying 1 + check_not_replaying 2 + } +} + +foreach schedlock { "replay" "on" "step" } { + with_test_prefix "schedlock-$schedlock" { + gdb_test_no_output "set scheduler-locking $schedlock" + + test_navigate + test_step + if { $schedlock == "step" } { + test_cont_all + } else { + test_cont + } + test_rstep + test_goto_end + } } +# schedlock-off is difficult to test since we can't really say where the other +# thread will be when the resumed thread stops. + # navigate back into the history for thread 1 and continue thread 2 -with_test_prefix "cont" { - gdb_test "thread 1" ".*" - with_test_prefix "thread 1" { - gdb_test "record goto begin" ".*" - gdb_test "info record" ".*Replay in progress\. At instruction 1\." - } - gdb_test "thread 2" ".*" - with_test_prefix "thread 2" { - gdb_test "record goto end" ".*" - gdb_cont_to_line $srcfile:$bp_3 - } +with_test_prefix "cont-to-end" { + # this test only works for scheduler-locking replay + gdb_test_no_output "set scheduler-locking replay" + + gdb_test "thread 1" ".*" + with_test_prefix "thread 1" { + gdb_test "record goto begin" ".*" + + check_replay_insn 1 1 + } + gdb_test "thread 2" ".*" + with_test_prefix "thread 2" { + gdb_test "record goto end" ".*" + + check_not_replaying 2 + + # if we reach the breakpoint, thread 2 terminated... + gdb_cont_to_line $srcfile:$bp_3 + + # and thread 1 stopped replaying + check_not_replaying 1 + } } |