Skip to content

gdbstub: Implement follow-fork-mode child

Ilya Leoshkevich qemu-devel 4 versions – Applied

Status from this message: Queued to gdbstub/next, thanks.

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest12 patches 4 repliesApplied
  2. v311 patches 12 repliesSuperseded
  3. v211 patches 0 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v13 patches5 repliesSuperseded

Patches in v4 Applied

#Subject and filesSizeRepliesApplied
1/12gdbstub: Support disablement in a multi-threaded processgdbstub/user.c+15 -40 replies
2/12{linux,bsd}-user: Introduce get_task_state()bsd-user/bsd-file.h bsd-user/qemu.h bsd-user/signal.c +22 more+87 -772 replies
3/12{linux,bsd}-user: Update ts_tid after fork()bsd-user/main.c linux-user/main.c+2 -01 reply
4/12gdbstub: Introduce gdbserver_fork_start()bsd-user/main.c gdbstub/user.c include/gdbstub/user.h +1 more+11 -00 replies
5/12{linux,bsd}-user: Pass pid to fork_end()bsd-user/freebsd/os-proc.h bsd-user/main.c bsd-user/qemu.h +3 more+14 -100 replies
6/12{linux,bsd}-user: Pass pid to gdbserver_fork()bsd-user/main.c gdbstub/user.c include/gdbstub/user.h +1 more+4 -40 replies
7/12gdbstub: Call gdbserver_fork() both in parent and in childbsd-user/main.c gdbstub/user.c include/gdbstub/user.h +1 more+8 -70 replies
8/12gdbstub: Introduce gdb_handle_query_supported_user()gdbstub/gdbstub.c gdbstub/internals.h gdbstub/user.c+14 -30 replies
9/12gdbstub: Introduce gdb_handle_set_thread_user()gdbstub/gdbstub.c gdbstub/internals.h gdbstub/user.c+15 -20 replies
10/12gdbstub: Introduce gdb_handle_detach_user()gdbstub/gdbstub.c gdbstub/internals.h gdbstub/user.c+12 -00 replies
11/12gdbstub: Implement follow-fork-mode childgdbstub/user.c+210 -20 replies
12/12tests/tcg: Add two follow-fork-mode teststests/tcg/multiarch/Makefile.target tests/tcg/multiarch/follow-fork-mode.c tests/tcg/multiarch/gdbstub/follow-fork-mode-child.py +1 more+128 -10 replies

Reviews trailers per patch

8 of 12 patches have a Reviewed-by or Acked-by.

PatchAlex BennéeRichard HendersonWarner Losh
1/12R-b R-b
2/12R-b R-b
3/12R-b R-b
4/12R-b
5/12R-b R-b
6/12R-b
7/12R-b
8/12R-b
9/12
10/12
11/12
12/12

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v4 thread

Cover letter [PATCH v4 00/12] gdbstub: Implement follow-fork-mode child

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
Signature · 1 line
2.43.2