Preserve selected thread in all-stop w/ background execution
[deliverable/binutils-gdb.git] / gdb / thread.c
index 4959f938c7f33dd4fc5328803db8e8dc9c838f23..630899c8cb86301127fc214680379f9d1680dfe0 100644 (file)
@@ -1375,7 +1375,8 @@ restore_selected_frame (struct frame_id a_frame_id, int frame_level)
     }
 }
 
-scoped_restore_current_thread::~scoped_restore_current_thread ()
+void
+scoped_restore_current_thread::restore ()
 {
   /* If an entry of thread_info was previously selected, it won't be
      deleted because we've increased its refcount.  The thread represented
@@ -1402,6 +1403,22 @@ scoped_restore_current_thread::~scoped_restore_current_thread ()
       && target_has_stack
       && target_has_memory)
     restore_selected_frame (m_selected_frame_id, m_selected_frame_level);
+}
+
+scoped_restore_current_thread::~scoped_restore_current_thread ()
+{
+  if (!m_dont_restore)
+    {
+      try
+       {
+         restore ();
+       }
+      catch (const gdb_exception &ex)
+       {
+         /* We're in a dtor, there's really nothing else we can do
+            but swallow the exception.  */
+       }
+    }
 
   if (m_thread != NULL)
     m_thread->decref ();
This page took 0.024068 seconds and 4 git commands to generate.