diff options
author | Pedro Alves <palves@redhat.com> | 2009-01-26 22:34:55 +0000 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2009-01-26 22:34:55 +0000 |
commit | 77435e4c95513bfccecb90bca8a06a5a62aebdc6 (patch) | |
tree | d5b102cdd08b46ac4595637d011223b5b8d664e4 /gdb/linux-nat.c | |
parent | 7488432fc292f9ac6fb3e69ef7c8fa745c0fa886 (diff) | |
download | gdb-77435e4c95513bfccecb90bca8a06a5a62aebdc6.zip gdb-77435e4c95513bfccecb90bca8a06a5a62aebdc6.tar.gz gdb-77435e4c95513bfccecb90bca8a06a5a62aebdc6.tar.bz2 |
* linux-nat.c (linux_child_follow_fork): Copy attach_flag from the
parent to the child.
* inf-ttrace.c (inf_ttrace_follow_fork): Likewise.
* inf-ptrace.c (inf_ptrace_follow_fork): Likewise. Use
remove_breakpoints to remove breakpoints from the parent.
Diffstat (limited to 'gdb/linux-nat.c')
-rw-r--r-- | gdb/linux-nat.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c index 9a7e39c..20f1ea5 100644 --- a/gdb/linux-nat.c +++ b/gdb/linux-nat.c @@ -730,9 +730,13 @@ linux_child_follow_fork (struct target_ops *ops, int follow_child) else { struct fork_info *fp; + struct inferior *parent_inf, *child_inf; /* Add process to GDB's tables. */ - add_inferior (child_pid); + child_inf = add_inferior (child_pid); + + parent_inf = find_inferior_pid (GET_PID (last_ptid)); + child_inf->attach_flag = parent_inf->attach_flag; /* Retain child fork in ptrace (stopped) state. */ fp = find_fork_pid (child_pid); @@ -800,6 +804,7 @@ linux_child_follow_fork (struct target_ops *ops, int follow_child) struct thread_info *last_tp = find_thread_pid (last_ptid); struct thread_info *tp; char child_pid_spelling[40]; + struct inferior *parent_inf, *child_inf; /* Copy user stepping state to the new inferior thread. */ struct breakpoint *step_resume_breakpoint = last_tp->step_resume_breakpoint; @@ -829,7 +834,10 @@ linux_child_follow_fork (struct target_ops *ops, int follow_child) /* Add the new inferior first, so that the target_detach below doesn't unpush the target. */ - add_inferior (child_pid); + child_inf = add_inferior (child_pid); + + parent_inf = find_inferior_pid (GET_PID (last_ptid)); + child_inf->attach_flag = parent_inf->attach_flag; /* If we're vforking, we may want to hold on to the parent until the child exits or execs. At exec time we can remove the old |