]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
* linux-nat.c (linux_child_follow_fork): If following the child,
authorPedro Alves <palves@redhat.com>
Thu, 18 Dec 2008 22:16:16 +0000 (22:16 +0000)
committerPedro Alves <palves@redhat.com>
Thu, 18 Dec 2008 22:16:16 +0000 (22:16 +0000)
and not detaching the parent, also add the child fork to the fork
list.
* linux-fork.c (linux_fork_context): Remove dead error call.
Assert that the incoming newfp argument is not null.  Do not add a
new fork for inferior_ptid.  Assert that there is one already.

gdb/linux-fork.c
gdb/linux-nat.c

index c8aee9119d0bd7da25aec56cd1b735e15f1bcce3..e5891abffd49b57d40fbbab5c7020ee486909b69 100644 (file)
@@ -597,15 +597,14 @@ static void
 linux_fork_context (struct fork_info *newfp, int from_tty)
 {
   /* Now we attempt to switch processes.  */
-  struct fork_info *oldfp = find_fork_ptid (inferior_ptid);
+  struct fork_info *oldfp;
   ptid_t ptid;
   int id, i;
 
-  if (!newfp)
-    error (_("No such fork/process"));
+  gdb_assert (newfp != NULL);
 
-  if (!oldfp)
-    oldfp = add_fork (ptid_get_pid (inferior_ptid));
+  oldfp = find_fork_ptid (inferior_ptid);
+  gdb_assert (oldfp != NULL);
 
   fork_save_infrun_state (oldfp, 1);
   remove_breakpoints ();
index 6400dc3b9b6191af58cde00679bcb4da018684e0..77c976e937b0b04d6b09e5f88f91fc36ec5beaa7 100644 (file)
@@ -863,6 +863,12 @@ linux_child_follow_fork (struct target_ops *ops, int follow_child)
          if (!fp)
            fp = add_fork (parent_pid);
          fork_save_infrun_state (fp, 0);
+
+         /* Also add an entry for the child fork.  */
+         fp = find_fork_pid (child_pid);
+         if (!fp)
+           fp = add_fork (child_pid);
+         fork_save_infrun_state (fp, 0);
        }
       else
        target_detach (NULL, 0);