@@ -6799,6 +6799,25 @@ remote_notif_get_pending_events (struct notif_client *nc)
}
}
+/* Check if the specified stop reply is for a fork event. If it is,
+ update the corresponding thread to contain the pending follow
+ information required to identify it as the fork parent. */
+
+static void
+update_thread_if_fork_parent (struct stop_reply *stop_reply)
+{
+ ptid_t ptid;
+
+ ptid = stop_reply->ptid;
+ if (stop_reply->ws.kind == TARGET_WAITKIND_FORKED
+ || stop_reply->ws.kind == TARGET_WAITKIND_VFORKED)
+ {
+ struct thread_info *tp = find_thread_ptid (ptid);
+
+ tp->pending_follow = stop_reply->ws;
+ }
+}
+
/* Called when it is decided that STOP_REPLY holds the info of the
event that is to be returned to the core. This function always
destroys STOP_REPLY. */
@@ -6844,8 +6863,11 @@ process_stop_reply (struct stop_reply *stop_reply,
remote_thr->core = stop_reply->core;
remote_thr->stop_reason = stop_reply->stop_reason;
remote_thr->watch_data_address = stop_reply->watch_data_address;
- }
+ /* Make sure we record any pending fork events. */
+ update_thread_if_fork_parent (stop_reply);
+
+ }
stop_reply_xfree (stop_reply);
return ptid;
}