From: Tom Tromey Date: Mon, 5 Feb 2018 09:59:52 +0000 (+0100) Subject: Remove make_cleanup_restore_current_thread from gdbserver X-Git-Tag: binutils-2_31~1371 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8ce47547b34fddec16d1ccd801f025a56976af95;p=external%2Fbinutils.git Remove make_cleanup_restore_current_thread from gdbserver This removes make_cleanup_restore_current_thread from gdbserver, replacing it with a use of scoped_restore. 2018-02-08 Tom Tromey * linux-low.c (install_software_single_step_breakpoints): Use make_scoped_restore. * inferiors.c (make_cleanup_restore_current_thread): Remove. (do_restore_current_thread_cleanup): Remove. * gdbthread.h (make_cleanup_restore_current_thread): Don't declare. --- diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index 145ba44..b80d820 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,5 +1,14 @@ 2018-02-08 Tom Tromey + * linux-low.c (install_software_single_step_breakpoints): Use + make_scoped_restore. + * inferiors.c (make_cleanup_restore_current_thread): Remove. + (do_restore_current_thread_cleanup): Remove. + * gdbthread.h (make_cleanup_restore_current_thread): Don't + declare. + +2018-02-08 Tom Tromey + * mem-break.c (set_raw_breakpoint_at): Use gdb::unique_xmalloc_ptr. diff --git a/gdb/gdbserver/gdbthread.h b/gdb/gdbserver/gdbthread.h index 9a8c72e..0edf870 100644 --- a/gdb/gdbserver/gdbthread.h +++ b/gdb/gdbserver/gdbthread.h @@ -224,7 +224,4 @@ lwpid_of (const thread_info *thread) return thread->id.lwp (); } -/* Create a cleanup to restore current_thread. */ -struct cleanup *make_cleanup_restore_current_thread (void); - #endif /* GDB_THREAD_H */ diff --git a/gdb/gdbserver/inferiors.c b/gdb/gdbserver/inferiors.c index 600bf20..ad3df64 100644 --- a/gdb/gdbserver/inferiors.c +++ b/gdb/gdbserver/inferiors.c @@ -213,18 +213,6 @@ current_process (void) return get_thread_process (current_thread); } -static void -do_restore_current_thread_cleanup (void *arg) -{ - current_thread = (struct thread_info *) arg; -} - -struct cleanup * -make_cleanup_restore_current_thread (void) -{ - return make_cleanup (do_restore_current_thread_cleanup, current_thread); -} - /* See common/common-gdbthread.h. */ void diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c index 38142bb..b6b660e 100644 --- a/gdb/gdbserver/linux-low.c +++ b/gdb/gdbserver/linux-low.c @@ -50,6 +50,7 @@ #include "common-inferior.h" #include "nat/fork-inferior.h" #include "environ.h" +#include "common/scoped_restore.h" #ifndef ELFMAG0 /* Don't include here. If it got included by gdb_proc_service.h then ELFMAG0 will have been defined. If it didn't get included by @@ -4207,15 +4208,14 @@ install_software_single_step_breakpoints (struct lwp_info *lwp) { struct thread_info *thread = get_lwp_thread (lwp); struct regcache *regcache = get_thread_regcache (thread, 1); - struct cleanup *old_chain = make_cleanup_restore_current_thread (); + + scoped_restore save_current_thread = make_scoped_restore (¤t_thread); current_thread = thread; std::vector next_pcs = the_low_target.get_next_pcs (regcache); for (CORE_ADDR pc : next_pcs) set_single_step_breakpoint (pc, current_ptid); - - do_cleanups (old_chain); } /* Single step via hardware or software single step.