public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug testsuite/26950] New: FAIL: gdb.arch/amd64-disp-step-avx.exp: vex2: continue to test_rip_vex2_end
@ 2020-11-26 12:20 vries at gcc dot gnu.org
  2020-11-27  8:47 ` [Bug testsuite/26950] " vries at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: vries at gcc dot gnu.org @ 2020-11-26 12:20 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=26950

            Bug ID: 26950
           Summary: FAIL: gdb.arch/amd64-disp-step-avx.exp: vex2: continue
                    to test_rip_vex2_end
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: testsuite
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

I'm running into:
...
[displaced] displaced_step_restore: restored process 115981 0x400182^M
^M
Program received signal SIGILL, Illegal instruction.^M
test_rip_vex2 () at
/tmp/tdevries/src/gdb/testsuite/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 thing being tested here is vex encoding, which is an avx feature:
...
/* Test a VEX2-encoded RIP-relative instruction.  */

        .global test_rip_vex2
test_rip_vex2:
        vmovsd ro_var(%rip),%xmm0
        .global test_rip_vex2
test_rip_vex2_end:
        nop

...

The cpu has no avx support:
...
$ cat /proc/cpuinfo  | grep flags
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov
pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm
constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc
aperfmperf eagerfpu pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm
dca sse4_1 sse4_2 x2apic popcnt lahf_lm dtherm rsb_ctxsw retpoline kaiser
tpr_shadow vnmi flexpriority ept vpid
...

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug testsuite/26950] FAIL: gdb.arch/amd64-disp-step-avx.exp: vex2: continue to test_rip_vex2_end
  2020-11-26 12:20 [Bug testsuite/26950] New: FAIL: gdb.arch/amd64-disp-step-avx.exp: vex2: continue to test_rip_vex2_end vries at gcc dot gnu.org
@ 2020-11-27  8:47 ` vries at gcc dot gnu.org
  2021-09-04  8:44 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: vries at gcc dot gnu.org @ 2020-11-27  8:47 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=26950

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
Tentative patch, borrows code from i386-avx.c:
...
diff --git a/gdb/testsuite/gdb.arch/amd64-disp-step-avx.exp
b/gdb/testsuite/gdb.arch/amd64-disp-step-avx.exp
index 5dd827a..f720ceb 100644
--- a/gdb/testsuite/gdb.arch/amd64-disp-step-avx.exp
+++ b/gdb/testsuite/gdb.arch/amd64-disp-step-avx.exp
@@ -23,6 +23,11 @@ if { ![istarget x86_64-*-* ] || ![is_lp64_target] } {
     return
 }

+if { ![have_avx] } {
+    verbose "Skipping x86_64 displaced stepping tests."
+    return
+}
+
 standard_testfile .S

 set options [list debug \
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index f2954fd..70f2a92 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -3117,6 +3117,47 @@ gdb_caching_proc skip_tsx_tests {
     return $skip_tsx_tests
 }

+gdb_caching_proc have_avx {
+    global srcdir subdir gdb_prompt inferior_exited_re
+
+    set me "have_avx"
+    if { ![istarget "i?86-*-*"] && ![istarget "x86_64-*-*"] } {
+        verbose "$me: target does not support avx, returning 1" 2
+        return 0
+    }
+
+    # Compile a test program.
+    set src {
+       #include "nat/x86-cpuid.h"
+
+        int main() {
+           unsigned int eax, ebx, ecx, edx;
+
+           if (!x86_cpuid (1, &eax, &ebx, &ecx, &edx))
+               return 0;
+
+           if ((ecx & (bit_AVX | bit_OSXSAVE)) == (bit_AVX | bit_OSXSAVE))
+               return 1;
+           else
+               return 0;
+        }
+    }
+    set compile_flags "incdir=${srcdir}/.."
+    if {![gdb_simple_compile $me $src executable $compile_flags]} {
+        return 0
+    }
+
+    set code [catch {exec "$obj"} results options]
+    puts "results: $results"
+    puts "code: $code"
+
+    remote_file build delete $obj
+
+    verbose "$me:  returning $code" 2
+    return $code
+}
+
+
 # Run a test on the target to see if it supports avx512bf16.  Return 0 if so,
 # 1 if it does not.  Based on 'check_vmx_hw_available' from the GCC testsuite.

...

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug testsuite/26950] FAIL: gdb.arch/amd64-disp-step-avx.exp: vex2: continue to test_rip_vex2_end
  2020-11-26 12:20 [Bug testsuite/26950] New: FAIL: gdb.arch/amd64-disp-step-avx.exp: vex2: continue to test_rip_vex2_end vries at gcc dot gnu.org
  2020-11-27  8:47 ` [Bug testsuite/26950] " vries at gcc dot gnu.org
@ 2021-09-04  8:44 ` cvs-commit at gcc dot gnu.org
  2021-09-04 10:11 ` cvs-commit at gcc dot gnu.org
  2021-09-04 10:12 ` vries at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-09-04  8:44 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=26950

--- Comment #2 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tom de Vries <vries@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=10f3fbece94463282d293305de5ac7381c326e3b

commit 10f3fbece94463282d293305de5ac7381c326e3b
Author: Tom de Vries <tdevries@suse.de>
Date:   Sat Sep 4 10:44:10 2021 +0200

    [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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug testsuite/26950] FAIL: gdb.arch/amd64-disp-step-avx.exp: vex2: continue to test_rip_vex2_end
  2020-11-26 12:20 [Bug testsuite/26950] New: FAIL: gdb.arch/amd64-disp-step-avx.exp: vex2: continue to test_rip_vex2_end vries at gcc dot gnu.org
  2020-11-27  8:47 ` [Bug testsuite/26950] " vries at gcc dot gnu.org
  2021-09-04  8:44 ` cvs-commit at gcc dot gnu.org
@ 2021-09-04 10:11 ` cvs-commit at gcc dot gnu.org
  2021-09-04 10:12 ` vries at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-09-04 10:11 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=26950

--- Comment #3 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The gdb-11-branch branch has been updated by Tom de Vries
<vries@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=a6e40b53ef7b4b6f73b97e3fcbe158d07dbb9a63

commit a6e40b53ef7b4b6f73b97e3fcbe158d07dbb9a63
Author: Tom de Vries <tdevries@suse.de>
Date:   Sat Sep 4 12:11:35 2021 +0200

    [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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug testsuite/26950] FAIL: gdb.arch/amd64-disp-step-avx.exp: vex2: continue to test_rip_vex2_end
  2020-11-26 12:20 [Bug testsuite/26950] New: FAIL: gdb.arch/amd64-disp-step-avx.exp: vex2: continue to test_rip_vex2_end vries at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2021-09-04 10:11 ` cvs-commit at gcc dot gnu.org
@ 2021-09-04 10:12 ` vries at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: vries at gcc dot gnu.org @ 2021-09-04 10:12 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=26950

Tom de Vries <vries at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
   Target Milestone|---                         |11.1
             Status|NEW                         |RESOLVED

--- Comment #4 from Tom de Vries <vries at gcc dot gnu.org> ---
Patch committed to trunk and gdb-11-branch, marking resolved-fixed.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-09-04 10:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-26 12:20 [Bug testsuite/26950] New: FAIL: gdb.arch/amd64-disp-step-avx.exp: vex2: continue to test_rip_vex2_end vries at gcc dot gnu.org
2020-11-27  8:47 ` [Bug testsuite/26950] " vries at gcc dot gnu.org
2021-09-04  8:44 ` cvs-commit at gcc dot gnu.org
2021-09-04 10:11 ` cvs-commit at gcc dot gnu.org
2021-09-04 10:12 ` vries at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).