* infrun.c (prepare_for_detach): In non-stop, context switch to
authorPedro Alves <palves@redhat.com>
Sat, 1 May 2010 15:56:52 +0000 (15:56 +0000)
committerPedro Alves <palves@redhat.com>
Sat, 1 May 2010 15:56:52 +0000 (15:56 +0000)
the thread that got the event before handling the event.

gdb/ChangeLog
gdb/infrun.c

index f13b2a8cf27737b06bb73b840509e1e2c3a27dbd..90921778b3f235f5d95364b0da6023c28b41b805 100644 (file)
@@ -1,3 +1,8 @@
+2010-05-01  Pedro Alves  <pedro@codesourcery.com>
+
+       * infrun.c (prepare_for_detach): In non-stop, context switch to
+       the thread that got the event before handling the event.
+
 2010-04-30  Tom Tromey  <tromey@redhat.com>
 
        * symtab.c (symbol_set_names): Fix typo.
index 5882cb81357cf10357acaca78be185783f8b973b..93f50eb94cb5059d711a78571536b2cbcd1deeff 100644 (file)
@@ -2368,6 +2368,14 @@ prepare_for_detach (void)
         state.  */
       old_chain_2 = make_cleanup (finish_thread_state_cleanup, &minus_one_ptid);
 
+      /* In non-stop mode, each thread is handled individually.
+        Switch early, so the global state is set correctly for this
+        thread.  */
+      if (non_stop
+         && ecs->ws.kind != TARGET_WAITKIND_EXITED
+         && ecs->ws.kind != TARGET_WAITKIND_SIGNALLED)
+       context_switch (ecs->ptid);
+
       /* Now figure out what to do with the result of the result.  */
       handle_inferior_event (ecs);