aboutsummaryrefslogtreecommitdiff
path: root/gdbserver
diff options
context:
space:
mode:
authorTankut Baris Aktemur <tankut.baris.aktemur@intel.com>2021-12-13 12:22:48 +0100
committerTankut Baris Aktemur <tankut.baris.aktemur@intel.com>2021-12-13 12:22:48 +0100
commit20ac1cdb8c76397a314c248c3db733d7db1f8339 (patch)
treee55d2dfd4c25659880399fa2fa99f69876b7b571 /gdbserver
parent24583e45efc823c1a9ea009dfddc36f9b74dcbcd (diff)
downloadgdb-20ac1cdb8c76397a314c248c3db733d7db1f8339.zip
gdb-20ac1cdb8c76397a314c248c3db733d7db1f8339.tar.gz
gdb-20ac1cdb8c76397a314c248c3db733d7db1f8339.tar.bz2
gdbserver/linux-low: replace direct assignment to current_thread
Use scoped_restore_current_thread and switch_to_thread in linux_process_target::wait_for_sigstop.
Diffstat (limited to 'gdbserver')
-rw-r--r--gdbserver/linux-low.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/gdbserver/linux-low.cc b/gdbserver/linux-low.cc
index 373bacb..185dab4 100644
--- a/gdbserver/linux-low.cc
+++ b/gdbserver/linux-low.cc
@@ -3826,6 +3826,8 @@ linux_process_target::wait_for_sigstop ()
else
saved_tid = null_ptid; /* avoid bogus unused warning */
+ scoped_restore_current_thread restore_thread;
+
if (debug_threads)
debug_printf ("wait_for_sigstop: pulling events\n");
@@ -3836,7 +3838,7 @@ linux_process_target::wait_for_sigstop ()
gdb_assert (ret == -1);
if (saved_thread == NULL || mythread_alive (saved_tid))
- current_thread = saved_thread;
+ return;
else
{
if (debug_threads)
@@ -3845,7 +3847,8 @@ linux_process_target::wait_for_sigstop ()
/* We can't change the current inferior behind GDB's back,
otherwise, a subsequent command may apply to the wrong
process. */
- current_thread = NULL;
+ restore_thread.dont_restore ();
+ switch_to_thread (nullptr);
}
}