[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 0/5] Add stub to handle Xfer:siginfo:read query
From: |
Gustavo Romero |
Subject: |
[PATCH v3 0/5] Add stub to handle Xfer:siginfo:read query |
Date: |
Sat, 9 Mar 2024 03:08:56 +0000 |
Xfer:siginfo:read query is received, usually, when GDB catches a signal
and needs additional info about it, like the si_code and the si_addr, so
GDB can show the user interesting info about the signal. This query can
also be received when an user explicitly asks for more information via
printing GBD's special purpose variable '$_siginfo'.
This series adds the stub to handle Xfer:siginfo:read queries.
To achieve this, it is first necessary to stash the target-specific
siginfo in the gdbstub server state struct when handling a signal, so it
requires modifying the gdb_handlesig function to accept the target's
siginfo struct and its length.
Later, when replying to a Xfer:siginfo:read query (i.e., after a
signal is caught), the query handler utilizes the stashed siginfo to
form the packet for replying to the query.
Finally, a test is added to check if the stub correctly responds to the
query when a simple binary causes a SIGSEGV. Since the si_addr must be
available in the case of a SIGSEGV, the value of si_addr is checked
against the expected faulting address, corresponding to the dereferenced
pointer value in the binary.
v1:
https://lists.gnu.org/archive/html/qemu-devel/2024-03/msg00423.html
v2:
https://lists.gnu.org/archive/html/qemu-devel/2024-03/msg01858.html
Cheers,
Gustavo
Gustavo Romero (5):
gdbstub: Rename back gdb_handlesig
linux-user: Move tswap_siginfo out of target code
gdbstub: Save target's siginfo
gdbstub: Add Xfer:siginfo:read stub
tests/tcg: Add multiarch test for Xfer:siginfo:read stub
bsd-user/main.c | 2 +-
bsd-user/signal.c | 5 +-
gdbstub/gdbstub.c | 8 ++++
gdbstub/internals.h | 1 +
gdbstub/user.c | 46 +++++++++++++++++--
include/gdbstub/user.h | 19 +++-----
linux-user/aarch64/signal.c | 2 +-
linux-user/alpha/signal.c | 2 +-
linux-user/arm/signal.c | 2 +-
linux-user/hexagon/signal.c | 2 +-
linux-user/hppa/signal.c | 2 +-
linux-user/i386/signal.c | 6 +--
linux-user/loongarch64/signal.c | 2 +-
linux-user/m68k/signal.c | 4 +-
linux-user/main.c | 2 +-
linux-user/microblaze/signal.c | 2 +-
linux-user/mips/signal.c | 4 +-
linux-user/nios2/signal.c | 2 +-
linux-user/openrisc/signal.c | 2 +-
linux-user/ppc/signal.c | 4 +-
linux-user/riscv/signal.c | 2 +-
linux-user/s390x/signal.c | 2 +-
linux-user/sh4/signal.c | 2 +-
linux-user/signal-common.h | 2 -
linux-user/signal.c | 15 ++++--
linux-user/sparc/signal.c | 2 +-
linux-user/xtensa/signal.c | 2 +-
tests/tcg/multiarch/Makefile.target | 10 +++-
.../gdbstub/test-qxfer-siginfo-read.py | 26 +++++++++++
tests/tcg/multiarch/segfault.c | 14 ++++++
30 files changed, 147 insertions(+), 49 deletions(-)
create mode 100644 tests/tcg/multiarch/gdbstub/test-qxfer-siginfo-read.py
create mode 100644 tests/tcg/multiarch/segfault.c
--
2.34.1
- [PATCH v3 0/5] Add stub to handle Xfer:siginfo:read query,
Gustavo Romero <=
- [PATCH v3 1/5] gdbstub: Rename back gdb_handlesig, Gustavo Romero, 2024/03/08
- [PATCH v3 2/5] linux-user: Move tswap_siginfo out of target code, Gustavo Romero, 2024/03/08
- [PATCH v3 4/5] gdbstub: Add Xfer:siginfo:read stub, Gustavo Romero, 2024/03/08
- [PATCH v3 3/5] gdbstub: Save target's siginfo, Gustavo Romero, 2024/03/08
- [PATCH v3 5/5] tests/tcg: Add multiarch test for Xfer:siginfo:read stub, Gustavo Romero, 2024/03/08
- Re: [PATCH v3 0/5] Add stub to handle Xfer:siginfo:read query, Alex Bennée, 2024/03/11