aboutsummaryrefslogtreecommitdiff
path: root/gdb/infrun.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/infrun.c')
-rw-r--r--gdb/infrun.c31
1 files changed, 30 insertions, 1 deletions
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 266b892..1226dc1 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -4436,6 +4436,14 @@ save_waitstatus (struct thread_info *tp, struct target_waitstatus *ws)
}
}
+/* A cleanup that disables thread create/exit events. */
+
+static void
+disable_thread_events (void *arg)
+{
+ target_thread_events (0);
+}
+
/* See infrun.h. */
void
@@ -4455,6 +4463,9 @@ stop_all_threads (void)
entry_ptid = inferior_ptid;
old_chain = make_cleanup (switch_to_thread_cleanup, &entry_ptid);
+ target_thread_events (1);
+ make_cleanup (disable_thread_events, NULL);
+
/* Request threads to stop, and then wait for the stops. Because
threads we already know about can spawn more threads while we're
trying to stop them, and we only learn about new threads when we
@@ -4532,7 +4543,8 @@ stop_all_threads (void)
{
/* All resumed threads exited. */
}
- else if (ws.kind == TARGET_WAITKIND_EXITED
+ else if (ws.kind == TARGET_WAITKIND_THREAD_EXITED
+ || ws.kind == TARGET_WAITKIND_EXITED
|| ws.kind == TARGET_WAITKIND_SIGNALLED)
{
if (debug_infrun)
@@ -4683,6 +4695,14 @@ handle_inferior_event_1 (struct execution_control_state *ecs)
return;
}
+ if (ecs->ws.kind == TARGET_WAITKIND_THREAD_EXITED)
+ {
+ if (debug_infrun)
+ fprintf_unfiltered (gdb_stdlog, "infrun: TARGET_WAITKIND_THREAD_EXITED\n");
+ prepare_to_wait (ecs);
+ return;
+ }
+
if (ecs->ws.kind == TARGET_WAITKIND_NO_RESUMED
&& target_can_async_p () && !sync_execution)
{
@@ -4887,6 +4907,15 @@ handle_inferior_event_1 (struct execution_control_state *ecs)
prepare_to_wait (ecs);
return;
+ case TARGET_WAITKIND_THREAD_CREATED:
+ if (debug_infrun)
+ fprintf_unfiltered (gdb_stdlog, "infrun: TARGET_WAITKIND_THREAD_CREATED\n");
+ if (!ptid_equal (ecs->ptid, inferior_ptid))
+ context_switch (ecs->ptid);
+ if (!switch_back_to_stepped_thread (ecs))
+ keep_going (ecs);
+ return;
+
case TARGET_WAITKIND_EXITED:
case TARGET_WAITKIND_SIGNALLED:
if (debug_infrun)