]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit - gdb/testsuite/ChangeLog-2014-2021
[gdb/testsuite] Handle SIGILL in gdb.reverse/insn-reverse.exp
authorTom de Vries <tdevries@suse.de>
Fri, 4 Dec 2020 12:36:47 +0000 (13:36 +0100)
committerTom de Vries <tdevries@suse.de>
Fri, 4 Dec 2020 12:36:47 +0000 (13:36 +0100)
commit9c027c2f6c5cdb3db0b8c72c06b691c5ba502279
treed185e8438ffe0a6ffc0ff28551e33249cc02c4cc
parentc524d11e50729ac1a14ac1e749d9a5c459881391
[gdb/testsuite] Handle SIGILL in gdb.reverse/insn-reverse.exp

Consider test-case gdb.reverse/insn-reverse.exp.

It runs a number of subtests, dependent on the architecture, f.i. for
x86_64 it runs subtests rdrand and rdseed.

For each subtest, it checks whether the subtest is supported and otherwise
bails out of that subtest.

However, there may be a problem with the support test or the information it
relies on, and if it states that a subtest is supported while it is actually
not, we may run into a SIGILL, as f.i. described in PR21166, which results in
tcl errors like this:
...
ERROR: tcl error sourcing src/gdb/testsuite/gdb.reverse/insn-reverse.exp.
ERROR: can't read "insn_array(5)": no such element in array
...

We can emulate this by inserting a sigfpe in function rdrand in
insn-reverse-x86.c, like this:
...
  volatile int a = 0; volatile int b = 1; volatile int c = b / a;
...

The problem is that the loop in the test-case attempts to stepi over of all
insn in rdrand, but because of the signal it will never get to the last insn.

Handle this by detecting that the stepi made no progress, and bailing out of
the loop.

Furthermore, make running of the subtests independent, such that a SIGILL in
subtest rdrand does not affect running of subtest rdseed.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2020-12-04  Tom de Vries  <tdevries@suse.de>

* gdb.reverse/insn-reverse.c (test_nr): New var.
(usage, parse_args): New function.
(main): Call parse_args.  Only run test for test_nr.
* gdb.reverse/insn-reverse.exp: Detect lack of progress in stepi loop
and bail out.  Run subtests individually, using an inferior arg
specifying the subtest.
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.reverse/insn-reverse.c
gdb/testsuite/gdb.reverse/insn-reverse.exp