From: Daniel Jacobowitz Date: Wed, 11 Dec 2002 01:25:19 +0000 (+0000) Subject: * hppah-nat.c (child_wait): Return TARGET_WAITKIND_IGNORE X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8e7d2c16952df15b6628a9f2ee985086a408561f;p=binutils-gdb.git * hppah-nat.c (child_wait): Return TARGET_WAITKIND_IGNORE for the parent's fork event. * infrun.c (handle_inferior_event): Only expect one fork event. Call prepare_to_wait for TARGET_WAITKIND_IGNORE. Update comment. * target.h: Update comment for TARGET_WAITKIND_IGNORE. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 0ab61827c77..a83927b6897 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,11 @@ +2002-12-06 Daniel Jacobowitz + + * hppah-nat.c (child_wait): Return TARGET_WAITKIND_IGNORE + for the parent's fork event. + * infrun.c (handle_inferior_event): Only expect one fork event. + Call prepare_to_wait for TARGET_WAITKIND_IGNORE. Update comment. + * target.h: Update comment for TARGET_WAITKIND_IGNORE. + 2002-12-10 Andrew Cagney * PROBLEMS: Delete reference to PR gdb/725. diff --git a/gdb/hppah-nat.c b/gdb/hppah-nat.c index d5767a9c55f..17614073e22 100644 --- a/gdb/hppah-nat.c +++ b/gdb/hppah-nat.c @@ -524,13 +524,23 @@ child_wait (ptid_t ptid, struct target_waitstatus *ourstatus) return pid_to_ptid (pid); } - if (hpux_has_forked (pid, &related_pid) - && ((pid == PIDGET (inferior_ptid)) - || (related_pid == PIDGET (inferior_ptid)))) + if (hpux_has_forked (pid, &related_pid)) { - ourstatus->kind = TARGET_WAITKIND_FORKED; - ourstatus->value.related_pid = related_pid; - return pid_to_ptid (pid); + /* Ignore the parent's fork event. */ + if (pid == PIDGET (inferior_ptid)) + { + ourstatus->kind = TARGET_WAITKIND_IGNORE; + return inferior_ptid; + } + + /* If this is the child's fork event, report that the + process has forked. */ + if (related_pid == PIDGET (inferior_ptid)) + { + ourstatus->kind = TARGET_WAITKIND_FORKED; + ourstatus->value.related_pid = pid; + return inferior_ptid; + } } if (hpux_has_vforked (pid, &related_pid) diff --git a/gdb/infrun.c b/gdb/infrun.c index 76770cc5c10..7cb9f3338ea 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -1478,24 +1478,9 @@ handle_inferior_event (struct execution_control_state *ecs) stop_signal = TARGET_SIGNAL_TRAP; pending_follow.kind = ecs->ws.kind; - /* Ignore fork events reported for the parent; we're only - interested in reacting to forks of the child. Note that - we expect the child's fork event to be available if we - waited for it now. */ - if (ptid_equal (inferior_ptid, ecs->ptid)) - { - pending_follow.fork_event.saw_parent_fork = 1; - pending_follow.fork_event.parent_pid = PIDGET (ecs->ptid); - pending_follow.fork_event.child_pid = ecs->ws.value.related_pid; - prepare_to_wait (ecs); - return; - } - else - { - pending_follow.fork_event.saw_child_fork = 1; - pending_follow.fork_event.child_pid = PIDGET (ecs->ptid); - pending_follow.fork_event.parent_pid = ecs->ws.value.related_pid; - } + pending_follow.fork_event.saw_child_fork = 1; + pending_follow.fork_event.parent_pid = PIDGET (ecs->ptid); + pending_follow.fork_event.child_pid = ecs->ws.value.related_pid; stop_pc = read_pc_pid (ecs->ptid); ecs->saved_inferior_ptid = inferior_ptid; @@ -1703,13 +1688,15 @@ handle_inferior_event (struct execution_control_state *ecs) /* We had an event in the inferior, but we are not interested in handling it at this level. The lower layers have already - done what needs to be done, if anything. This case can - occur only when the target is async or extended-async. One - of the circumstamces for this to happen is when the - inferior produces output for the console. The inferior has - not stopped, and we are ignoring the event. */ + done what needs to be done, if anything. + + One of the possible circumstances for this is when the + inferior produces output for the console. The inferior has + not stopped, and we are ignoring the event. Another possible + circumstance is any event which the lower level knows will be + reported multiple times without an intervening resume. */ case TARGET_WAITKIND_IGNORE: - ecs->wait_some_more = 1; + prepare_to_wait (ecs); return; } diff --git a/gdb/target.h b/gdb/target.h index 337ea7c2ca3..79c2eaa1c02 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -112,8 +112,8 @@ enum target_waitkind inferior. */ TARGET_WAITKIND_SPURIOUS, - /* This is used for target async and extended-async - only. Remote_async_wait() returns this when there is an event + /* An event has occured, but we should wait again. + Remote_async_wait() returns this when there is an event on the inferior, but the rest of the world is not interested in it. The inferior has not stopped, but has just sent some output to the console, for instance. In this case, we want to go back