[PATCH v2 0/3] Follow fork improvements

Simon Marchi simon.marchi@polymtl.ca
Wed Jun 2 15:10:08 GMT 2021


This is a v2 of this:

  https://sourceware.org/pipermail/gdb-patches/2021-April/177724.html

I had forgotten about this patch, which is actually a good thing because
we since found a reason to do things a bit differently on the ROCm
side.

We initially wanted to rely on the inferior_created to push the ROCm
target in the child inferior, when handling a fork.  We then found it
would be better to use the follow_fork target_ops method, as explained
in patch 3.

However, I had originally used an issue with fork + JIT that I had found
as a justification for my original patch.  This issue is still present,
and it's still worth fixing it, so patch 1 is the same as the original
patch.  Only the rationale / justification part changed a bit, to no
longer talk about needing to push the ROCm target.

So patch 2 and 3 are new, and change how follow_fork_inferior calls
target_follow_fork.  There are changes to fbsd-nat.c and obsd-nat.c that
I can't easily test, I would appreciate if somebody could give it a
quick look on those platforms.

Simon Marchi (3):
  gdb: call post_create_inferior at end of follow_fork_inferior
  gdb: pass child_ptid and fork kind to target_ops::follow_fork
  gdb: follow-fork: push target and add thread in target_follow_fork

 gdb/NEWS                                    |   3 +
 gdb/doc/gdb.texinfo                         |   4 +
 gdb/exec.c                                  |   6 +-
 gdb/exec.h                                  |   9 +-
 gdb/fbsd-nat.c                              |  12 +-
 gdb/fbsd-nat.h                              |   2 +-
 gdb/infrun.c                                | 194 +++++++++-----------
 gdb/jit.c                                   |  28 +++
 gdb/linux-nat.c                             |  45 ++---
 gdb/linux-nat.h                             |   5 +-
 gdb/linux-thread-db.c                       |   2 +-
 gdb/obsd-nat.c                              |  15 +-
 gdb/obsd-nat.h                              |   2 +-
 gdb/process-stratum-target.c                |  15 ++
 gdb/process-stratum-target.h                |   9 +
 gdb/remote.c                                |  22 +--
 gdb/target-debug.h                          |   2 +
 gdb/target-delegates.c                      |  26 ++-
 gdb/target.c                                |  22 ++-
 gdb/target.h                                |  16 +-
 gdb/testsuite/gdb.base/jit-elf-fork-main.c  | 129 +++++++++++++
 gdb/testsuite/gdb.base/jit-elf-fork-solib.c |  25 +++
 gdb/testsuite/gdb.base/jit-elf-fork.exp     | 186 +++++++++++++++++++
 23 files changed, 576 insertions(+), 203 deletions(-)
 create mode 100644 gdb/testsuite/gdb.base/jit-elf-fork-main.c
 create mode 100644 gdb/testsuite/gdb.base/jit-elf-fork-solib.c
 create mode 100644 gdb/testsuite/gdb.base/jit-elf-fork.exp

-- 
2.31.1



More information about the Gdb-patches mailing list