diff --git a/gdb/ChangeLog b/gdb/ChangeLog index dcb97ae0461..32108023aa2 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +2021-06-07 Simon Marchi + + PR gdb/27899 + * sparc-nat.c (sparc_fetch_inferior_registers): Set + inferior_ptid instead of using switch_to_thread. + (sparc_store_inferior_registers): Likewise. + 2021-06-05 Bernd Edlinger * compile/compile.c (scoped_ignore_sigpipe): New helper class. diff --git a/gdb/sparc-nat.c b/gdb/sparc-nat.c index fa3b32cee18..7f09a60420d 100644 --- a/gdb/sparc-nat.c +++ b/gdb/sparc-nat.c @@ -170,9 +170,8 @@ sparc_fetch_inferior_registers (process_stratum_target *proc_target, /* Deep down, sparc_supply_rwindow reads memory, so needs the global thread context to be set. */ - thread_info *thread = find_thread_ptid (proc_target, ptid); - scoped_restore_current_thread restore_thread; - switch_to_thread (thread); + scoped_restore restore_inferior_ptid + = make_scoped_restore (&inferior_ptid, ptid); sparc_supply_gregset (sparc_gregmap, regcache, -1, ®s); if (regnum != -1) @@ -219,9 +218,8 @@ sparc_store_inferior_registers (process_stratum_target *proc_target, /* Deep down, sparc_collect_rwindow writes memory, so needs the global thread context to be set. */ - thread_info *thread = find_thread_ptid (proc_target, ptid); - scoped_restore_current_thread restore_thread; - switch_to_thread (thread); + scoped_restore restore_inferior_ptid + = make_scoped_restore (&inferior_ptid, ptid); sparc_collect_rwindow (regcache, sp, regnum); }