This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] Remove delete_just_stopped_threads_infrun_breakpoints_cleanup


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=4c41382ac101f10071f92074bab7c33242ef5b15

commit 4c41382ac101f10071f92074bab7c33242ef5b15
Author: Tom Tromey <tom@tromey.com>
Date:   Wed Jan 23 18:58:32 2019 +0000

    Remove delete_just_stopped_threads_infrun_breakpoints_cleanup
    
    v3: sorted earlier in the series, and replaces the cleanup in
    fetch_inferior_event here too instead of in some other patch.
    
    This removes delete_just_stopped_threads_infrun_breakpoints_cleanup,
    replacing it with uses of scope_exit.
    
    gdb/ChangeLog:
    2019-01-23  Tom Tromey  <tom@tromey.com>
    	    Pedro Alves  <palves@redhat.com>
    
    	* infrun.c: Include "common/scope-exit.h"
    	(delete_just_stopped_threads_infrun_breakpoints_cleanup): Remove.
    	(wait_for_inferior): Use SCOPE_EXIT.
    	(fetch_inferior_event): Use scope_exit.

Diff:
---
 gdb/ChangeLog |  8 ++++++++
 gdb/infrun.c  | 21 +++++----------------
 2 files changed, 13 insertions(+), 16 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index a400cbc..6f1bcba 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,6 +1,14 @@
 2019-01-23  Tom Tromey  <tom@tromey.com>
 	    Pedro Alves  <palves@redhat.com>
 
+	* infrun.c: Include "common/scope-exit.h"
+	(delete_just_stopped_threads_infrun_breakpoints_cleanup): Remove.
+	(wait_for_inferior): Use SCOPE_EXIT.
+	(fetch_inferior_event): Use scope_exit.
+
+2019-01-23  Tom Tromey  <tom@tromey.com>
+	    Pedro Alves  <palves@redhat.com>
+
 	* breakpoint.c (create_breakpoint): Remove cleanup.
 
 2019-01-23  Tom Tromey  <tom@tromey.com>
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 1502882..065fbf0 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -67,6 +67,7 @@
 #include "progspace-and-thread.h"
 #include "common/gdb_optional.h"
 #include "arch-utils.h"
+#include "common/scope-exit.h"
 
 /* Prototypes for local functions */
 
@@ -3247,14 +3248,6 @@ delete_just_stopped_threads_single_step_breakpoints (void)
   for_each_just_stopped_thread (delete_single_step_breakpoints);
 }
 
-/* A cleanup wrapper.  */
-
-static void
-delete_just_stopped_threads_infrun_breakpoints_cleanup (void *arg)
-{
-  delete_just_stopped_threads_infrun_breakpoints ();
-}
-
 /* See infrun.h.  */
 
 void
@@ -3538,15 +3531,11 @@ prepare_for_detach (void)
 void
 wait_for_inferior (void)
 {
-  struct cleanup *old_cleanups;
-
   if (debug_infrun)
     fprintf_unfiltered
       (gdb_stdlog, "infrun: wait_for_inferior ()\n");
 
-  old_cleanups
-    = make_cleanup (delete_just_stopped_threads_infrun_breakpoints_cleanup,
-		    NULL);
+  SCOPE_EXIT { delete_just_stopped_threads_infrun_breakpoints (); };
 
   /* If an error happens while handling the event, propagate GDB's
      knowledge of the executing state to the frontend/user running
@@ -3583,8 +3572,6 @@ wait_for_inferior (void)
 
   /* No error, don't finish the state yet.  */
   finish_state.release ();
-
-  do_cleanups (old_cleanups);
 }
 
 /* Cleanup that reinstalls the readline callback handler, if the
@@ -3760,7 +3747,8 @@ fetch_inferior_event (void *client_data)
      still for the thread which has thrown the exception.  */
   struct cleanup *ts_old_chain = make_bpstat_clear_actions_cleanup ();
 
-  make_cleanup (delete_just_stopped_threads_infrun_breakpoints_cleanup, NULL);
+  auto defer_delete_threads
+    = make_scope_exit (delete_just_stopped_threads_infrun_breakpoints);
 
   /* Now figure out what to do with the result of the result.  */
   handle_inferior_event (ecs);
@@ -3813,6 +3801,7 @@ fetch_inferior_event (void *client_data)
 	}
     }
 
+  defer_delete_threads.release ();
   discard_cleanups (ts_old_chain);
 
   /* No error, don't finish the thread states yet.  */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]