diff options
author | Pedro Alves <palves@redhat.com> | 2011-08-26 19:55:00 +0000 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2011-08-26 19:55:00 +0000 |
commit | 3ced3da4a5e534cf6d35912dcd03766ac67da5ed (patch) | |
tree | f05efc41f0b45711d28bd02ce50cf04527e3ec6f | |
parent | a9f4bb212331d41206c8acdf58b7031b0ad4ac03 (diff) | |
download | gdb-3ced3da4a5e534cf6d35912dcd03766ac67da5ed.zip gdb-3ced3da4a5e534cf6d35912dcd03766ac67da5ed.tar.gz gdb-3ced3da4a5e534cf6d35912dcd03766ac67da5ed.tar.bz2 |
2011-08-26 Pedro Alves <pedro@codesourcery.com>
* linux-nat.c (linux_child_follow_fork): Don't set lp->resumed on
either the parent or the child forks. Rename a couple locals.
-rw-r--r-- | gdb/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/linux-nat.c | 24 |
2 files changed, 15 insertions, 14 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index f64aca2..e4dfe8a 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,10 @@ 2011-08-26 Pedro Alves <pedro@codesourcery.com> + * linux-nat.c (linux_child_follow_fork): Don't set lp->resumed on + either the parent or the child forks. Rename a couple locals. + +2011-08-26 Pedro Alves <pedro@codesourcery.com> + * linux-nat.c (wait_lwp): Avoid assuming errno is preserved by a library call. Avoid reading the `status' local if all waitpid calls failed. diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c index d02edb8..45daea7 100644 --- a/gdb/linux-nat.c +++ b/gdb/linux-nat.c @@ -696,7 +696,6 @@ holding the child stopped. Try \"set detach-on-fork\" or \ add_thread (inferior_ptid); child_lp = add_lwp (inferior_ptid); child_lp->stopped = 1; - child_lp->resumed = 1; /* If this is a vfork child, then the address-space is shared with the parent. */ @@ -738,7 +737,7 @@ holding the child stopped. Try \"set detach-on-fork\" or \ if (has_vforked) { - struct lwp_info *lp; + struct lwp_info *parent_lp; struct inferior *parent_inf; parent_inf = current_inferior (); @@ -753,17 +752,16 @@ holding the child stopped. Try \"set detach-on-fork\" or \ parent_inf->waiting_for_vfork_done = detach_fork; parent_inf->pspace->breakpoints_not_allowed = detach_fork; - lp = find_lwp_pid (pid_to_ptid (parent_pid)); + parent_lp = find_lwp_pid (pid_to_ptid (parent_pid)); gdb_assert (linux_supports_tracefork_flag >= 0); + if (linux_supports_tracevforkdone (0)) { if (debug_linux_nat) fprintf_unfiltered (gdb_stdlog, "LCFF: waiting for VFORK_DONE on %d\n", parent_pid); - - lp->stopped = 1; - lp->resumed = 1; + parent_lp->stopped = 1; /* We'll handle the VFORK_DONE event like any other event, in target_wait. */ @@ -812,10 +810,9 @@ holding the child stopped. Try \"set detach-on-fork\" or \ and leave it pending. The next linux_nat_resume call will notice a pending event, and bypasses actually resuming the inferior. */ - lp->status = 0; - lp->waitstatus.kind = TARGET_WAITKIND_VFORK_DONE; - lp->stopped = 0; - lp->resumed = 1; + parent_lp->status = 0; + parent_lp->waitstatus.kind = TARGET_WAITKIND_VFORK_DONE; + parent_lp->stopped = 1; /* If we're in async mode, need to tell the event loop there's something here to process. */ @@ -827,7 +824,7 @@ holding the child stopped. Try \"set detach-on-fork\" or \ else { struct inferior *parent_inf, *child_inf; - struct lwp_info *lp; + struct lwp_info *child_lp; struct program_space *parent_pspace; if (info_verbose || debug_linux_nat) @@ -887,9 +884,8 @@ holding the child stopped. Try \"set detach-on-fork\" or \ inferior_ptid = ptid_build (child_pid, child_pid, 0); add_thread (inferior_ptid); - lp = add_lwp (inferior_ptid); - lp->stopped = 1; - lp->resumed = 1; + child_lp = add_lwp (inferior_ptid); + child_lp->stopped = 1; /* If this is a vfork child, then the address-space is shared with the parent. If we detached from the parent, then we can |