public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Thiago Jung Bauermann <thiago.bauermann@linaro.org>
To: gdb-patches@sourceware.org
Cc: Thiago Jung Bauermann <thiago.bauermann@linaro.org>
Subject: [PATCH 0/8] gdbserver improvements for AArch64 SVE support
Date: Thu,  8 Sep 2022 06:41:43 +0000	[thread overview]
Message-ID: <20220908064151.3959930-1-thiago.bauermann@linaro.org> (raw)

Hello,

The aarch64 architecture supports the Scalable Vector Extension, which
provides vector registers and operations that can be used by software in a
way that is agnostic to the size of the vector length actually provided by
the hardware. It also allows programs to change the vector length at
runtime. Also, it's worth noting that each thread in the program can have
a different vector length.

GDB supports debugging programs using SVE, and also supports debugging
programs which change their vector length at runtime. gdbserver, on the
other hand, supports the former but not the latter.

This patch series adds support to gdbserver to allow debugging programs
that change their vector length at runtime. This series makes the test
gdb.arch/aarch64-sve.exp pass on the native-gdbserver and
native-extended-gdbserver boards.

GDB supports different vector lengths by using one target description for
each vector length, and switches target descriptions when it notices that
the vector length of the inferior thread changed. This is done by
aarch64_linux_nat_target::thread_architecture, which returns a gdbarch
reflecting the current vector length.

This patch series' idea is to provide a remote_target::thread_architecture
method so that the same mechanism can be used in the case of remote
debugging. It returns a gdbarch based on the expedited registers seen in
the most recent stop reply.

To arrive at that solution some preparation is necessary. Most patches are
small cleanups or code reorganisation to make review easier. The biggest
change is arguably in patch 5, which changes gdbserver to use per-thread
target descriptions rather than per-process. In practice only the
aarch64-linux target will actually have different per-thread tdescs. All
other targets use the same tdesc in all threads so little is changed.

Since patch 5 touches so many targets, I'm trying to test this series on
some different systems but the only real or virtualized machines I can
test on are {aarch64,x86_64}-{linux,freebsd,netbsd}. I'll also try it out
on QEMU-emulated machines on some other architectures, assuming that's
helpful.

I'm still going through testing (and struggling a bit to get the testsuite
running properly on the BSDs) but these are my results so far:

These targets were regression tested and no regressions were found:

- aarch64-linux on the native-extended-gdbserver board
- x86_64-linux on unix¹ and native-extended-gdbserver boards

These targets build but were not regression tested:

- aarch64-freebsd13.1
- aarch64-netbsd9.3
- arm-linux-gnueabihf
- powerpc-linux
- powerpc64le-linux
- riscv64-linux

The targets corresponding to these files were edited with no testing so
far. I'll test some under QEMU emulation but most will be left untested:

- linux-arc-low.cc
- linux-ia64-low.cc
- linux-loongarch-low.cc
- linux-m68k-low.cc
- linux-mips-low.cc
- linux-nios2-low.cc
- linux-or1k-low.cc
- linux-s390-low.cc
- linux-sh-low.cc
- linux-sparc-low.cc
- linux-tic6x-low.cc
- linux-xtensa-low.cc
- netbsd-amd64-low.cc
- netbsd-i386-low.cc

¹ There's one additional unexpected core file reported on x86_linux
  native, even though the test results are unchanged. I'm looking into it
  and will report back.


Thiago Jung Bauermann (8):
  gdbserver: Add asserts in register_size and register_data functions
  gdbserver: Add thread parameter to linux_get_auxv and linux_get_hwcap
  gdb,gdbserver/aarch64-linux: Allow aarch64_sve_get_vq to return error
  gdbserver/linux-aarch64: Factor out function to get aarch64_features
  gdbserver: Move target description from being per-process to being
    per-thread
  gdbserver/linux-aarch64: When inferior stops, update its target
    description
  gdb/aarch64: Factor out most of the thread_architecture method
  gdb/aarch64: When remote debugging detect changes in the target
    description

 gdb/aarch64-linux-nat.c            |  37 ++++------
 gdb/aarch64-tdep.c                 |  60 ++++++++++++++++
 gdb/aarch64-tdep.h                 |   2 +
 gdb/arch-utils.c                   |   9 +++
 gdb/arch-utils.h                   |   5 ++
 gdb/gdbarch-components.py          |  16 +++++
 gdb/gdbarch-gen.h                  |  11 +++
 gdb/gdbarch.c                      |  23 ++++++
 gdb/nat/aarch64-sve-linux-ptrace.c |  18 +++--
 gdb/nat/aarch64-sve-linux-ptrace.h |   2 +-
 gdb/remote.c                       |  42 +++++++++++
 gdbserver/gdbthread.h              |   2 +
 gdbserver/inferiors.h              |   2 -
 gdbserver/linux-aarch64-low.cc     | 110 +++++++++++++++++++++++++----
 gdbserver/linux-arc-low.cc         |   6 +-
 gdbserver/linux-arm-low.cc         |   6 +-
 gdbserver/linux-ia64-low.cc        |   2 +-
 gdbserver/linux-loongarch-low.cc   |   2 +-
 gdbserver/linux-low.cc             |  62 +++++++++++-----
 gdbserver/linux-low.h              |  15 ++--
 gdbserver/linux-m68k-low.cc        |   2 +-
 gdbserver/linux-mips-low.cc        |   8 +--
 gdbserver/linux-nios2-low.cc       |   2 +-
 gdbserver/linux-or1k-low.cc        |   2 +-
 gdbserver/linux-ppc-low.cc         |  16 ++---
 gdbserver/linux-riscv-low.cc       |   2 +-
 gdbserver/linux-s390-low.cc        |   6 +-
 gdbserver/linux-sh-low.cc          |   2 +-
 gdbserver/linux-sparc-low.cc       |   2 +-
 gdbserver/linux-tic6x-low.cc       |   2 +-
 gdbserver/linux-x86-low.cc         |   2 +-
 gdbserver/linux-xtensa-low.cc      |   2 +-
 gdbserver/netbsd-aarch64-low.cc    |   2 +-
 gdbserver/netbsd-amd64-low.cc      |   2 +-
 gdbserver/netbsd-i386-low.cc       |   2 +-
 gdbserver/netbsd-low.cc            |   4 +-
 gdbserver/netbsd-low.h             |   4 +-
 gdbserver/regcache.cc              |  10 +--
 gdbserver/server.cc                |   2 +-
 gdbserver/target.cc                |   4 +-
 gdbserver/target.h                 |   4 +-
 gdbserver/tdesc.cc                 |   2 +-
 42 files changed, 395 insertions(+), 121 deletions(-)


base-commit: 5edf42b635a375f7bf79e2079529eeb869129cbe

             reply	other threads:[~2022-09-08  6:42 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-08  6:41 Thiago Jung Bauermann [this message]
2022-09-08  6:41 ` [PATCH 1/8] gdbserver: Add asserts in register_size and register_data functions Thiago Jung Bauermann
2022-09-20  7:36   ` Luis Machado
2022-11-26  1:36     ` Thiago Jung Bauermann
2022-09-08  6:41 ` [PATCH 2/8] gdbserver: Add thread parameter to linux_get_auxv and linux_get_hwcap Thiago Jung Bauermann
2022-09-20  7:43   ` Luis Machado
2022-11-26  1:37     ` Thiago Jung Bauermann
2022-09-08  6:41 ` [PATCH 3/8] gdb, gdbserver/aarch64-linux: Allow aarch64_sve_get_vq to return error Thiago Jung Bauermann
2022-09-20  8:07   ` Luis Machado
2022-11-26  1:42     ` Thiago Jung Bauermann
2022-09-08  6:41 ` [PATCH 4/8] gdbserver/linux-aarch64: Factor out function to get aarch64_features Thiago Jung Bauermann
2022-09-20  8:08   ` Luis Machado
2022-11-26  1:44     ` Thiago Jung Bauermann
2022-09-08  6:41 ` [PATCH 5/8] gdbserver: Move target description from being per-process to being per-thread Thiago Jung Bauermann
2022-09-20 11:21   ` Luis Machado
2022-11-26  1:47     ` Thiago Jung Bauermann
2022-09-08  6:41 ` [PATCH 6/8] gdbserver/linux-aarch64: When inferior stops, update its target description Thiago Jung Bauermann
2022-09-20  8:48   ` Luis Machado
2022-11-26  1:49     ` Thiago Jung Bauermann
2022-09-08  6:41 ` [PATCH 7/8] gdb/aarch64: Factor out most of the thread_architecture method Thiago Jung Bauermann
2022-09-20  8:52   ` Luis Machado
2022-11-26  1:49     ` Thiago Jung Bauermann
2022-09-08  6:41 ` [PATCH 8/8] gdb/aarch64: When remote debugging detect changes in the target description Thiago Jung Bauermann
2022-09-20  8:59   ` Luis Machado
2022-11-26  1:50     ` Thiago Jung Bauermann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220908064151.3959930-1-thiago.bauermann@linaro.org \
    --to=thiago.bauermann@linaro.org \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).