[PATCH 00/12] Concurrent displaced stepping

Simon Marchi via Gdb-patches
2020-11-10T21:46:20Z

This patch series changes GDB to allow concurrent displaced steps to
occur simultanesously in a single inferior. The goal is to reduce the
bottleneck in applications that need to do many displaced steps at the
same time.

Patches 09, 11 and 12 are the main ones implementing the feature. The
other ones are mostly preparatory patches to reduce the diff and
complexity in the main ones.

At the end of the series, GDB uses two displaced stepping buffers when
debugging an AMD64/Linux program, so is able to execute two displaced
steps at a time. There isn't a super significant performance
improvement as a result. However, this work was done in the context of
ROCm GDB [1], where we have as many displaced step buffers as there are
threads. In this context, it makes a huge difference. So, the feature
isn't absolutely necessary on AMD64/Linux, but it is there at least to
have one reference implementation of an architecture in upstream using
multiple displaced step buffers, so that it's possible to test the
feature with common hardware.

This was regtested on x86-64 Ubuntu 20.04 using the unix,
native-gdbserver and native-extended-gdbserver boards.

[1] https://github.com/ROCm-Developer-Tools/ROCgdb

Simon Marchi (12):
gdb: add inferior_execd observable
gdb: clear inferior displaced stepping state on exec
gdb: rename things related to step over chains
gdb: rename displaced_step_closure to displaced_step_copy_insn_closure
gdb: rename displaced_step_fixup to displaced_step_finish
gdb: introduce status enum for displaced step prepare/finish
gdb: pass inferior to get_linux_inferior_data
gdb: move displaced stepping types to displaced-stepping.{h,c}
gdb: move displaced stepping logic to gdbarch, allow starting
concurrent displaced steps
gdb: change linux gdbarch data from post to pre-init
gdb: make displaced stepping implementation capable of managing
multiple buffers
gdb: use two displaced step buffers on amd64/Linux

gdb/Makefile.in | 1 +
gdb/aarch64-linux-tdep.c | 3 +-
gdb/aarch64-tdep.c | 18 +-
gdb/aarch64-tdep.h | 5 +-
gdb/alpha-linux-tdep.c | 2 +-
gdb/amd64-linux-tdep.c | 11 +-
gdb/amd64-tdep.c | 23 +-
gdb/amd64-tdep.h | 9 +-
gdb/arc-linux-tdep.c | 2 +-
gdb/arm-linux-tdep.c | 19 +-
gdb/arm-tdep.c | 183 +++----
gdb/arm-tdep.h | 18 +-
gdb/bfin-linux-tdep.c | 2 +-
gdb/cris-linux-tdep.c | 2 +-
gdb/csky-linux-tdep.c | 2 +-
gdb/displaced-stepping.c | 289 +++++++++++
gdb/displaced-stepping.h | 200 ++++++++
gdb/frv-linux-tdep.c | 2 +-
gdb/gdbarch.c | 117 ++++-
gdb/gdbarch.h | 47 +-
gdb/gdbarch.sh | 26 +-
gdb/gdbthread.h | 35 +-
gdb/hppa-linux-tdep.c | 2 +-
gdb/i386-linux-tdep.c | 31 +-
gdb/i386-tdep.c | 14 +-
gdb/i386-tdep.h | 12 +-
gdb/ia64-linux-tdep.c | 2 +-
gdb/inferior.h | 1 +
gdb/infrun.c | 449 ++++++++----------
gdb/infrun.h | 84 +---
gdb/jit.c | 9 +-
gdb/jit.h | 7 -
gdb/linux-tdep.c | 114 ++++-
gdb/linux-tdep.h | 27 +-
gdb/m32r-linux-tdep.c | 2 +-
gdb/m68k-linux-tdep.c | 2 +-
gdb/microblaze-linux-tdep.c | 2 +-
gdb/mips-linux-tdep.c | 2 +-
gdb/mn10300-linux-tdep.c | 2 +-
gdb/nios2-linux-tdep.c | 2 +-
gdb/observable.c | 1 +
gdb/observable.h | 3 +
gdb/or1k-linux-tdep.c | 2 +-
gdb/ppc-linux-tdep.c | 5 +-
gdb/riscv-linux-tdep.c | 2 +-
gdb/rs6000-aix-tdep.c | 6 +-
gdb/rs6000-tdep.c | 94 +++-
gdb/s390-linux-tdep.c | 2 +-
gdb/s390-tdep.c | 22 +-
gdb/sh-linux-tdep.c | 2 +-
gdb/solib.c | 4 +
gdb/sparc-linux-tdep.c | 2 +-
gdb/sparc64-linux-tdep.c | 2 +-
.../gdb.arch/amd64-disp-step-avx.exp | 2 +-
.../forking-threads-plus-breakpoint.exp | 2 +-
.../gdb.threads/non-stop-fair-events.exp | 2 +-
gdb/thread.c | 60 ++-
gdb/tic6x-linux-tdep.c | 2 +-
gdb/tilegx-linux-tdep.c | 2 +-
gdb/xtensa-linux-tdep.c | 2 +-
60 files changed, 1352 insertions(+), 647 deletions(-)
create mode 100644 gdb/displaced-stepping.c
create mode 100644 gdb/displaced-stepping.h

--
2.28.0