mbox series

[0/3] gdbstub: Implement follow-fork-mode child

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

Message

Ilya Leoshkevich Jan. 31, 2024, 8:43 p.m. UTC
Based-on: <20240116094411.216665-1-iii@linux.ibm.com>

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). Patch 1 is a
preliminary refactoring, I can split it if necessary. Patch 2 is the
implementation, and patch 3 is the test.

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

Best regards,
Ilya

Ilya Leoshkevich (3):
  gdbstub: Refactor fork() handling
  gdbstub: Implement follow-fork-mode child
  tests/tcg: Add two follow-fork-mode tests

 bsd-user/freebsd/os-proc.h                    |   6 +-
 bsd-user/main.c                               |   8 +-
 bsd-user/qemu.h                               |   2 +-
 gdbstub/gdbstub.c                             |  29 ++-
 gdbstub/internals.h                           |   3 +
 gdbstub/user.c                                | 225 +++++++++++++++++-
 include/gdbstub/user.h                        |  11 +-
 linux-user/main.c                             |   8 +-
 linux-user/syscall.c                          |   4 +-
 linux-user/user-internals.h                   |   2 +-
 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 ++
 14 files changed, 403 insertions(+), 24 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 Feb. 1, 2024, 11:59 a.m. UTC | #1
Ilya Leoshkevich <iii@linux.ibm.com> writes:

> Based-on: <20240116094411.216665-1-iii@linux.ibm.com>
>
> 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). Patch 1 is a
> preliminary refactoring, I can split it if necessary.

Please, I think introduce the api and then one each for adding the hooks
to *-user

> Patch 2 is the
> implementation, and patch 3 is the test.

Always good to see tests ;-)

>
> [1] https://lists.gnu.org/archive/html/qemu-devel/2024-01/msg06424.html
>
> Best regards,
> Ilya
>
> Ilya Leoshkevich (3):
>   gdbstub: Refactor fork() handling
>   gdbstub: Implement follow-fork-mode child
>   tests/tcg: Add two follow-fork-mode tests
>
>  bsd-user/freebsd/os-proc.h                    |   6 +-
>  bsd-user/main.c                               |   8 +-
>  bsd-user/qemu.h                               |   2 +-
>  gdbstub/gdbstub.c                             |  29 ++-
>  gdbstub/internals.h                           |   3 +
>  gdbstub/user.c                                | 225 +++++++++++++++++-
>  include/gdbstub/user.h                        |  11 +-
>  linux-user/main.c                             |   8 +-
>  linux-user/syscall.c                          |   4 +-
>  linux-user/user-internals.h                   |   2 +-
>  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 ++
>  14 files changed, 403 insertions(+), 24 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