From d01c5877664024043f4e5920d072c5f62fc7f89a Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Wed, 23 Jan 2019 22:23:15 -0700 Subject: [PATCH] Remove cleanup from solib-svr4.c This removes a cleanup from solib-svr4.c, replacing it with make_scope_exit. 2019-03-06 Tom Tromey * solib-svr4.c (disable_probes_interface): Remove parameter. (svr4_handle_solib_event): Use make_scope_exit. --- gdb/ChangeLog | 5 +++++ gdb/solib-svr4.c | 40 ++++++++++------------------------------ 2 files changed, 15 insertions(+), 30 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 2d7e3289525..e7c6a18bd23 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2019-03-06 Tom Tromey + + * solib-svr4.c (disable_probes_interface): Remove parameter. + (svr4_handle_solib_event): Use make_scope_exit. + 2019-03-06 Tom Tromey * remote.c (struct stop_reply_deleter): Remove. diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c index 787b98ba266..2b370ef96d0 100644 --- a/gdb/solib-svr4.c +++ b/gdb/solib-svr4.c @@ -1826,7 +1826,7 @@ solist_update_incremental (struct svr4_info *info, CORE_ADDR lm) ones set up for the probes-based interface are adequate. */ static void -disable_probes_interface_cleanup (void *arg) +disable_probes_interface () { struct svr4_info *info = get_svr4_info (); @@ -1847,7 +1847,6 @@ svr4_handle_solib_event (void) struct svr4_info *info = get_svr4_info (); struct probe_and_action *pa; enum probe_action action; - struct cleanup *old_chain; struct value *val = NULL; CORE_ADDR pc, debug_base, lm = 0; struct frame_info *frame = get_current_frame (); @@ -1858,26 +1857,20 @@ svr4_handle_solib_event (void) /* If anything goes wrong we revert to the original linker interface. */ - old_chain = make_cleanup (disable_probes_interface_cleanup, NULL); + auto cleanup = make_scope_exit (disable_probes_interface); pc = regcache_read_pc (get_current_regcache ()); pa = solib_event_probe_at (info, pc); if (pa == NULL) - { - do_cleanups (old_chain); - return; - } + return; action = solib_event_probe_action (pa); if (action == PROBES_INTERFACE_FAILED) - { - do_cleanups (old_chain); - return; - } + return; if (action == DO_NOTHING) { - discard_cleanups (old_chain); + cleanup.release (); return; } @@ -1907,25 +1900,16 @@ svr4_handle_solib_event (void) END_CATCH if (val == NULL) - { - do_cleanups (old_chain); - return; - } + return; debug_base = value_as_address (val); if (debug_base == 0) - { - do_cleanups (old_chain); - return; - } + return; /* Always locate the debug struct, in case it moved. */ info->debug_base = 0; if (locate_base (info) == 0) - { - do_cleanups (old_chain); - return; - } + return; /* GDB does not currently support libraries loaded via dlmopen into namespaces other than the initial one. We must ignore @@ -1943,7 +1927,6 @@ svr4_handle_solib_event (void) CATCH (ex, RETURN_MASK_ERROR) { exception_print (gdb_stderr, ex); - do_cleanups (old_chain); return; } END_CATCH @@ -1968,13 +1951,10 @@ svr4_handle_solib_event (void) if (action == FULL_RELOAD) { if (!solist_update_full (info)) - { - do_cleanups (old_chain); - return; - } + return; } - discard_cleanups (old_chain); + cleanup.release (); } /* Helper function for svr4_update_solib_event_breakpoints. */ -- 2.30.2