btrace: fix tests for 32-bit
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.btrace / stepi.exp
index a663f87fbc689b4b3961cf784526a6efd79fca5e..fd018acdf07f12caf5990fdd809c5fec19c05fdd 100644 (file)
 # check for btrace support
 if { [skip_btrace_tests] } { return -1 }
 
+# This test is stepping on instruction level.  To guarantee that we always
+# get the same execution trace, we use an assembly source file.
+#
+# We use different assembly sources based on the target architecture.
+#
+# Luckily, they are similar enough that a single test script can handle
+# both.
+if {[istarget "x86_64-*-*"]} {
+       standard_testfile x86_64-record_goto.S
+} elseif {[istarget "i?86-*-*"]} {
+       standard_testfile i686-record_goto.S
+} else {
+       return -1
+}
+
 # start inferior
-standard_testfile x86-record_goto.S
 if [prepare_for_testing stepi.exp $testfile $srcfile] {
     return -1
 }
@@ -35,7 +49,7 @@ if ![runto_main] {
 proc check_replay_at { insn } {
   gdb_test "info record" [join [list \
     "Active record target: record-btrace" \
-    "Recording format: .*" \
+    ".*" \
     "Recorded 40 instructions in 16 functions \\\(0 gaps\\\) for .*" \
     "Replay in progress\.  At instruction $insn\." \
     ] "\r\n"]
@@ -60,10 +74,26 @@ with_test_prefix "stepi to 40" { check_replay_at 40 }
 gdb_test "stepi" ".*main\.3.*"
 gdb_test "info record" [join [list \
   "Active record target: record-btrace" \
-  "Recording format: .*" \
+  ".*" \
   "Recorded 40 instructions in 16 functions \\\(0 gaps\\\) for \[^\\\r\\\n\]*" \
   ] "\r\n"] "stepi to live"
 
+# let's try nexti
+gdb_test "reverse-nexti" ".*main\.2.*"
+with_test_prefix "reverse-nexti - 1" { check_replay_at 1 }
+
+# we can't reverse-nexti any further
+gdb_test "reverse-nexti" "No more reverse-execution history\.\r\n.*main\.2.*"
+with_test_prefix "reverse-nexti - 1" { check_replay_at 1 }
+
+# but we can step back again
+gdb_test "nexti" ".*main\.3.*" "next, 1.5"
+gdb_test "info record" [join [list \
+  "Active record target: record-btrace" \
+  ".*" \
+  "Recorded 40 instructions in 16 functions \\\(0 gaps\\\) for \[^\\\r\\\n\]*" \
+  ] "\r\n"] "nexti back"
+
 # let's step from a goto position somewhere in the middle
 gdb_test "record goto 22" ".*fun3\.2.*"
 with_test_prefix "goto 22" { check_replay_at 22 }
@@ -71,10 +101,14 @@ with_test_prefix "goto 22" { check_replay_at 22 }
 gdb_test "stepi" ".*fun1\.1.*"
 with_test_prefix "stepi to 23" { check_replay_at 23 }
 
-# and back again
 gdb_test "reverse-stepi" ".*fun3\.2.*"
-gdb_test "reverse-stepi" ".*fun3\.1.*"
-with_test_prefix "reverse-stepi to 21" { check_replay_at 21 }
+with_test_prefix "reverse-stepi to 22" { check_replay_at 22 }
+
+gdb_test "nexti" ".*fun3\.3.*"
+with_test_prefix "nexti to 27" { check_replay_at 27 }
+
+gdb_test "reverse-nexti" ".*fun3\.2.*"
+with_test_prefix "reverse-nexti to 22" { check_replay_at 22 }
 
 # let's try to step off the left end
 gdb_test "record goto begin" ".*main\.2.*"
@@ -84,6 +118,10 @@ gdb_test "reverse-stepi" "No more reverse-execution history\.\r\n.*main\.2.*"
 gdb_test "reverse-stepi" "No more reverse-execution history\.\r\n.*main\.2.*"
 with_test_prefix "reverse-stepi at begin" { check_replay_at 1 }
 
+gdb_test "reverse-nexti" "No more reverse-execution history\.\r\n.*main\.2.*"
+gdb_test "reverse-nexti" "No more reverse-execution history\.\r\n.*main\.2.*"
+with_test_prefix "reverse-nexti at begin" { check_replay_at 1 }
+
 # we can step forward, though
 gdb_test "stepi" ".*fun4\.1.*"
 with_test_prefix "stepi to 2" { check_replay_at 2 }
This page took 0.034062 seconds and 4 git commands to generate.