summaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorPedro Alves <pedro@codesourcery.com>2009-01-26 22:34:54 +0000
committerPedro Alves <pedro@codesourcery.com>2009-01-26 22:34:54 +0000
commitb51efefd842bea521c5ee25306bd73eeab74fa85 (patch)
tree4c9eb25e11167d72aa6fae8c967b2d2c6f5ea584 /gdb
parent5b87a749027154f0aa0120ac1c24e726c483a8a0 (diff)
downloadgdb-b51efefd842bea521c5ee25306bd73eeab74fa85.tar.gz
* 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')
-rw-r--r--gdb/ChangeLog8
-rw-r--r--gdb/inf-ptrace.c8
-rw-r--r--gdb/inf-ttrace.c5
-rw-r--r--gdb/linux-nat.c12
4 files changed, 27 insertions, 6 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 63ad939856f..81c50aec4d3 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,13 @@
2009-01-26 Pedro Alves <pedro@codesourcery.com>
+ * 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.
+
+2009-01-26 Pedro Alves <pedro@codesourcery.com>
+
PR backtrace/9458, PR backtrace/8864:
* frame.c (create_new_frame): Update the frame's cached PC before
finding its unwinder. Use frame_id_build to build the new frame's
diff --git a/gdb/inf-ptrace.c b/gdb/inf-ptrace.c
index 538816dcd59..76cbecc291a 100644
--- a/gdb/inf-ptrace.c
+++ b/gdb/inf-ptrace.c
@@ -73,7 +73,8 @@ inf_ptrace_follow_fork (struct target_ops *ops, int follow_child)
CORE_ADDR step_range_start = last_tp->step_range_start;
CORE_ADDR step_range_end = last_tp->step_range_end;
struct frame_id step_frame_id = last_tp->step_frame_id;
-
+ int attach_flag = find_inferior_pid (pid)->attach_flag;
+ struct inferior *inf;
struct thread_info *tp;
/* Otherwise, deleting the parent would get rid of this
@@ -82,7 +83,7 @@ inf_ptrace_follow_fork (struct target_ops *ops, int follow_child)
/* Before detaching from the parent, remove all breakpoints from
it. */
- detach_breakpoints (pid);
+ remove_breakpoints ();
if (ptrace (PT_DETACH, pid, (PTRACE_TYPE_ARG3)1, 0) == -1)
perror_with_name (("ptrace"));
@@ -94,7 +95,8 @@ inf_ptrace_follow_fork (struct target_ops *ops, int follow_child)
detach_inferior (pid);
/* Add the child. */
- add_inferior (fpid);
+ inf = add_inferior (fpid);
+ inf->attach_flag = attach_flag;
tp = add_thread_silent (inferior_ptid);
tp->step_resume_breakpoint = step_resume_breakpoint;
diff --git a/gdb/inf-ttrace.c b/gdb/inf-ttrace.c
index 680b89632f5..5255828e21d 100644
--- a/gdb/inf-ttrace.c
+++ b/gdb/inf-ttrace.c
@@ -458,6 +458,8 @@ inf_ttrace_follow_fork (struct target_ops *ops, int follow_child)
if (follow_child)
{
+ struct inferior *inf;
+
/* Copy user stepping state to the new inferior thread. */
step_resume_breakpoint = last_tp->step_resume_breakpoint;
step_range_start = last_tp->step_range_start;
@@ -469,7 +471,8 @@ inf_ttrace_follow_fork (struct target_ops *ops, int follow_child)
last_tp->step_resume_breakpoint = NULL;
inferior_ptid = ptid_build (fpid, flwpid, 0);
- add_inferior (fpid);
+ inf = add_inferior (fpid);
+ inf->attach_flag = find_inferior_pid (pid)->attach_flag;
detach_breakpoints (pid);
target_terminal_ours ();
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index 9a7e39c3dc6..20f1ea53dd0 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