-# Copyright 2008, 2009 Free Software Foundation, Inc.
+# Copyright 2008-2020 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# Test step and next in reverse
#
-if ![target_info exists gdb,can_reverse] {
+if ![supports_reverse] {
return
}
-set testfile "step-reverse"
-set srcfile ${testfile}.c
+standard_testfile
-if { [prepare_for_testing $testfile.exp $testfile $srcfile] } {
+if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
return -1
}
runto main
-if [target_info exists gdb,use_precord] {
+if [supports_process_record] {
# Activate process record/replay
- gdb_test "record" "" "Turn on process record"
- # FIXME: command ought to acknowledge, so we can test if it succeeded.
+ gdb_test_no_output "record" "turn on process record"
}
# plain vanilla step/next (no count)
###
# Set reverse execution direction
-# FIXME: command needs to acknowledge, so we can test if it succeeded.
-gdb_test "set exec-dir reverse" "" "set reverse execution"
+gdb_test_no_output "set exec-dir reverse" "set reverse execution"
# stepi backward thru return and into a function
# step backward into function (thru return)
-set test_message "reverse step into fn call"
+gdb_test "step" "(RETURN FROM CALLEE|ARRIVED IN CALLEE).*" \
+ "reverse step into fn call"
+
+# step backward out of called function (thru call)
+
+set test_message "reverse step out of called fn"
gdb_test_multiple "step" "$test_message" {
- -re "RETURN FROM CALLEE.*$gdb_prompt $" {
+ -re "STEP INTO THIS CALL.*.*$gdb_prompt $" {
+ pass "$test_message"
+ }
+ -re "ARRIVED IN CALLEE.*$gdb_prompt $" {
send_gdb "step\n"
exp_continue
}
- -re "ARRIVED IN CALLEE.*$gdb_prompt $" {
- pass "$test_message"
+ -re "ENTER CALLEE.*$gdb_prompt $" {
+ send_gdb "step\n"
+ exp_continue
}
}
-# step backward out of called function (thru call)
-
-gdb_test "step" ".*STEP INTO THIS CALL.*" "reverse step out of called fn"
-
# next backward over call
gdb_test "next" ".*NEXT OVER THIS CALL.*" "reverse next over call"
# Finish test by running forward to the end.
# FIXME return to this later...
-# gdb_test "set exec-dir forward" "" "set forward execution"
+# gdb_test_no_output "set exec-dir forward" "set forward execution"
# gdb_continue_to_end "step-reverse.exp"