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/inferiors.cc | |
parent | f24791b72e764ada576901c0e866bf7768773a16 (diff) | |
download | gdb-24583e45efc823c1a9ea009dfddc36f9b74dcbcd.zip gdb-24583e45efc823c1a9ea009dfddc36f9b74dcbcd.tar.gz gdb-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/inferiors.cc')
-rw-r--r-- | gdbserver/inferiors.cc | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/gdbserver/inferiors.cc b/gdbserver/inferiors.cc index d44e40a..b6cf100 100644 --- a/gdbserver/inferiors.cc +++ b/gdbserver/inferiors.cc @@ -41,7 +41,7 @@ add_thread (ptid_t thread_id, void *target_data) all_threads.push_back (new_thread); if (current_thread == NULL) - current_thread = new_thread; + switch_to_thread (new_thread); return new_thread; } @@ -99,7 +99,7 @@ remove_thread (struct thread_info *thread) discard_queued_stop_replies (ptid_of (thread)); all_threads.remove (thread); if (current_thread == thread) - current_thread = NULL; + switch_to_thread (nullptr); free_one_thread (thread); } @@ -129,7 +129,7 @@ clear_inferiors (void) clear_dlls (); - current_thread = NULL; + switch_to_thread (nullptr); } struct process_info * @@ -215,7 +215,7 @@ void switch_to_thread (process_stratum_target *ops, ptid_t ptid) { gdb_assert (ptid != minus_one_ptid); - current_thread = find_thread_ptid (ptid); + switch_to_thread (find_thread_ptid (ptid)); } /* See gdbthread.h. */ @@ -233,7 +233,7 @@ switch_to_process (process_info *proc) { int pid = pid_of (proc); - current_thread = find_any_thread_of_pid (pid); + switch_to_thread (find_any_thread_of_pid (pid)); } /* See gdbsupport/common-inferior.h. */ |