diff options
author | Pedro Alves <palves@redhat.com> | 2008-12-18 21:35:23 +0000 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2008-12-18 21:35:23 +0000 |
commit | 0d14fc63276224196874dc5593e521d2142bdc05 (patch) | |
tree | a362195e75b31c9347e01dcf926ef20e4c8cceae | |
parent | 4e59450ef0333b385bb575153d00942dcd2112fd (diff) | |
download | gdb-0d14fc63276224196874dc5593e521d2142bdc05.zip gdb-0d14fc63276224196874dc5593e521d2142bdc05.tar.gz gdb-0d14fc63276224196874dc5593e521d2142bdc05.tar.bz2 |
* 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.
-rw-r--r-- | gdb/ChangeLog | 9 | ||||
-rw-r--r-- | gdb/linux-fork.c | 9 | ||||
-rw-r--r-- | gdb/linux-nat.c | 6 |
3 files changed, 19 insertions, 5 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index c0a699e..7eb32ab 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,12 @@ +2008-12-18 Pedro Alves <pedro@codesourcery.com> + + * 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. + 2008-12-16 Tristan Gingold <gingold@adacore.com> * inflow.c: Remove old_sigio, handle_sigio, old_fcntl_flags, diff --git a/gdb/linux-fork.c b/gdb/linux-fork.c index f80fe5f..3d64922 100644 --- a/gdb/linux-fork.c +++ b/gdb/linux-fork.c @@ -600,15 +600,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 (); diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c index a2cb39d..d90fb07 100644 --- a/gdb/linux-nat.c +++ b/gdb/linux-nat.c @@ -857,6 +857,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); |