[v5,0/7] Support for recording some AVX instructions

Message ID 20241023165117.4051131-1-guinevere@redhat.com
Headers
Series Support for recording some AVX instructions |

Message

Guinevere Larsen Oct. 23, 2024, 4:51 p.m. UTC
  This patch is the third version of adding support to record and replay
AVX instructions on x86 and x86_64 CPUs. This version has one more
preparatory patch, as the record subsystem could read pseudo registers
(like ymm). After this patch series, GDB should be able to fully record
__memset_avx2_unaligned_erms from glibc!

For rationale, supporting AVX instructions is important since glibc
has been shipping functions that use them for a long time, meaning
most standard library functions would not be supported by record,
which is a big inconvenience for end users.

The first patch of the series makes GDB aware that it can read pseudo
registers freom executing and replaying threads, no user-visible
changes expected. The second adds the capability for the main i386 record
function to identify and read VEX prefixes, but doesn't add support for
any instruction yet, so minimal user visible changes (only a slight
tweak to an error message). The remaining patches add support to related
instruction, and tests those instructions.

Since this series only supports a very small subset of avx instructions,
I am not sure if I should add a NEWS entry (and what to put in it if I
should).

Changes for v5:
* the new function record_full_is_replaying now uses dynamic_cast to
  check if the record-full target is enabled.

Guinevere Larsen (7):
  gdb: Allow replayed threads to read and write pseudo registers
  gdb: Start supporting AVX instruction
  gdb/record: add support to vmovd and vmovq instructions
  gdb/record: add support to AVX unpack instructions
  gdb/record: Add recording support to vpbroadcast instructions
  gdb/record: support AVX instructions VMOVDQ(U|A) when recording
  gdb/record: add support to vzeroupper instruction

 gdb/amd64-tdep.c                              |   3 +-
 gdb/i386-tdep.c                               | 268 +++++++++++++-
 gdb/i386-tdep.h                               |   1 +
 gdb/record-full.c                             |  11 +-
 gdb/record-full.h                             |   3 +
 gdb/testsuite/gdb.reverse/i386-avx-reverse.c  | 234 ++++++++++++
 .../gdb.reverse/i386-avx-reverse.exp          | 333 ++++++++++++++++++
 gdb/testsuite/gdb.reverse/step-precsave.exp   |   4 +-
 gdb/thread.c                                  |  15 +-
 9 files changed, 864 insertions(+), 8 deletions(-)
 create mode 100644 gdb/testsuite/gdb.reverse/i386-avx-reverse.c
 create mode 100644 gdb/testsuite/gdb.reverse/i386-avx-reverse.exp
  

Comments

Tom Tromey Oct. 25, 2024, 3:46 p.m. UTC | #1
>>>>> "Guinevere" == Guinevere Larsen <guinevere@redhat.com> writes:

Guinevere> The first patch of the series makes GDB aware that it can read pseudo
Guinevere> registers freom executing and replaying threads, no user-visible
Guinevere> changes expected. The second adds the capability for the main i386 record
Guinevere> function to identify and read VEX prefixes, but doesn't add support for
Guinevere> any instruction yet, so minimal user visible changes (only a slight
Guinevere> tweak to an error message). The remaining patches add support to related
Guinevere> instruction, and tests those instructions.

FWIW these look fine to me.
I didn't really review the target-dependent parts in detail, like I
didn't look up instruction encodings or anything like that.

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

Tom
  
Guinevere Larsen Oct. 28, 2024, 1:52 p.m. UTC | #2
On 10/25/24 12:46 PM, Tom Tromey wrote:
>>>>>> "Guinevere" == Guinevere Larsen <guinevere@redhat.com> writes:
> Guinevere> The first patch of the series makes GDB aware that it can read pseudo
> Guinevere> registers freom executing and replaying threads, no user-visible
> Guinevere> changes expected. The second adds the capability for the main i386 record
> Guinevere> function to identify and read VEX prefixes, but doesn't add support for
> Guinevere> any instruction yet, so minimal user visible changes (only a slight
> Guinevere> tweak to an error message). The remaining patches add support to related
> Guinevere> instruction, and tests those instructions.
>
> FWIW these look fine to me.
> I didn't really review the target-dependent parts in detail, like I
> didn't look up instruction encodings or anything like that.
>
> Approved-By: Tom Tromey <tom@tromey.com>

Thanks for the review!

I've pushed this! If there is something I missed related to the 
target-specific parts, the test should let us find it easily and figure 
out what's up.