[gdb/testsuite] Check avx support in gdb.arch/amd64-disp-step-avx.exp
authorTom de Vries <tdevries@suse.de>
Sat, 4 Sep 2021 10:11:35 +0000 (12:11 +0200)
committerTom de Vries <tdevries@suse.de>
Sat, 4 Sep 2021 10:11:35 +0000 (12:11 +0200)
commita6e40b53ef7b4b6f73b97e3fcbe158d07dbb9a63
tree3565577f5a75084c74f02efc1cd93a2e589b270d
parent76c001c234c335b4836c41b35007b167e183f7f8
[gdb/testsuite] Check avx support in gdb.arch/amd64-disp-step-avx.exp

On a machine on Open Build Service I'm running into a SIGILL for test-case
gdb.arch/amd64-disp-step-avx.exp:
...
Program received signal SIGILL, Illegal instruction.^M
test_rip_vex2 () at gdb.arch/amd64-disp-step-avx.S:40^M
40              vmovsd ro_var(%rip),%xmm0^M
(gdb) FAIL: gdb.arch/amd64-disp-step-avx.exp: vex2: \
  continue to test_rip_vex2_end
...
The SIGILL happens when trying to execute the first avx instruction in the
executable.

I can't directly access the machine, but looking at the log for test-case
gdb.arch/i386-avx.exp, it seems that there's no avx support:
...
Breakpoint 1, main (argc=1, argv=0x7fffffffd6b8) at gdb.arch/i386-avx.c:68^M
68        if (have_avx ())^M
(gdb) print have_avx ()^M
$1 = 0^M
...

Fix this by:
- adding a gdb_caching_proc have_avx, similar to have_mpx, using the have_avx
  function from gdb.arch/i386-avx.c
- using proc have_avx in both gdb/testsuite/gdb.arch/amd64-disp-step-avx.exp
  and gdb/testsuite/gdb.arch/i386-avx.exp.

Tested on my x86_64-linux laptop with avx support, where both test-cases pass.

gdb/testsuite/ChangeLog:

2021-09-04  Tom de Vries  <tdevries@suse.de>

PR testsuite/26950
* gdb/testsuite/gdb.arch/i386-avx.c (main): Remove call to have_avx.
(have_avx): Move ...
* gdb/testsuite/lib/gdb.exp (have_avx): ... here.  New proc.
* gdb/testsuite/gdb.arch/amd64-disp-step-avx.exp: Use have_avx.
* gdb/testsuite/gdb.arch/i386-avx.exp: Same.
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.arch/amd64-disp-step-avx.exp
gdb/testsuite/gdb.arch/i386-avx.c
gdb/testsuite/gdb.arch/i386-avx.exp
gdb/testsuite/lib/gdb.exp
This page took 0.025808 seconds and 4 git commands to generate.