[gdb/testsuite] Enable some test-cases for x86_64 -m32
authorTom de Vries <tdevries@suse.de>
Mon, 27 Jun 2022 10:47:26 +0000 (12:47 +0200)
committerTom de Vries <tdevries@suse.de>
Mon, 27 Jun 2022 10:47:26 +0000 (12:47 +0200)
When trying to run test-case gdb.reverse/i387-env-reverse.exp for x86_64-linux
with target board unix/-m32, it's skipped.

Fix this by using is_x86_like_target instead of istarget "i?86-*linux*".

This exposes a number of duplicates, fix those by making the test names unique.

Likewise in a couple of other test-cases.

Tested on x86_64-linux with target boards unix/-m32.

gdb/testsuite/gdb.reverse/i386-precsave.exp
gdb/testsuite/gdb.reverse/i386-reverse.exp
gdb/testsuite/gdb.reverse/i387-env-reverse.exp
gdb/testsuite/gdb.reverse/i387-stack-reverse.exp

index e3fc940f5d0cf7462ff97f0a19a5bb44392458b8..545804744303f006d3d70822ae96558760829c68 100644 (file)
@@ -25,7 +25,7 @@ if ![supports_process_record] {
 }
 
 
-if ![istarget "i?86-*linux*"] then {
+if ![is_x86_like_target] then {
     verbose "Skipping i386 reverse tests."
     return
 }
index 68e964e863c5ccc971b76f166763af6b46263d7a..15c18dad205fc4290916e4218885e6e163d94429 100644 (file)
@@ -24,7 +24,7 @@ if ![supports_reverse] {
 }
 
 
-if ![istarget "i?86-*linux*"] then {
+if ![is_x86_like_target] then {
     verbose "Skipping i386 reverse tests."
     return
 }
index 43c493dcca900e1f5bf3160731c09cf926e64f42..a0a79c22ed075e6f6567777f4f24c769c164c363 100644 (file)
@@ -16,7 +16,7 @@
 # This file is part of the gdb testsuite.
 
 
-if ![istarget "i?86-*linux*"] then {
+if ![is_x86_like_target] then {
     verbose "Skipping i387 reverse float tests."
     return
 }
@@ -52,82 +52,79 @@ gdb_test "until $location" ".*$srcfile:$location.*" \
     "rewind to beginning of main"
 gdb_test_no_output "set exec-dir forward" "set forward direction"
 
-# Test FPU env particularly ftag and fstatus reigters.
+with_test_prefix "forward" {
+    # Test FPU env particularly ftag and fstatus reigters.
 
-set location [gdb_get_line_number "TEST ENV"]
-gdb_test "until $location" ".*$srcfile:$location.*asm.*nop.*" \
-    "begin testing fpu env"       
+    set location [gdb_get_line_number "TEST ENV"]
+    gdb_test "until $location" ".*$srcfile:$location.*asm.*nop.*" \
+       "begin testing fpu env"
 
-gdb_test "n" "asm.*fsave.*"               "save FPU env in memory"    
-gdb_test "n" "asm.*frstor.*"              "restore FPU env"
-gdb_test "n" "asm.*fstsw.*"               "store status word in EAX"
-gdb_test "n" "asm.*fld1.*"                "push st0"
+    gdb_test "n" "asm.*fsave.*"               "save FPU env in memory"
+    gdb_test "n" "asm.*frstor.*"              "restore FPU env"
+    gdb_test "n" "asm.*fstsw.*"               "store status word in EAX"
+    gdb_test "n" "asm.*fld1.*"                "push st0"
 
-gdb_test "info register eax" "eax *0x8040000.*\[ \t\]+.*"  "verify eax == 0x8040000"
-gdb_test "info register fstat" "fstat *0.*\[ \t\]+.*"      "verify fstat == 0"
-gdb_test "info register ftag" "ftag *0xffff.*\[ \t\]+.*"   "verify ftag == 0xffff"
+    gdb_test "info register eax" "eax *0x8040000.*\[ \t\]+.*"  "verify eax == 0x8040000"
+    gdb_test "info register fstat" "fstat *0.*\[ \t\]+.*"      "verify fstat == 0"
+    gdb_test "info register ftag" "ftag *0xffff.*\[ \t\]+.*"   "verify ftag == 0xffff"
 
-gdb_test "stepi" "asm.*fldl2t.*"                      "push st0"
-gdb_test "info register fstat" "fstat *0x3800.*\[ \t\]+.*"  "verify fstat == 0x3800"
-gdb_test "info register ftag" "ftag *0x3fff.*\[ \t\]+.*"    "verify ftag  == 0x3fff"
+    gdb_test "stepi" "asm.*fldl2t.*"                      "step to fldl2t"
+    gdb_test "info register fstat" "fstat *0x3800.*\[ \t\]+.*"  "verify fstat == 0x3800"
+    gdb_test "info register ftag" "ftag *0x3fff.*\[ \t\]+.*"    "verify ftag  == 0x3fff"
 
-gdb_test "stepi" "asm.*fldl2e.*"                  "push st0"
-gdb_test "info register fstat" "fstat *0x3000.*\[ \t\]+.*"  "verify fstat == 0x3000"
-gdb_test "info register ftag" "ftag *0xfff.*\[ \t\]+.*"     "verify ftag  == 0xfff"
+    gdb_test "stepi" "asm.*fldl2e.*"                  "step to fldl2e"
+    gdb_test "info register fstat" "fstat *0x3000.*\[ \t\]+.*"  "verify fstat == 0x3000"
+    gdb_test "info register ftag" "ftag *0xfff.*\[ \t\]+.*"     "verify ftag  == 0xfff"
 
-gdb_test "stepi" "asm.*fldpi.*"                   "push st0"
-gdb_test "info register fstat" "fstat *0x2800.*\[ \t\]+.*"  "verify fstat == 0x2800"
-gdb_test "info register ftag" "ftag *0x3ff.*\[ \t\]+.*"     "verify ftag  == 0x3ff"
+    gdb_test "stepi" "asm.*fldpi.*"                   "step to fldpi"
+    gdb_test "info register fstat" "fstat *0x2800.*\[ \t\]+.*"  "verify fstat == 0x2800"
+    gdb_test "info register ftag" "ftag *0x3ff.*\[ \t\]+.*"     "verify ftag  == 0x3ff"
 
-gdb_test "stepi" "asm.*fldlg2.*"                  "push st0"
-gdb_test "info register fstat" "fstat *0x2000.*\[ \t\]+.*"  "verify fstat == 0x2000"
-gdb_test "info register ftag" "ftag *0xff.*\[ \t\]+.*"      "verify ftag  == 0xff"
+    gdb_test "stepi" "asm.*fldlg2.*"                  "step to fldlg2"
+    gdb_test "info register fstat" "fstat *0x2000.*\[ \t\]+.*"  "verify fstat == 0x2000"
+    gdb_test "info register ftag" "ftag *0xff.*\[ \t\]+.*"      "verify ftag  == 0xff"
 
-gdb_test "stepi" "asm.*fldln2.*"                  "push st0"
-gdb_test "info register fstat" "fstat *0x1800.*\[ \t\]+.*"  "verify fstat == 0x1800"
-gdb_test "info register ftag" "ftag *0x3f.*\[ \t\]+.*"      "verify ftag  == 0x3f"
+    gdb_test "stepi" "asm.*fldln2.*"                  "step to fldln2"
+    gdb_test "info register fstat" "fstat *0x1800.*\[ \t\]+.*"  "verify fstat == 0x1800"
+    gdb_test "info register ftag" "ftag *0x3f.*\[ \t\]+.*"      "verify ftag  == 0x3f"
 
-gdb_test "stepi" "asm.*fldz.*"                    "push st0"
-gdb_test "info register fstat" "fstat *0x1000.*\[ \t\]+.*"  "verify fstat == 0x1000"
-gdb_test "info register ftag" "ftag *0xf.*\[ \t\]+.*"       "verify ftag  == 0xf"
+    gdb_test "stepi" "asm.*fldz.*"                    "step to fldz"
+    gdb_test "info register fstat" "fstat *0x1000.*\[ \t\]+.*"  "verify fstat == 0x1000"
+    gdb_test "info register ftag" "ftag *0xf.*\[ \t\]+.*"       "verify ftag  == 0xf"
 
-gdb_test "stepi" "asm.*nop.*"                    "push st0"
-gdb_test "info register fstat" "fstat *0x800.*\[ \t\]+.*"  "verify fstat == 0x800"
-gdb_test "info register ftag" "ftag *0x7.*\[ \t\]+.*"      "verify ftag  == 0x7"
-
-
-# move backward and ehck we get the same registers back.
-
-gdb_test "reverse-stepi" "asm.*fldz.*"           "push st0"
-gdb_test "info register fstat" "fstat *0x1000.*\[ \t\]+.*" "verify fstat == 0x1000"
-gdb_test "info register ftag" "ftag *0xf.*\[ \t\]+.*"      "verify ftag  == 0xf"
-
-gdb_test "reverse-stepi" "asm.*fldln2.*"          "push st0"
-gdb_test "info register fstat" "fstat *0x1800.*\[ \t\]+.*"  "verify fstat == 0x1800"
-gdb_test "info register ftag" "ftag *0x3f.*\[ \t\]+.*"      "verify ftag  == 0x3f"
-
-gdb_test "reverse-stepi" "asm.*fldlg2.*"          "push st0"
-gdb_test "info register fstat" "fstat *0x2000.*\[ \t\]+.*"  "verify fstat == 0x2000"
-gdb_test "info register ftag" "ftag *0xff.*\[ \t\]+.*"      "verify ftag  == 0xff"
-
-gdb_test "reverse-stepi" "asm.*fldpi.*"          "push st0"
-gdb_test "info register fstat" "fstat *0x2800.*\[ \t\]+.*" "verify fstat == 0x2800"
-gdb_test "info register ftag" "ftag *0x3ff.*\[ \t\]+.*"    "verify ftag  == 0x3ff"
-
-gdb_test "reverse-stepi" "asm.*fldl2e.*"          "push st0"
-gdb_test "info register fstat" "fstat *0x3000.*\[ \t\]+.*"  "verify fstat == 0x3000"
-gdb_test "info register ftag" "ftag *0xfff.*\[ \t\]+.*"     "verify ftag  == 0xfff"
+    gdb_test "stepi" "asm.*nop.*"                    "step to nop"
+    gdb_test "info register fstat" "fstat *0x800.*\[ \t\]+.*"  "verify fstat == 0x800"
+    gdb_test "info register ftag" "ftag *0x7.*\[ \t\]+.*"      "verify ftag  == 0x7"
+}
 
-gdb_test "reverse-stepi" "asm.*fldl2t.*"          "push st0"
-gdb_test "info register fstat" "fstat *0x3800.*\[ \t\]+.*"  "verify fstat == 0x3800"
-gdb_test "info register ftag" "ftag *0x3fff.*\[ \t\]+.*"    "verify ftag  == 0x3fff"
+# Move backward and check we get the same registers back.
 
-gdb_test "reverse-stepi" "asm.*fld1.*"            "push st0"
-gdb_test "info register fstat" "fstat *0.*\[ \t\]+.*"       "verify fstat == 0"
-gdb_test "info register ftag" "ftag *0xffff.*\[ \t\]+.*"    "verify ftag == 0xffff"
+with_test_prefix "backward" {
+    gdb_test "reverse-stepi" "asm.*fldz.*"           "step to fldz"
+    gdb_test "info register fstat" "fstat *0x1000.*\[ \t\]+.*" "verify fstat == 0x1000"
+    gdb_test "info register ftag" "ftag *0xf.*\[ \t\]+.*"      "verify ftag  == 0xf"
 
+    gdb_test "reverse-stepi" "asm.*fldln2.*"          "step to fldln2"
+    gdb_test "info register fstat" "fstat *0x1800.*\[ \t\]+.*"  "verify fstat == 0x1800"
+    gdb_test "info register ftag" "ftag *0x3f.*\[ \t\]+.*"      "verify ftag  == 0x3f"
 
+    gdb_test "reverse-stepi" "asm.*fldlg2.*"          "step to fldlg2"
+    gdb_test "info register fstat" "fstat *0x2000.*\[ \t\]+.*"  "verify fstat == 0x2000"
+    gdb_test "info register ftag" "ftag *0xff.*\[ \t\]+.*"      "verify ftag  == 0xff"
 
+    gdb_test "reverse-stepi" "asm.*fldpi.*"          "step to fldpi"
+    gdb_test "info register fstat" "fstat *0x2800.*\[ \t\]+.*" "verify fstat == 0x2800"
+    gdb_test "info register ftag" "ftag *0x3ff.*\[ \t\]+.*"    "verify ftag  == 0x3ff"
 
+    gdb_test "reverse-stepi" "asm.*fldl2e.*"          "step tp fldl2d"
+    gdb_test "info register fstat" "fstat *0x3000.*\[ \t\]+.*"  "verify fstat == 0x3000"
+    gdb_test "info register ftag" "ftag *0xfff.*\[ \t\]+.*"     "verify ftag  == 0xfff"
 
+    gdb_test "reverse-stepi" "asm.*fldl2t.*"          "step to fldl2t"
+    gdb_test "info register fstat" "fstat *0x3800.*\[ \t\]+.*"  "verify fstat == 0x3800"
+    gdb_test "info register ftag" "ftag *0x3fff.*\[ \t\]+.*"    "verify ftag  == 0x3fff"
 
+    gdb_test "reverse-stepi" "asm.*fld1.*"            "step to fld1"
+    gdb_test "info register fstat" "fstat *0.*\[ \t\]+.*"       "verify fstat == 0"
+    gdb_test "info register ftag" "ftag *0xffff.*\[ \t\]+.*"    "verify ftag == 0xffff"
+}
index 9f8ff74da2b636df80ce1b6130f745d74c93ee1d..cadd4f760357a49b7749e91668ce35d53b0bb7ea 100644 (file)
@@ -16,7 +16,7 @@
 # This file is part of the gdb testsuite.
 
 
-if ![istarget "i?86-*linux*"] then {
+if ![is_x86_like_target] then {
     verbose "Skipping i387 reverse float tests."
     return
 }
@@ -48,112 +48,108 @@ gdb_test "until $location" ".*$srcfile:$location.*" \
     "rewind to beginning of main"
 gdb_test_no_output "set exec-dir forward" "set forward direction"
 
-# Test FPU stack. FPU stack includes st0, st1, st2, st3, st4, 
-# st5, st6, st7. We push 8 values to FPU stack in record mode
-# and see whether all are getting recorded.
-
-set location [gdb_get_line_number "test st0 register"]
-gdb_test "until $location" ".*$srcfile:$location.*asm.*fld1.*" \
-    "begin test st0"
-gdb_test "stepi" "asm.*fldl2t.*"              "push st0 == 1"
-gdb_test "info register st0" "st0 *1\[ \t\]+.*"     "verify st0 == 1"
-
-
-gdb_test "stepi" "asm.*fldl2e.*"              "push st0 == 3.3219280948*"
-gdb_test "info register st0" "st0 *3.32192.*\[ \t\]+.*" "verify st0 == 3.321928094*"
-gdb_test "info register st1" "st1 *1\[ \t\]+.*"       "verify st1 == 1"
-
-gdb_test "stepi" "asm.*fldpi.*"                   "push st0 == 1.4426950406*"
-gdb_test "info register st0" "st0 *1.44269.*\[ \t\]+.*" "verify st0 == 1.442695040*"
-gdb_test "info register st1" "st1 *3.32192.*\[ \t\]+.*" "verify st1 == 3.3219280948*"
-gdb_test "info register st2" "st2 *1\[ \t\]+.*"         "verify st2 == 1"
-                                               
-gdb_test "stepi" "asm.*fldlg2.*"                  "push st0 == 3.14159265*"
-gdb_test "info register st0" "st0 *3.14159.*\[ \t\]+.*" "verify st0 == 3.14159265*"
-gdb_test "info register st1" "st1 *1.44269.*\[ \t\]+.*" "verify st1 == 1.4426950*"
-gdb_test "info register st2" "st2 *3.32192.*\[ \t\]+.*" "verify st2 == 3.3219280*"
-gdb_test "info register st3" "st3 *1\[ \t\]+.*"          "verify st3 == 1"
-
-gdb_test "stepi" "asm.*fldln2.*"                  "push st0 == 0.301029*"
-gdb_test "info register st0" "st0 *0.30102.*\[ \t\]+.*" "verify st0 == 0.301029*"
-gdb_test "info register st1" "st1 *3.14159.*\[ \t\]+.*" "verify st1 == 3.14159265*"
-gdb_test "info register st2" "st2 *1.44269.*\[ \t\]+.*" "verify st2 == 1.44269506*"
-gdb_test "info register st3" "st3 *3.32192.*\[ \t\]+.*" "verify st3 == 3.3219280948*"
-gdb_test "info register st4" "st4 *1\[ \t\]+.*"         "verify st4 == 1"
-
-gdb_test "stepi" "asm.*fldz.*"                    "push st0 == 0.69314*"
-gdb_test "info register st0" "st0 *0.69314.*\[ \t\]+.*" "verify st0 == 0.69314*"
-gdb_test "info register st1" "st1 *0.30102.*\[ \t\]+.*" "verify st1 == 0.301029*"
-gdb_test "info register st2" "st2 *3.14159.*\[ \t\]+.*" "verify st2 == 3.14159265*"
-gdb_test "info register st3" "st3 *1.44269.*\[ \t\]+.*" "verify st3 == 1.442695040*"
-gdb_test "info register st4" "st4 *3.32192.*\[ \t\]+.*" "verify st4 == 3.3219280948*"
-gdb_test "info register st5" "st5 *1\[ \t\]+.*"         "verify st5 == 1"
-
-gdb_test "stepi" "asm.*fld1.*"                    "push st0 == 0"
-gdb_test "info register st0" "st0 *0\[ \t\]+.*"         "verify st0 == 0"
-gdb_test "info register st1" "st1 *0.69314.*\[ \t\]+.*" "verify st1 == 0.69314*"
-gdb_test "info register st2" "st2 *0.30102.*\[ \t\]+.*" "verify st2 == 0.301029*"
-gdb_test "info register st3" "st3 *3.14159.*\[ \t\]+.*" "verify st3 == 3.14159265*"
-gdb_test "info register st4" "st4 *1.44269.*\[ \t\]+.*" "verify st4 == 1.442695040*"
-gdb_test "info register st5" "st5 *3.32192.*\[ \t\]+.*" "verify st5 == 3.32192809*"
-gdb_test "info register st6" "st6 *1\[ \t\]+.*"         "verify st6 == 1"
-
-gdb_test "stepi" "asm.*nop.*"                     "push st0 == 0"
-gdb_test "info register st0" "st0 *1\[ \t\]+.*"         "verify st0 == 1"
-gdb_test "info register st1" "st1 *0\[ \t\]+.*"         "verify st1 == 0"
-gdb_test "info register st2" "st2 *0.69314.*\[ \t\]+.*" "verify st2 == 0.69314*"
-gdb_test "info register st3" "st3 *0.30102.*\[ \t\]+.*" "verify st3 == 0.301029*"
-gdb_test "info register st4" "st4 *3.14159.*\[ \t\]+.*" "verify st4 == 3.14159265*"
-gdb_test "info register st5" "st5 *1.44269.*\[ \t\]+.*" "verify st5 == 1.44269504*"
-gdb_test "info register st6" "st6 *3.32192.*\[ \t\]+.*" "verify st6 == 3.3219280948*"
-gdb_test "info register st7" "st7 *1.*"           "verify st7 == 1"
-
-# Now step backward, and check that st0 value reverts to zero.
-
-gdb_test "reverse-stepi" "asm.*fld1.*"            "undo registers, st0-st7"
-gdb_test "info register st0" "st0 *0\[ \t\]+.*"         "verify st0 == 0"
-gdb_test "info register st1" "st1 *0.69314.*\[ \t\]+.*" "verify st1 == 0.69314*"
-gdb_test "info register st2" "st2 *0.30102.*\[ \t\]+.*" "verify st2 == 0.301029*"
-gdb_test "info register st3" "st3 *3.14159.*\[ \t\]+.*" "verify st3 == 3.14159265*"
-gdb_test "info register st4" "st4 *1.44269.*\[ \t\]+.*" "verify st4 == 1.442695040*"
-gdb_test "info register st5" "st5 *3.32192.*\[ \t\]+.*" "verify st5 == 3.3219280948*"
-gdb_test "info register st6" "st6 *1\[ \t\]+.*"         "verify st6 == 1"
-
-gdb_test "reverse-stepi" "asm.*fldz.*"            "push st0 == 0.69314*"
-gdb_test "info register st0" "st0 *0.69314.*\[ \t\]+.*" "verify st0 == 0.69314*"
-gdb_test "info register st1" "st1 *0.30102.*\[ \t\]+.*" "verify st1 == 0.301029*"
-gdb_test "info register st2" "st2 *3.14159.*\[ \t\]+.*" "verify st2 == 3.14159265*"
-gdb_test "info register st3" "st3 *1.44269.*\[ \t\]+.*" "verify st3 == 1.442695040*"
-gdb_test "info register st4" "st4 *3.32192.*\[ \t\]+.*" "verify st4 == 3.3219280948*"
-gdb_test "info register st5" "st5 *1\[ \t\]+.*"       "verify st5 == 1"
-
-gdb_test "reverse-stepi" "asm.*fldln2.*"          "push st0 == 0.301029*"
-gdb_test "info register st0" "st0 *0.30102.*\[ \t\]+.*" "verify st0 == 0.301029*"
-gdb_test "info register st1" "st1 *3.14159.*\[ \t\]+.*" "verify st1 == 3.14159265*"
-gdb_test "info register st2" "st2 *1.44269.*\[ \t\]+.*" "verify st2 == 1.442695040*"
-gdb_test "info register st3" "st3 *3.32192.*\[ \t\]+.*" "verify st3 == 3.3219280948*"
-gdb_test "info register st4" "st4 *1\[ \t\]+.*"         "verify st4 == 1"
-
-gdb_test "reverse-stepi" "asm.*fldlg2.*"          "push st0 == 3.14159265*"
-gdb_test "info register st0" "st0 *3.14159.*\[ \t\]+.*" "verify st0 == 3.14159265*"
-gdb_test "info register st1" "st1 *1.44269.*\[ \t\]+.*" "verify st1 == 1.442695040*"
-gdb_test "info register st2" "st2 *3.32192.*\[ \t\]+.*" "verify st2 == 3.3219280948*"
-gdb_test "info register st3" "st3 *1\[ \t\]+.*"       "verify st3 == 1"
-
-gdb_test "reverse-stepi" "asm.*fldpi.*"           "push st0 == 1.44269504088*"
-gdb_test "info register st0" "st0 *1.44269.*\[ \t\]+.*" "verify st0 == 1.442695040*"
-gdb_test "info register st1" "st1 *3.32192.*\[ \t\]+.*" "verify st1 == 3.3219280948*"
-gdb_test "info register st2" "st2 *1\[ \t\]+.*"         "verify st2 == 1"
-
-
-gdb_test "reverse-stepi" "asm.*fldl2e.*"          "push st0 == 3.3219280948*"
-gdb_test "info register st0" "st0 *3.32192.*\[ \t\]+.*" "verify st0 == 3.3219280948*"
-gdb_test "info register st1" "st1 *1\[ \t\]+.*"         "verify st1 == 1"
-
-gdb_test "reverse-stepi" "asm.*fldl2t.*"      "push st0 == 1"
-gdb_test "info register st0" "st0 *1\[ \t\]+.*"     "verify st0 == 1"                                               
-
-
-
-
+with_test_prefix "forward" {
+    # Test FPU stack. FPU stack includes st0, st1, st2, st3, st4,
+    # st5, st6, st7. We push 8 values to FPU stack in record mode
+    # and see whether all are getting recorded.
+
+    set location [gdb_get_line_number "test st0 register"]
+    gdb_test "until $location" ".*$srcfile:$location.*asm.*fld1.*" \
+       "begin test st0"
+    gdb_test "stepi" "asm.*fldl2t.*"              "push st0 == 1"
+    gdb_test "info register st0" "st0 *1\[ \t\]+.*"     "verify st0 == 1"
+
+    gdb_test "stepi" "asm.*fldl2e.*"              "push st0 == 3.3219280948*"
+    gdb_test "info register st0" "st0 *3.32192.*\[ \t\]+.*" "verify st0 == 3.321928094*"
+    gdb_test "info register st1" "st1 *1\[ \t\]+.*"       "verify st1 == 1"
+
+    gdb_test "stepi" "asm.*fldpi.*"                   "push st0 == 1.4426950406*"
+    gdb_test "info register st0" "st0 *1.44269.*\[ \t\]+.*" "verify st0 == 1.442695040*"
+    gdb_test "info register st1" "st1 *3.32192.*\[ \t\]+.*" "verify st1 == 3.3219280948*"
+    gdb_test "info register st2" "st2 *1\[ \t\]+.*"         "verify st2 == 1"
+
+    gdb_test "stepi" "asm.*fldlg2.*"                  "push st0 == 3.14159265*"
+    gdb_test "info register st0" "st0 *3.14159.*\[ \t\]+.*" "verify st0 == 3.14159265*"
+    gdb_test "info register st1" "st1 *1.44269.*\[ \t\]+.*" "verify st1 == 1.4426950*"
+    gdb_test "info register st2" "st2 *3.32192.*\[ \t\]+.*" "verify st2 == 3.3219280*"
+    gdb_test "info register st3" "st3 *1\[ \t\]+.*"          "verify st3 == 1"
+
+    gdb_test "stepi" "asm.*fldln2.*"                  "push st0 == 0.301029*"
+    gdb_test "info register st0" "st0 *0.30102.*\[ \t\]+.*" "verify st0 == 0.301029*"
+    gdb_test "info register st1" "st1 *3.14159.*\[ \t\]+.*" "verify st1 == 3.14159265*"
+    gdb_test "info register st2" "st2 *1.44269.*\[ \t\]+.*" "verify st2 == 1.44269506*"
+    gdb_test "info register st3" "st3 *3.32192.*\[ \t\]+.*" "verify st3 == 3.3219280948*"
+    gdb_test "info register st4" "st4 *1\[ \t\]+.*"         "verify st4 == 1"
+
+    gdb_test "stepi" "asm.*fldz.*"                    "push st0 == 0.69314*"
+    gdb_test "info register st0" "st0 *0.69314.*\[ \t\]+.*" "verify st0 == 0.69314*"
+    gdb_test "info register st1" "st1 *0.30102.*\[ \t\]+.*" "verify st1 == 0.301029*"
+    gdb_test "info register st2" "st2 *3.14159.*\[ \t\]+.*" "verify st2 == 3.14159265*"
+    gdb_test "info register st3" "st3 *1.44269.*\[ \t\]+.*" "verify st3 == 1.442695040*"
+    gdb_test "info register st4" "st4 *3.32192.*\[ \t\]+.*" "verify st4 == 3.3219280948*"
+    gdb_test "info register st5" "st5 *1\[ \t\]+.*"         "verify st5 == 1"
+
+    gdb_test "stepi" "asm.*fld1.*"                    "push st0 == 0"
+    gdb_test "info register st0" "st0 *0\[ \t\]+.*"         "verify st0 == 0"
+    gdb_test "info register st1" "st1 *0.69314.*\[ \t\]+.*" "verify st1 == 0.69314*"
+    gdb_test "info register st2" "st2 *0.30102.*\[ \t\]+.*" "verify st2 == 0.301029*"
+    gdb_test "info register st3" "st3 *3.14159.*\[ \t\]+.*" "verify st3 == 3.14159265*"
+    gdb_test "info register st4" "st4 *1.44269.*\[ \t\]+.*" "verify st4 == 1.442695040*"
+    gdb_test "info register st5" "st5 *3.32192.*\[ \t\]+.*" "verify st5 == 3.32192809*"
+    gdb_test "info register st6" "st6 *1\[ \t\]+.*"         "verify st6 == 1"
+
+    gdb_test "stepi" "asm.*nop.*"                     "push st0 == 1, again"
+    gdb_test "info register st0" "st0 *1\[ \t\]+.*"         "verify st0 == 1, again"
+    gdb_test "info register st1" "st1 *0\[ \t\]+.*"         "verify st1 == 0"
+    gdb_test "info register st2" "st2 *0.69314.*\[ \t\]+.*" "verify st2 == 0.69314*"
+    gdb_test "info register st3" "st3 *0.30102.*\[ \t\]+.*" "verify st3 == 0.301029*"
+    gdb_test "info register st4" "st4 *3.14159.*\[ \t\]+.*" "verify st4 == 3.14159265*"
+    gdb_test "info register st5" "st5 *1.44269.*\[ \t\]+.*" "verify st5 == 1.44269504*"
+    gdb_test "info register st6" "st6 *3.32192.*\[ \t\]+.*" "verify st6 == 3.3219280948*"
+    gdb_test "info register st7" "st7 *1.*"           "verify st7 == 1"
+}
 
+with_test_prefix "backward" {
+    # Now step backward, and check that st0 value reverts to zero.
+    gdb_test "reverse-stepi" "asm.*fld1.*"            "undo registers, st0-st7"
+    gdb_test "info register st0" "st0 *0\[ \t\]+.*"         "verify st0 == 0"
+    gdb_test "info register st1" "st1 *0.69314.*\[ \t\]+.*" "verify st1 == 0.69314*"
+    gdb_test "info register st2" "st2 *0.30102.*\[ \t\]+.*" "verify st2 == 0.301029*"
+    gdb_test "info register st3" "st3 *3.14159.*\[ \t\]+.*" "verify st3 == 3.14159265*"
+    gdb_test "info register st4" "st4 *1.44269.*\[ \t\]+.*" "verify st4 == 1.442695040*"
+    gdb_test "info register st5" "st5 *3.32192.*\[ \t\]+.*" "verify st5 == 3.3219280948*"
+    gdb_test "info register st6" "st6 *1\[ \t\]+.*"         "verify st6 == 1"
+
+    gdb_test "reverse-stepi" "asm.*fldz.*"            "push st0 == 0.69314*"
+    gdb_test "info register st0" "st0 *0.69314.*\[ \t\]+.*" "verify st0 == 0.69314*"
+    gdb_test "info register st1" "st1 *0.30102.*\[ \t\]+.*" "verify st1 == 0.301029*"
+    gdb_test "info register st2" "st2 *3.14159.*\[ \t\]+.*" "verify st2 == 3.14159265*"
+    gdb_test "info register st3" "st3 *1.44269.*\[ \t\]+.*" "verify st3 == 1.442695040*"
+    gdb_test "info register st4" "st4 *3.32192.*\[ \t\]+.*" "verify st4 == 3.3219280948*"
+    gdb_test "info register st5" "st5 *1\[ \t\]+.*"       "verify st5 == 1"
+
+    gdb_test "reverse-stepi" "asm.*fldln2.*"          "push st0 == 0.301029*"
+    gdb_test "info register st0" "st0 *0.30102.*\[ \t\]+.*" "verify st0 == 0.301029*"
+    gdb_test "info register st1" "st1 *3.14159.*\[ \t\]+.*" "verify st1 == 3.14159265*"
+    gdb_test "info register st2" "st2 *1.44269.*\[ \t\]+.*" "verify st2 == 1.442695040*"
+    gdb_test "info register st3" "st3 *3.32192.*\[ \t\]+.*" "verify st3 == 3.3219280948*"
+    gdb_test "info register st4" "st4 *1\[ \t\]+.*"         "verify st4 == 1"
+
+    gdb_test "reverse-stepi" "asm.*fldlg2.*"          "push st0 == 3.14159265*"
+    gdb_test "info register st0" "st0 *3.14159.*\[ \t\]+.*" "verify st0 == 3.14159265*"
+    gdb_test "info register st1" "st1 *1.44269.*\[ \t\]+.*" "verify st1 == 1.442695040*"
+    gdb_test "info register st2" "st2 *3.32192.*\[ \t\]+.*" "verify st2 == 3.3219280948*"
+    gdb_test "info register st3" "st3 *1\[ \t\]+.*"       "verify st3 == 1"
+
+    gdb_test "reverse-stepi" "asm.*fldpi.*"           "push st0 == 1.44269504088*"
+    gdb_test "info register st0" "st0 *1.44269.*\[ \t\]+.*" "verify st0 == 1.442695040*"
+    gdb_test "info register st1" "st1 *3.32192.*\[ \t\]+.*" "verify st1 == 3.3219280948*"
+    gdb_test "info register st2" "st2 *1\[ \t\]+.*"         "verify st2 == 1"
+
+    gdb_test "reverse-stepi" "asm.*fldl2e.*"          "push st0 == 3.3219280948*"
+    gdb_test "info register st0" "st0 *3.32192.*\[ \t\]+.*" "verify st0 == 3.3219280948*"
+    gdb_test "info register st1" "st1 *1\[ \t\]+.*"         "verify st1 == 1"
+
+    gdb_test "reverse-stepi" "asm.*fldl2t.*"      "push st0 == 1"
+    gdb_test "info register st0" "st0 *1\[ \t\]+.*"     "verify st0 == 1"
+}