Introduce GDB_THREAD_OPTION_EXIT thread option, fix step-over-thread-exit
[binutils-gdb.git] / gdb / remote.c
index eb537fc48a561747829555e630f4188a45faa786..ce5addade6f7c7bd3e49078ed299e319bd97c211 100644 (file)
@@ -4206,6 +4206,15 @@ remote_target::update_thread_list ()
              if (has_single_non_exited_thread (tp->inf))
                continue;
 
+             /* Do not remove the thread if we've requested to be
+                notified of its exit.  For example, the thread may be
+                displaced stepping, infrun will need to handle the
+                exit event, and displaced stepping info is recorded
+                in the thread object.  If we deleted the thread now,
+                we'd lose that info.  */
+             if ((tp->thread_options () & GDB_THREAD_OPTION_EXIT) != 0)
+               continue;
+
              /* Not found.  */
              delete_thread (tp);
            }