/* Native-dependent code for GNU/Linux on MIPS processors.
- Copyright (C) 2001-2018 Free Software Foundation, Inc.
+ Copyright (C) 2001-2022 Free Software Foundation, Inc.
This file is part of GDB.
if (regno < 0 || regno >= gdbarch_num_regs (gdbarch))
error (_("Bogon register number %d."), regno);
+ /* On n32 we can't access 64-bit registers via PTRACE_PEEKUSR
+ or PTRACE_POKEUSR. */
+ if (register_size (gdbarch, regno) > sizeof (PTRACE_TYPE_RET))
+ return (CORE_ADDR) -1;
+
if (regno > MIPS_ZERO_REGNUM && regno < MIPS_ZERO_REGNUM + 32)
regaddr = regno;
else if ((regno >= mips_regnum (gdbarch)->fp0)
ps_err_e
ps_get_thread_area (struct ps_prochandle *ph,
- lwpid_t lwpid, int idx, void **base)
+ lwpid_t lwpid, int idx, void **base)
{
if (ptrace (PTRACE_GET_THREAD_AREA, lwpid, NULL, base) != 0)
return PS_ERR;
void
supply_fpregset (struct regcache *regcache, const gdb_fpregset_t *fpregsetp)
{
- if (mips_isa_regsize (regcache->arch ()) == 4)
- mips_supply_fpregset (regcache, (const mips_elf_fpregset_t *) fpregsetp);
- else
- mips64_supply_fpregset (regcache,
- (const mips64_elf_fpregset_t *) fpregsetp);
+ mips64_supply_fpregset (regcache, (const mips64_elf_fpregset_t *) fpregsetp);
}
void
fill_fpregset (const struct regcache *regcache,
gdb_fpregset_t *fpregsetp, int regno)
{
- if (mips_isa_regsize (regcache->arch ()) == 4)
- mips_fill_fpregset (regcache, (mips_elf_fpregset_t *) fpregsetp, regno);
- else
- mips64_fill_fpregset (regcache,
- (mips64_elf_fpregset_t *) fpregsetp, regno);
+ mips64_fill_fpregset (regcache, (mips64_elf_fpregset_t *) fpregsetp, regno);
}
else
is_dsp = 0;
- tid = get_ptrace_pid (regcache_get_ptid (regcache));
+ tid = get_ptrace_pid (regcache->ptid ());
if (regno == -1 || (!is_fp && !is_dsp))
{
else
is_dsp = 0;
- tid = get_ptrace_pid (regcache_get_ptid (regcache));
+ tid = get_ptrace_pid (regcache->ptid ());
if (regno == -1 || (!is_fp && !is_dsp))
{
if (have_dsp < 0)
{
- int tid;
-
- tid = ptid_get_lwp (inferior_ptid);
- if (tid == 0)
- tid = ptid_get_pid (inferior_ptid);
+ int tid = get_ptrace_pid (inferior_ptid);
errno = 0;
ptrace (PTRACE_PEEKUSER, tid, DSP_CONTROL, 0);
{
int i;
- puts_unfiltered (func);
+ fputs_unfiltered (func, gdb_stdlog);
if (addr || len)
- printf_unfiltered (" (addr=%s, len=%d, type=%s)",
- paddress (target_gdbarch (), addr), len,
- type == hw_write ? "data-write"
- : (type == hw_read ? "data-read"
- : (type == hw_access ? "data-read/write"
- : (type == hw_execute ? "instruction-execute"
- : "??unknown??"))));
- puts_unfiltered (":\n");
+ fprintf_unfiltered (gdb_stdlog,
+ " (addr=%s, len=%d, type=%s)",
+ paddress (target_gdbarch (), addr), len,
+ type == hw_write ? "data-write"
+ : (type == hw_read ? "data-read"
+ : (type == hw_access ? "data-read/write"
+ : (type == hw_execute ? "instruction-execute"
+ : "??unknown??"))));
+ fputs_unfiltered (":\n", gdb_stdlog);
for (i = 0; i < MAX_DEBUG_REGISTER; i++)
- printf_unfiltered ("\tDR%d: lo=%s, hi=%s\n", i,
- paddress (target_gdbarch (),
- mips_linux_watch_get_watchlo (&watch_mirror,
- i)),
- paddress (target_gdbarch (),
- mips_linux_watch_get_watchhi (&watch_mirror,
- i)));
+ fprintf_unfiltered (gdb_stdlog, "\tDR%d: lo=%s, hi=%s\n", i,
+ paddress (target_gdbarch (),
+ mips_linux_watch_get_watchlo (&watch_mirror,
+ i)),
+ paddress (target_gdbarch (),
+ mips_linux_watch_get_watchhi (&watch_mirror,
+ i)));
}
/* Target to_can_use_hw_breakpoint implementation. Return 1 if we can
int i;
uint32_t wanted_mask, irw_mask;
- if (!mips_linux_read_watch_registers (ptid_get_lwp (inferior_ptid),
+ if (!mips_linux_read_watch_registers (inferior_ptid.lwp (),
&watch_readback,
&watch_readback_valid, 0))
return 0;
int n;
int num_valid;
- if (!mips_linux_read_watch_registers (ptid_get_lwp (inferior_ptid),
+ if (!mips_linux_read_watch_registers (inferior_ptid.lwp (),
&watch_readback,
&watch_readback_valid, 1))
return false;
struct pt_watch_regs dummy_regs;
int i;
- if (!mips_linux_read_watch_registers (ptid_get_lwp (inferior_ptid),
+ if (!mips_linux_read_watch_registers (inferior_ptid.lwp (),
&watch_readback,
&watch_readback_valid, 0))
return 0;
static int
write_watchpoint_regs (void)
{
- struct lwp_info *lp;
- int tid;
-
- ALL_LWPS (lp)
+ for (const lwp_info *lp : all_lwps ())
{
- tid = ptid_get_lwp (lp->ptid);
+ int tid = lp->ptid.lwp ();
if (ptrace (PTRACE_SET_WATCH_REGS, tid, &watch_mirror, NULL) == -1)
perror_with_name (_("Couldn't write debug register"));
}
struct mips_watchpoint *new_watch;
struct mips_watchpoint **pw;
- int i;
int retval;
- if (!mips_linux_read_watch_registers (ptid_get_lwp (inferior_ptid),
+ if (!mips_linux_read_watch_registers (inferior_ptid.lwp (),
&watch_readback,
&watch_readback_valid, 0))
return -1;
linux_nat_trad_target::close ();
}
+void _initialize_mips_linux_nat ();
void
-_initialize_mips_linux_nat (void)
+_initialize_mips_linux_nat ()
{
add_setshow_boolean_cmd ("show-debug-regs", class_maintenance,
&show_debug_regs, _("\