[gdb/testsuite] Handle SIGILL in two gdb.arch powerpc test-cases
authorTom de Vries <tdevries@zinfandel-3.arch.suse.de>
Tue, 2 Nov 2021 17:55:32 +0000 (18:55 +0100)
committerTom de Vries <tdevries@suse.de>
Tue, 2 Nov 2021 17:55:32 +0000 (18:55 +0100)
On powerpc64le-linux, with test-case gdb.arch/powerpc-addpcis.exp I run into
SIGILL:
...
(gdb) PASS: gdb.arch/powerpc-addpcis.exp: get hexadecimal valueof "$r3"
stepi^M
^M
Program terminated with signal SIGILL, Illegal instruction.^M
The program no longer exists.^M
(gdb) PASS: gdb.arch/powerpc-addpcis.exp: set r4
...
because it's a power9 insn, and I'm running on a power8 machine.

Fix this by handling the SIGILL.  Likewise in gdb.arch/powerpc-lnia.exp.

Tested on powerpc64le-linux.

gdb/testsuite/gdb.arch/powerpc-addpcis.exp
gdb/testsuite/gdb.arch/powerpc-lnia.exp

index d1bc7f49ce6bbba9b29ba033f8dee290253681ab..ff7052ce475853c32ea9773b7d56eddf2334ea95 100644 (file)
@@ -50,7 +50,19 @@ gdb_breakpoint $bp1
 gdb_breakpoint $bp2
 gdb_breakpoint $bp3
 
-gdb_test "stepi" "" "set r3 "
+set insn_supported 1
+gdb_test_multiple "stepi" "set r3" {
+    -re "Program received signal SIGILL, Illegal instruction\\..*" {
+       set insn_supported 0
+    }
+    -re -wrap "" {
+       pass $gdb_test_name
+    }
+}
+if { ! $insn_supported } {
+    unsupported "illegal instruction"
+    return
+}
 set check_r3 [get_hexadecimal_valueof "\$r3" "default0"]
 gdb_test "stepi" "" "set r4"
 set check_r4 [get_hexadecimal_valueof "\$r4" "default0"]
index 0f56d8340468db2a2ab38767b5f1c5ed2aa69326..4ab4f8d92be635f0cc30ab026f43b29fe179b499 100644 (file)
@@ -54,7 +54,19 @@ gdb_breakpoint $bp3
 
 # single-step through the lnia instructions, and retrieve the
 # register values as we proceed.
-gdb_test "stepi" "" "set r3"
+set insn_supported 1
+gdb_test_multiple "stepi" "set r3" {
+    -re "Program received signal SIGILL, Illegal instruction\\..*" {
+       set insn_supported 0
+    }
+    -re -wrap "" {
+       pass $gdb_test_name
+    }
+}
+if { ! $insn_supported } {
+    unsupported "illegal instruction"
+    return
+}
 set check_r3 [get_hexadecimal_valueof "\$r3" "default0"]
 gdb_test "stepi" "" "set r4"
 set check_r4 [get_hexadecimal_valueof "\$r4" "default0"]