diff options
author | Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> | 2021-12-13 12:22:48 +0100 |
---|---|---|
committer | Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> | 2021-12-13 12:22:48 +0100 |
commit | 24583e45efc823c1a9ea009dfddc36f9b74dcbcd (patch) | |
tree | ac00cde441192c880eee0f36a7e4346e0ba53c58 /gdbserver/mem-break.cc | |
parent | f24791b72e764ada576901c0e866bf7768773a16 (diff) | |
download | binutils-24583e45efc823c1a9ea009dfddc36f9b74dcbcd.zip binutils-24583e45efc823c1a9ea009dfddc36f9b74dcbcd.tar.gz binutils-24583e45efc823c1a9ea009dfddc36f9b74dcbcd.tar.bz2 |
gdbserver: replace direct assignments to current_thread
Replace the direct assignments to current_thread with
switch_to_thread. Use scoped_restore_current_thread when appropriate.
There is one instance remaining in linux-low.cc's wait_for_sigstop.
This will be handled in a separate patch.
Regression-tested on X86-64 Linux using the native-gdbserver and
native-extended-gdbserver board files.
Diffstat (limited to 'gdbserver/mem-break.cc')
-rw-r--r-- | gdbserver/mem-break.cc | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/gdbserver/mem-break.cc b/gdbserver/mem-break.cc index 8f2688e..406594c 100644 --- a/gdbserver/mem-break.cc +++ b/gdbserver/mem-break.cc @@ -1501,13 +1501,12 @@ delete_single_step_breakpoints (struct thread_info *thread) if (bp->type == single_step_breakpoint && ((struct single_step_breakpoint *) bp)->ptid == ptid_of (thread)) { - struct thread_info *saved_thread = current_thread; + scoped_restore_current_thread restore_thread; - current_thread = thread; + switch_to_thread (thread); *bp_link = bp->next; release_breakpoint (proc, bp); bp = *bp_link; - current_thread = saved_thread; } else { @@ -1603,11 +1602,10 @@ uninsert_single_step_breakpoints (struct thread_info *thread) reinsert breakpoint. */ if (bp->raw->refcount == 1) { - struct thread_info *saved_thread = current_thread; + scoped_restore_current_thread restore_thread; - current_thread = thread; + switch_to_thread (thread); uninsert_raw_breakpoint (bp->raw); - current_thread = saved_thread; } } } @@ -1709,11 +1707,10 @@ reinsert_single_step_breakpoints (struct thread_info *thread) if (bp->raw->refcount == 1) { - struct thread_info *saved_thread = current_thread; + scoped_restore_current_thread restore_thread; - current_thread = thread; + switch_to_thread (thread); reinsert_raw_breakpoint (bp->raw); - current_thread = saved_thread; } } } |