GNU Binutils with patches for OS216
Revision | 9c421dc4db41c0d43df4868394aceddb5aa87520 (tree) |
---|---|
Time | 2008-12-19 07:16:16 |
Author | Pedro Alves <palves@redh...> |
Commiter | Pedro Alves |
* linux-nat.c (linux_child_follow_fork): If following the child,
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.
@@ -597,15 +597,14 @@ static void | ||
597 | 597 | linux_fork_context (struct fork_info *newfp, int from_tty) |
598 | 598 | { |
599 | 599 | /* Now we attempt to switch processes. */ |
600 | - struct fork_info *oldfp = find_fork_ptid (inferior_ptid); | |
600 | + struct fork_info *oldfp; | |
601 | 601 | ptid_t ptid; |
602 | 602 | int id, i; |
603 | 603 | |
604 | - if (!newfp) | |
605 | - error (_("No such fork/process")); | |
604 | + gdb_assert (newfp != NULL); | |
606 | 605 | |
607 | - if (!oldfp) | |
608 | - oldfp = add_fork (ptid_get_pid (inferior_ptid)); | |
606 | + oldfp = find_fork_ptid (inferior_ptid); | |
607 | + gdb_assert (oldfp != NULL); | |
609 | 608 | |
610 | 609 | fork_save_infrun_state (oldfp, 1); |
611 | 610 | remove_breakpoints (); |
@@ -863,6 +863,12 @@ linux_child_follow_fork (struct target_ops *ops, int follow_child) | ||
863 | 863 | if (!fp) |
864 | 864 | fp = add_fork (parent_pid); |
865 | 865 | fork_save_infrun_state (fp, 0); |
866 | + | |
867 | + /* Also add an entry for the child fork. */ | |
868 | + fp = find_fork_pid (child_pid); | |
869 | + if (!fp) | |
870 | + fp = add_fork (child_pid); | |
871 | + fork_save_infrun_state (fp, 0); | |
866 | 872 | } |
867 | 873 | else |
868 | 874 | target_detach (NULL, 0); |