aboutsummaryrefslogtreecommitdiff
path: root/gdb/btrace.h
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2016-01-25 12:00:20 +0000
committerPedro Alves <palves@redhat.com>2016-01-25 13:16:43 +0000
commit1d2736d43ba16c585e643faec4b6a5084d782289 (patch)
tree1e8cc132a675c519385bc6f99a89c04a2c21c8ef /gdb/btrace.h
parentf1da4b11eef6dba04a1cfa579c6ba313718105b8 (diff)
downloadgdb-1d2736d43ba16c585e643faec4b6a5084d782289.zip
gdb-1d2736d43ba16c585e643faec4b6a5084d782289.tar.gz
gdb-1d2736d43ba16c585e643faec4b6a5084d782289.tar.bz2
Fix PR 19494: hang when killing unfollowed fork children
linux_nat_kill relies on get_last_target_status to determine whether the current inferior is stopped at a unfollowed fork/vfork event. This is bad because many things can happen ever since we caught the fork/vfork event... This commit rewrites that code to instead walk the thread list looking for unfollowed fork events, similarly to what was done for remote.c. New test included. The main idea of the test is make sure that when the program stops for a fork catchpoint, and the user kills the parent, gdb also kills the unfollowed fork child. Since the child hasn't been added as an inferior at that point, we need some other portable way to detect that the child is gone. The test uses a pipe for that. The program forks twice, so you have grandparent, child and grandchild. The grandchild inherits the write side of the pipe. The grandparent hangs reading from the pipe, since nothing ever writes to it. If, when GDB kills the child, it also kills the grandchild, then the grandparent's pipe read returns 0/EOF and the test passes. Otherwise, if GDB doesn't kill the grandchild, then the pipe read never returns and the test times out, like: FAIL: gdb.base/catch-fork-kill.exp: fork-kind=fork: exit-kind=kill: fork: kill parent (timeout) FAIL: gdb.base/catch-fork-kill.exp: fork-kind=vfork: exit-kind=kill: vfork: kill parent (timeout) No regressions on x86_64 Fedora 20. New test passes with gdbserver as well. gdb/ChangeLog: 2016-01-25 Pedro Alves <palves@redhat.com> PR gdb/19494 * linux-nat.c (kill_one_lwp): New, factored out from ... (kill_callback): ... this. (kill_wait_callback): New, factored out from ... (kill_wait_one_lwp): ... this. (kill_unfollowed_fork_children): New function. (linux_nat_kill): Use it. gdb/testsuite/ChangeLog: 2016-01-25 Pedro Alves <palves@redhat.com> PR gdb/19494 * gdb.base/catch-fork-kill.c: New file. * gdb.base/catch-fork-kill.exp: New file.
Diffstat (limited to 'gdb/btrace.h')
0 files changed, 0 insertions, 0 deletions