* corelow.c (core_close): Don't hardcode the core's pid.
[deliverable/binutils-gdb.git] / gdb / inf-ptrace.c
index 8ae1161a9d652984e218f5abd6e2d335c64dc2ac..06792007cdfc941b191ccc0c53e650759345be05 100644 (file)
@@ -1,7 +1,7 @@
 /* Low-level child interface to ptrace.
 
    Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998,
-   1999, 2000, 2001, 2002, 2004, 2005, 2006, 2007, 2008
+   1999, 2000, 2001, 2002, 2004, 2005, 2006, 2007, 2008, 2009
    Free Software Foundation, Inc.
 
    This file is part of GDB.
@@ -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;
@@ -383,7 +385,8 @@ inf_ptrace_resume (ptid_t ptid, int step, enum target_signal signal)
    the status in *OURSTATUS.  */
 
 static ptid_t
-inf_ptrace_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
+inf_ptrace_wait (struct target_ops *ops,
+                ptid_t ptid, struct target_waitstatus *ourstatus)
 {
   pid_t pid;
   int status, save_errno;
@@ -613,6 +616,12 @@ inf_ptrace_files_info (struct target_ops *ignore)
                   target_pid_to_str (inferior_ptid));
 }
 
+static char *
+inf_ptrace_pid_to_str (struct target_ops *ops, ptid_t ptid)
+{
+  return normal_pid_to_str (ptid);
+}
+
 /* Create a prototype ptrace target.  The client can override it with
    local methods.  */
 
@@ -635,7 +644,7 @@ inf_ptrace_target (void)
 #endif
   t->to_mourn_inferior = inf_ptrace_mourn_inferior;
   t->to_thread_alive = inf_ptrace_thread_alive;
-  t->to_pid_to_str = normal_pid_to_str;
+  t->to_pid_to_str = inf_ptrace_pid_to_str;
   t->to_stop = inf_ptrace_stop;
   t->to_xfer_partial = inf_ptrace_xfer_partial;
 
This page took 0.026003 seconds and 4 git commands to generate.