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

Ilya Leoshkevich posted 3 patches 9 months, 4 weeks ago
Failed in applying to current master (apply log)
There is a newer version of this series
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
[PATCH 0/3] gdbstub: Implement follow-fork-mode child
Posted by Ilya Leoshkevich 9 months, 4 weeks ago
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

-- 
2.43.0
Re: [PATCH 0/3] gdbstub: Implement follow-fork-mode child
Posted by Alex Bennée 9 months, 4 weeks ago
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

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro