mbox series

[v4,00/12] gdbstub: Implement follow-fork-mode child

Message ID 20240219141628.246823-1-iii@linux.ibm.com
Headers show
Series gdbstub: Implement follow-fork-mode child | expand

Message

Ilya Leoshkevich Feb. 19, 2024, 2:15 p.m. UTC
v3: https://lists.gnu.org/archive/html/qemu-devel/2024-02/msg03142.html
v3 -> v4: Address the review comments, add R-bs.
          Add the get_task_state() refactoring.
          Keep passing CPUState to gdbserver_fork_end() for tb_flush().
          Patches that need review: 02/12, 09/12-12/12.

v2: https://lists.gnu.org/archive/html/qemu-devel/2024-02/msg00810.html
v2 -> v3: Rebase on top of master.
          Fix a typo in the 01/11 commit message.

v1: https://lists.gnu.org/archive/html/qemu-devel/2024-01/msg06646.html
v1 -> v2: Factor out a number of prep patches;
          Add a state transition diagram comment (Alex).
          Improve a few comments;
          Extend the ts_tid fix to bsd.

Hi,

I needed to debug a linux-user crash between fork() and exec() [1] and
realized that gdbstub does not allow this. This series lifts this
restriction (one still cannot debug past exec() though). Patches 1-10
are preliminary refactorings, patch 11 is the implementation, and patch
12 is the test.

[1] https://lists.gnu.org/archive/html/qemu-devel/2024-01/msg06424.html

Best regards,
Ilya

Ilya Leoshkevich (12):
  gdbstub: Support disablement in a multi-threaded process
  {linux,bsd}-user: Introduce get_task_state()
  {linux,bsd}-user: Update ts_tid after fork()
  gdbstub: Introduce gdbserver_fork_start()
  {linux,bsd}-user: Pass pid to fork_end()
  {linux,bsd}-user: Pass pid to gdbserver_fork()
  gdbstub: Call gdbserver_fork() both in parent and in child
  gdbstub: Introduce gdb_handle_query_supported_user()
  gdbstub: Introduce gdb_handle_set_thread_user()
  gdbstub: Introduce gdb_handle_detach_user()
  gdbstub: Implement follow-fork-mode child
  tests/tcg: Add two follow-fork-mode tests

 bsd-user/bsd-file.h                           |   2 +-
 bsd-user/freebsd/os-proc.h                    |   6 +-
 bsd-user/main.c                               |   9 +-
 bsd-user/qemu.h                               |   7 +-
 bsd-user/signal.c                             |  20 +-
 gdbstub/gdbstub.c                             |  29 ++-
 gdbstub/internals.h                           |   3 +
 gdbstub/user-target.c                         |   4 +-
 gdbstub/user.c                                | 244 +++++++++++++++++-
 include/gdbstub/user.h                        |  10 +-
 include/user/safe-syscall.h                   |   2 +-
 linux-user/aarch64/cpu_loop.c                 |   2 +-
 linux-user/arm/cpu_loop.c                     |   4 +-
 linux-user/arm/signal.c                       |   2 +-
 linux-user/cris/cpu_loop.c                    |   2 +-
 linux-user/elfload.c                          |   6 +-
 linux-user/hppa/signal.c                      |   2 +-
 linux-user/linuxload.c                        |   2 +-
 linux-user/m68k/cpu_loop.c                    |   2 +-
 linux-user/m68k/target_cpu.h                  |   2 +-
 linux-user/main.c                             |   8 +-
 linux-user/mips/cpu_loop.c                    |   2 +-
 linux-user/ppc/signal.c                       |   4 +-
 linux-user/qemu.h                             |   5 +
 linux-user/riscv/cpu_loop.c                   |   2 +-
 linux-user/signal-common.h                    |   2 +-
 linux-user/signal.c                           |  30 +--
 linux-user/syscall.c                          |  32 +--
 linux-user/user-internals.h                   |   2 +-
 linux-user/vm86.c                             |  18 +-
 linux-user/xtensa/signal.c                    |   2 +-
 plugins/api.c                                 |   8 +-
 semihosting/arm-compat-semi.c                 |   8 +-
 tests/tcg/multiarch/Makefile.target           |  17 +-
 tests/tcg/multiarch/follow-fork-mode.c        |  56 ++++
 .../gdbstub/follow-fork-mode-child.py         |  40 +++
 .../gdbstub/follow-fork-mode-parent.py        |  16 ++
 37 files changed, 511 insertions(+), 101 deletions(-)
 create mode 100644 tests/tcg/multiarch/follow-fork-mode.c
 create mode 100644 tests/tcg/multiarch/gdbstub/follow-fork-mode-child.py
 create mode 100644 tests/tcg/multiarch/gdbstub/follow-fork-mode-parent.py

Comments

Alex Bennée March 4, 2024, 6:03 p.m. UTC | #1
Ilya Leoshkevich <iii@linux.ibm.com> writes:

> v3: https://lists.gnu.org/archive/html/qemu-devel/2024-02/msg03142.html
> v3 -> v4: Address the review comments, add R-bs.
>           Add the get_task_state() refactoring.
>           Keep passing CPUState to gdbserver_fork_end() for tb_flush().
>           Patches that need review: 02/12, 09/12-12/12.
>
> v2: https://lists.gnu.org/archive/html/qemu-devel/2024-02/msg00810.html
> v2 -> v3: Rebase on top of master.
>           Fix a typo in the 01/11 commit message.
>
> v1: https://lists.gnu.org/archive/html/qemu-devel/2024-01/msg06646.html
> v1 -> v2: Factor out a number of prep patches;
>           Add a state transition diagram comment (Alex).
>           Improve a few comments;
>           Extend the ts_tid fix to bsd.
>
> Hi,
>
> I needed to debug a linux-user crash between fork() and exec() [1] and
> realized that gdbstub does not allow this. This series lifts this
> restriction (one still cannot debug past exec() though). Patches 1-10
> are preliminary refactorings, patch 11 is the implementation, and patch
> 12 is the test.

Queued to gdbstub/next, thanks.