This is the mail archive of the
mailing list for the GDB project.
[PATCH 00/10] Linux extended-remote fork events
- From: Don Breazeal <donb at codesourcery dot com>
- To: <gdb-patches at sourceware dot org>
- Date: Thu, 7 Aug 2014 10:59:45 -0700
- Subject: [PATCH 00/10] Linux extended-remote fork events
- Authentication-results: sourceware.org; auth=none
This patch series implements fork events for extended-remote linux targets. Features that are enabled include follow-fork, detach-on-fork, and catchpoints for fork and vfork. This work addresses PR gdb/13584, and is part of the local/remote debugging feature parity project (https://sourceware.org/gdb/wiki/LocalRemoteFeatureParity).
[Note that this patch series is independent of the extended-remote follow-exec patch series submitted earlier, last seen here: https://sourceware.org/ml/gdb-patches/2014-06/msg00709.html. I plan to resubmit that patch after updating it to account for this patch and the refactoring that's been done recently.]
My final test results showed the following change for native-extended-gdbserver on x86:
PASS: +267, FAIL: -115, KFAIL: +1, UNSUPP: -4
The results were unchanged by this patch for the native and native-gdbserver tests. I can provide test logs or .sum diffs if anybody is interested in specifics.
The first three patches in the series consist of some refactoring to make target-independent follow-fork code available for extended-remote targets and to encapsulate some repetitive code.
The fourth patch extends the changes that Gary Benson implemented to reduce the use of #ifdef GDBSERVER in linux-ptrace.c here: https://sourceware.org/ml/gdb-patches/2014-07/msg00633.html. The difference is that this patch provides for the caller to enable additional ptrace options after initialization has completed. This is needed because gdbserver doesn't always know whether it should enable extended mode features until GDB connects.
The fifth patch implements some functions to clone the breakpoint lists in gdbserver. These are needed because in gdbserver, each process maintains a separate breakpoint list. When a fork occurs, the child process needs a copy of the parent's breakpoint list so that it can manage the breakpoints using existing mechanisms in gdbserver.
The sixth patch is the one that actually implements follow-fork, but only for 'fork', not 'vfork'. I split these apart in an attempt to keep the size of the patches down to a reviewable size. This patch is still pretty big.
The seventh patch adds the architecture-specific pieces of follow-fork. This is the mechanism that handles copying the debug register state from the parent to the child.
The eighth patch adds follow-fork for vfork.
The ninth patch adds 'catch fork' and 'catch vfork', along with some code to make sure that killing a process that has forked, but before the fork is followed, also kills the child process.
The tenth patch implements changes to the manual and the NEWS file.
Please let me know if there is anything I can do to make this easier to review.
gdb/NEWS | 15 +
gdb/doc/gdb.texinfo | 33 ++-
gdb/gdbserver/gdbthread.h | 5 +
gdb/gdbserver/linux-aarch64-low.c | 28 ++
gdb/gdbserver/linux-arm-low.c | 26 ++
gdb/gdbserver/linux-low.c | 358 +++++++++++++++++++-
gdb/gdbserver/linux-low.h | 8 +
gdb/gdbserver/linux-mips-low.c | 76 ++++-
gdb/gdbserver/linux-x86-low.c | 29 ++
gdb/gdbserver/lynx-low.c | 3 +
gdb/gdbserver/mem-break.c | 104 ++++++
gdb/gdbserver/mem-break.h | 6 +
gdb/gdbserver/nto-low.c | 3 +
gdb/gdbserver/remote-utils.c | 26 ++-
gdb/gdbserver/server.c | 66 ++++
gdb/gdbserver/server.h | 2 +
gdb/gdbserver/spu-low.c | 3 +
gdb/gdbserver/target.h | 21 ++
gdb/gdbserver/win32-low.c | 3 +
gdb/infrun.c | 296 ++++++++++++++++--
gdb/infrun.h | 2 -
gdb/linux-nat.c | 240 ++-------------
gdb/nat/linux-ptrace.c | 104 +++++--
gdb/nat/linux-ptrace.h | 6 +-
gdb/remote.c | 152 +++++++++-
gdb/testsuite/gdb.base/foll-fork.exp | 12 +-
gdb/testsuite/gdb.base/foll-vfork.exp | 8 +-
gdb/testsuite/gdb.threads/fork-thread-pending.exp | 23 ++-
28 files changed, 1339 insertions(+), 319 deletions(-)