[PATCH v4 0/3] Fix failure to detach if process exits while detaching on Linux

Pedro Alves
2016-06-16T23:33:02Z

This series picks up where
https://sourceware.org/ml/gdb-patches/2016-06/msg00068.html
left off.

New in v4:

- Handles failure to remove watchpoints / (prepare to resume).

- Reworked to reap zombie lwps on failure to detach. Without this,
gdb actually remains attached to the process. This can result in
the process's parent hanging, if it is waiting for the child to
exit.

- Tests much extended.

- Commit log tweaked / extended.

Also pushed to users/palves/detach-gone-thread-v4, for convenience.

( Antoine, I rewrote the test substantially, and renamed it to
process-dies-while-detaching.exp to mirror
process-dies-while-handling-bp.exp, which is somewhat similar in
spirit. You can easily see the differences from what we were working on
earlier with:
git diff -M origin/users/palves/detach-gone-thread-wip..origin/users/palves/detach-gone-thread-v4
)

gdb/breakpoint.c | 25 +-
gdb/darwin-nat.c | 10 +-
gdb/gdbserver/linux-low.c | 116 ++++++--
gdb/inf-ptrace.c | 20 +-
gdb/inf-ptrace.h | 4 +
gdb/infcmd.c | 7 +
gdb/linux-nat.c | 152 ++++++----
gdb/nto-procfs.c | 11 +-
gdb/remote.c | 10 +-
gdb/target.c | 22 ++
gdb/target.h | 5 +
gdb/testsuite/gdb.multi/watchpoint-multi-exit.c | 66 +++++
gdb/testsuite/gdb.multi/watchpoint-multi-exit.exp | 87 ++++++
.../gdb.threads/process-dies-while-detaching.c | 116 ++++++++
.../gdb.threads/process-dies-while-detaching.exp | 327 +++++++++++++++++++++
15 files changed, 864 insertions(+), 114 deletions(-)
create mode 100644 gdb/testsuite/gdb.multi/watchpoint-multi-exit.c
create mode 100644 gdb/testsuite/gdb.multi/watchpoint-multi-exit.exp
create mode 100644 gdb/testsuite/gdb.threads/process-dies-while-detaching.c
create mode 100644 gdb/testsuite/gdb.threads/process-dies-while-detaching.exp

--
2.5.5