gdb/testsuite: recognize one more unsupported instruction in gdb.reverse/step-precsave.exp

Message ID 20230829161906.66526-1-simon.marchi@efficios.com
State New
Headers
Series gdb/testsuite: recognize one more unsupported instruction in gdb.reverse/step-precsave.exp |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 warning Patch is already merged
linaro-tcwg-bot/tcwg_gdb_build--master-arm warning Patch is already merged
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 warning Patch is already merged
linaro-tcwg-bot/tcwg_gdb_check--master-arm warning Patch is already merged

Commit Message

Simon Marchi Aug. 29, 2023, 4:19 p.m. UTC
  When running this test on a processor that supports AVX512 (AMD EPYC
9634) on Debian 12 bookwork (system compiler is gcc 12.2.0), I see:

    continue^M
    Continuing.^M
    Process record does not support instruction bound.^M
    Process record does not support instruction 0x62 at address 0x7ffff7f49b40.^M
    Process record: failed to record execution log.^M
    ^M
    Program stopped.^M
    0x00007ffff7f49b40 in ?? () from /lib/x86_64-linux-gnu/libc.so.6^M
    (gdb) FAIL: gdb.reverse/step-precsave.exp: run to end of main

The instruction at this address is:

   0x00007ffff7f49b40:	62 e2 7d 48 7a c6   vpbroadcastb %esi,%zmm16

This seems like an AVX512 instruction (given the use of zmm16).  Match
this byte value in order to produce a KFAIL.

Change-Id: I1d20357fa538ba60b9c537160acf511a37d751ee
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30807
---
 gdb/testsuite/gdb.reverse/step-precsave.exp | 3 +++
 1 file changed, 3 insertions(+)


base-commit: 8468e03688622f265529699e2efd355a4c122cc6
  

Comments

Tom Tromey Aug. 29, 2023, 4:58 p.m. UTC | #1
>>>>> "Simon" == Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> writes:

Simon> The instruction at this address is:
Simon>    0x00007ffff7f49b40:	62 e2 7d 48 7a c6   vpbroadcastb %esi,%zmm16
Simon> This seems like an AVX512 instruction (given the use of zmm16).  Match
Simon> this byte value in order to produce a KFAIL.

Seems fine to me.

I often wonder if this code is maintained and/or useful.

Approved-By: Tom Tromey <tom@tromey.com>

Tom
  
Simon Marchi Aug. 29, 2023, 5:43 p.m. UTC | #2
On 8/29/23 12:58, Tom Tromey wrote:
>>>>>> "Simon" == Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> writes:
> 
> Simon> The instruction at this address is:
> Simon>    0x00007ffff7f49b40:	62 e2 7d 48 7a c6   vpbroadcastb %esi,%zmm16
> Simon> This seems like an AVX512 instruction (given the use of zmm16).  Match
> Simon> this byte value in order to produce a KFAIL.
> 
> Seems fine to me.
> 
> I often wonder if this code is maintained and/or useful.

The built-in reverse code?  I would call it unmaintained.  Whether it is
useful or not for some people, I don't know.  For real world use cases
I try to use rr.

> Approved-By: Tom Tromey <tom@tromey.com>

Thanks, will push.

Simon
  
John Baldwin Aug. 29, 2023, 7:41 p.m. UTC | #3
On 8/29/23 9:19 AM, Simon Marchi via Gdb-patches wrote:
> When running this test on a processor that supports AVX512 (AMD EPYC
> 9634) on Debian 12 bookwork (system compiler is gcc 12.2.0), I see:
> 
>      continue^M
>      Continuing.^M
>      Process record does not support instruction bound.^M
>      Process record does not support instruction 0x62 at address 0x7ffff7f49b40.^M
>      Process record: failed to record execution log.^M
>      ^M
>      Program stopped.^M
>      0x00007ffff7f49b40 in ?? () from /lib/x86_64-linux-gnu/libc.so.6^M
>      (gdb) FAIL: gdb.reverse/step-precsave.exp: run to end of main
> 
> The instruction at this address is:
> 
>     0x00007ffff7f49b40:	62 e2 7d 48 7a c6   vpbroadcastb %esi,%zmm16
> 
> This seems like an AVX512 instruction (given the use of zmm16).  Match
> this byte value in order to produce a KFAIL.

Note that 0x62 is the prefix byte for EVEX and is used by all instructions
using EVEX encoding.  (EVEX is used for AVX512 as it expands the register
selector fields in x86 instructions to 5 bits instead of 4, so you have to
use it for zmm16-31.  I think Intel's recent APX or whatever it's called
that adds 16 more GPRs also uses EVEX encoding for existing instructions
like ADD, etc. to support r16 - r31.)

That's just to say that matching on 0x62 is probably a rather broad match
that might match on all sorts of other instructions in the future.
  
Simon Marchi Aug. 30, 2023, 1:20 a.m. UTC | #4
> Note that 0x62 is the prefix byte for EVEX and is used by all instructions
> using EVEX encoding.  (EVEX is used for AVX512 as it expands the register
> selector fields in x86 instructions to 5 bits instead of 4, so you have to
> use it for zmm16-31.  I think Intel's recent APX or whatever it's called
> that adds 16 more GPRs also uses EVEX encoding for existing instructions
> like ADD, etc. to support r16 - r31.)
> 
> That's just to say that matching on 0x62 is probably a rather broad match
> that might match on all sorts of other instructions in the future.

Thanks for the insights!  So just from the message, there wouldn't be a
way to differentiate hitting an AVX512 instruction (like the one I saw)
from hitting another instruction that happens to use that EVEX encoding
(the messages would be the same).  But for this case of emitting a
kfail, I don't think it matters, the result is the same.

Simon
  
Guinevere Larsen Aug. 30, 2023, 7:46 a.m. UTC | #5
On 29/08/2023 19:43, Simon Marchi via Gdb-patches wrote:
> On 8/29/23 12:58, Tom Tromey wrote:
>>>>>>> "Simon" == Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> writes:
>> Simon> The instruction at this address is:
>> Simon>    0x00007ffff7f49b40:	62 e2 7d 48 7a c6   vpbroadcastb %esi,%zmm16
>> Simon> This seems like an AVX512 instruction (given the use of zmm16).  Match
>> Simon> this byte value in order to produce a KFAIL.
>>
>> Seems fine to me.
>>
>> I often wonder if this code is maintained and/or useful.
> The built-in reverse code?  I would call it unmaintained.  Whether it is
> useful or not for some people, I don't know.  For real world use cases
> I try to use rr.
>
If I understand rr correctly (which I might not, I just used it a bit, 
never looked at the actual code), the only thing it does is record. RR 
still uses GDB to control inferior execution backwards, so we still need 
to maintain the execution (and tests) part of GDB working, and the best 
way to do that is keeping the ability to record, so our tests can be run 
without external recording packages.
  

Patch

diff --git a/gdb/testsuite/gdb.reverse/step-precsave.exp b/gdb/testsuite/gdb.reverse/step-precsave.exp
index e2971621c57b..ca0e848c8575 100644
--- a/gdb/testsuite/gdb.reverse/step-precsave.exp
+++ b/gdb/testsuite/gdb.reverse/step-precsave.exp
@@ -52,6 +52,9 @@  with_timeout_factor 20 {
 	-re -wrap "Process record does not support instruction 0xfae64 at.*" {
 	    kfail "record/25038" $gdb_test_name
 	}
+	-re -wrap "Process record does not support instruction 0x62 at.*" {
+	    kfail "record/30807" $gdb_test_name
+	}
     }
 }