/* Native-dependent code for SPARC.
- Copyright (C) 2003-2020 Free Software Foundation, Inc.
+ Copyright (C) 2003-2021 Free Software Foundation, Inc.
This file is part of GDB.
#define PTRACE_SETFPREGS PT_SETFPREGS
#endif
-static int
+static PTRACE_TYPE_RET
gdb_ptrace (PTRACE_TYPE_ARG1 request, ptid_t ptid, PTRACE_TYPE_ARG3 addr)
{
#ifdef __NetBSD__
for all registers (including the floating-point registers). */
void
-sparc_fetch_inferior_registers (struct regcache *regcache, int regnum)
+sparc_fetch_inferior_registers (process_stratum_target *proc_target,
+ regcache *regcache, int regnum)
{
struct gdbarch *gdbarch = regcache->arch ();
ptid_t ptid = regcache->ptid ();
if (gdb_ptrace (PTRACE_GETREGS, ptid, (PTRACE_TYPE_ARG3) ®s) == -1)
perror_with_name (_("Couldn't get registers"));
+ /* 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);
+
sparc_supply_gregset (sparc_gregmap, regcache, -1, ®s);
if (regnum != -1)
return;
}
void
-sparc_store_inferior_registers (struct regcache *regcache, int regnum)
+sparc_store_inferior_registers (process_stratum_target *proc_target,
+ regcache *regcache, int regnum)
{
struct gdbarch *gdbarch = regcache->arch ();
ptid_t ptid = regcache->ptid ();
ULONGEST sp;
regcache_cooked_read_unsigned (regcache, SPARC_SP_REGNUM, &sp);
+
+ /* 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);
+
sparc_collect_rwindow (regcache, sp, regnum);
}