[PATCH 0/8] Add SVE support for Aarch64 GDB

Alan Hayward
2018-05-11T10:53:07Z

This set of patches adds gdb support for SVE on AArch64.

SVE is the new vector extension for Aarch64. SVE is different in that the
length of a vector register is not fixed - it is can vary for different
hardware implementors. All code compiled for SVE is vector length agnostic.
The Linux kernel can then further restrict the vector length up to the
supported maximum for the hardware. Potentially different process and
threads can have different vector lengths, and they could change at any
time. However, in practice, we expect the vector length to remain constant
across the lifetime of a process.
This set of patches assumes the vector length will not change and either
warns once (when reading registers) or errors (when writing registers) if the
vector length has changed. A future set of patches will offer full support.

This series does not support gdbserver. However, where it makes sense I have
commonised as much code as possible and have added the groundwork in
gdbserver. Enabling gdbserver should be a small set of additional patches.

Core files and watchpoints are not yet supported.

The vector length is read from ptrace and is required to create the target
description for the running process. There is no hardcoded SVE XML.

The patches require recent linux header files for all the SVE ptrace macros.
To allow builds for older headers, I've added all required macros and
structures within ifdef checks. I'm not sure if this is the ideal solution.
When including kernel header code, I've not performed any reformatting (ie
they are not in GNU style).

One of the later patches adds functions to gdbserver regcache so that I can
add common functionality that works on gdb and gdbserver.

Given there are no working SVE systems available today, this was manually
tested on an Aarch64 SVE emulator running Ubuntu. In addition I've run make
check on X86 and Aarch64 builds for both unix and native-gdbserver.

Alan.

Alan Hayward (8):
Add Aarch64 SVE target description
Function for reading the Aarch64 SVE vector length.
Add SVE register defines
Enable SVE for GDB
Add aarch64 psuedo help functions
Aarch64 SVE pseudo register support
Add methods to gdbserver regcache and raw_compare
Ptrace support for Aarch64 SVE

gdb/Makefile.in | 1 +
gdb/aarch64-linux-nat.c | 60 +++++-
gdb/aarch64-linux-tdep.c | 5 +-
gdb/aarch64-tdep.c | 402 +++++++++++++++++++++++-------------
gdb/aarch64-tdep.h | 12 +-
gdb/arch/aarch64.c | 12 +-
gdb/arch/aarch64.h | 37 +++-
gdb/configure.nat | 2 +-
gdb/doc/gdb.texinfo | 4 +
gdb/features/aarch64-sve.c | 158 ++++++++++++++
gdb/gdbserver/Makefile.in | 1 +
gdb/gdbserver/configure.srv | 1 +
gdb/gdbserver/linux-aarch64-tdesc.c | 3 +-
gdb/gdbserver/regcache.c | 55 ++++-
gdb/gdbserver/regcache.h | 8 +
gdb/nat/aarch64-sve-linux-ptrace.c | 315 ++++++++++++++++++++++++++++
gdb/nat/aarch64-sve-linux-ptrace.h | 193 +++++++++++++++++
gdb/regcache.c | 17 ++
gdb/regcache.h | 2 +
19 files changed, 1122 insertions(+), 166 deletions(-)
create mode 100644 gdb/features/aarch64-sve.c
create mode 100644 gdb/nat/aarch64-sve-linux-ptrace.c
create mode 100644 gdb/nat/aarch64-sve-linux-ptrace.h

--
2.15.1 (Apple Git-101)