Patchwork [v3,13/17] Remove cleanup from stop_all_threads

login
register
mail settings
Submitter Pedro Alves
Date Jan. 23, 2019, 3:21 p.m.
Message ID <20190123152131.29893-14-palves@redhat.com>
Download mbox | patch
Permalink /patch/31190/
State New
Headers show

Comments

Pedro Alves - Jan. 23, 2019, 3:21 p.m.
From: Tom Tromey <tom@tromey.com>

This removes the cleanup from stop_all_threads, replacing it with a
scope_exit.

gdb/ChangeLog
yyyy-mm-dd  Tom Tromey  <tom@tromey.com>
	    Pedro Alves  <palves@redhat.com>

	* infrun.c (disable_thread_events): Delete.
	(stop_all_threads): Use SCOPE_EXIT.
---
 gdb/infrun.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

Patch

diff --git a/gdb/infrun.c b/gdb/infrun.c
index 76dedd272a..d954eae6ed 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -4273,14 +4273,6 @@  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
@@ -4289,7 +4281,6 @@  stop_all_threads (void)
   /* We may need multiple passes to discover all threads.  */
   int pass;
   int iterations = 0;
-  struct cleanup *old_chain;
 
   gdb_assert (target_is_non_stop_p ());
 
@@ -4299,7 +4290,7 @@  stop_all_threads (void)
   scoped_restore_current_thread restore_thread;
 
   target_thread_events (1);
-  old_chain = make_cleanup (disable_thread_events, NULL);
+  SCOPE_EXIT { target_thread_events (0); };
 
   /* Request threads to stop, and then wait for the stops.  Because
      threads we already know about can spawn more threads while we're
@@ -4484,8 +4475,6 @@  stop_all_threads (void)
 	}
     }
 
-  do_cleanups (old_chain);
-
   if (debug_infrun)
     fprintf_unfiltered (gdb_stdlog, "infrun: stop_all_threads done\n");
 }