aboutsummaryrefslogtreecommitdiff
path: root/gdb/linux-nat.c
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2009-05-17 19:20:33 +0000
committerPedro Alves <palves@redhat.com>2009-05-17 19:20:33 +0000
commitb242c3c2373ba4e31c501571c8b16d26d8fd2067 (patch)
tree701867d15bd9ad5fac9af7ba2d1be395e5717188 /gdb/linux-nat.c
parent235f2b04aed3c632481f8db71a3ea880ad575098 (diff)
downloadgdb-b242c3c2373ba4e31c501571c8b16d26d8fd2067.zip
gdb-b242c3c2373ba4e31c501571c8b16d26d8fd2067.tar.gz
gdb-b242c3c2373ba4e31c501571c8b16d26d8fd2067.tar.bz2
gdb/
2009-05-17 Pedro Alves <pedro@codesourcery.com> * infrun.c (handle_inferior_event): When handling a TARGET_WAITKIND_FORKED, detach breakpoints from the fork child immediatelly. * linux-nat.c (linux_child_follow_fork): Only detach breakpoint from the child if vforking. * inf-ptrace.c (inf_ptrace_follow_fork): No need to detach breakpoints from the child here. gdb/testsuite/ 2009-05-17 Pedro Alves <pedro@codesourcery.com> * gdb.base/foll-fork.c: Include stdlib.h. Add markers for `gdb_get_line_number'. Call `callee' in both parent and child. * gdb.base/foll-fork.exp (catch_fork_child_follow): Use `gdb_get_line_number' instead of hardcoding line numbers. (catch_fork_unpatch_child): New procedure to test detaching breakpoints from child fork. (tcatch_fork_parent_follow): Use `gdb_get_line_number' instead of hardcoding line numbers. (do_fork_tests): Run `catch_fork_unpatch_child'.
Diffstat (limited to 'gdb/linux-nat.c')
-rw-r--r--gdb/linux-nat.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index d67fcc3..beff012 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -593,11 +593,15 @@ linux_child_follow_fork (struct target_ops *ops, int follow_child)
/* We're already attached to the parent, by default. */
/* Before detaching from the child, remove all breakpoints from
- it. (This won't actually modify the breakpoint list, but will
- physically remove the breakpoints from the child.) */
- /* If we vforked this will remove the breakpoints from the parent
- also, but they'll be reinserted below. */
- detach_breakpoints (child_pid);
+ it. If we forked, then this has already been taken care of
+ by infrun.c. If we vforked however, any breakpoint inserted
+ in the parent is visible in the child, even those added while
+ stopped in a vfork catchpoint. This won't actually modify
+ the breakpoint list, but will physically remove the
+ breakpoints from the child. This will remove the breakpoints
+ from the parent also, but they'll be reinserted below. */
+ if (has_vforked)
+ detach_breakpoints (child_pid);
/* Detach new forked process? */
if (detach_fork)
@@ -701,10 +705,6 @@ linux_child_follow_fork (struct target_ops *ops, int follow_child)
breakpoint. */
last_tp->step_resume_breakpoint = NULL;
- /* Needed to keep the breakpoint lists in sync. */
- if (! has_vforked)
- detach_breakpoints (child_pid);
-
/* Before detaching from the parent, remove all breakpoints from it. */
remove_breakpoints ();