/* Native-dependent code for GNU/Linux on MIPS processors.
- Copyright (C) 2001-2014 Free Software Foundation, Inc.
+ Copyright (C) 2001-2015 Free Software Foundation, Inc.
This file is part of GDB.
#include "gregset.h"
#include <sgidefs.h>
-#include <sys/ptrace.h>
+#include "nat/gdb_ptrace.h"
#include <asm/ptrace.h>
#include "nat/mips-linux-watch.h"
we'll clear this and use PTRACE_PEEKUSER instead. */
static int have_ptrace_regsets = 1;
-/* Whether or not to print the mirrored debug registers. */
-
-static int maint_show_dr;
-
/* Saved function pointers to fetch and store a single register using
PTRACE_PEEKUSER and PTRACE_POKEUSER. */
if (tid == 0)
tid = ptid_get_pid (inferior_ptid);
+ errno = 0;
ptrace (PTRACE_PEEKUSER, tid, DSP_CONTROL, 0);
switch (errno)
{
static int
mips_linux_can_use_hw_breakpoint (struct target_ops *self,
- int type, int cnt, int ot)
+ enum bptype type,
+ int cnt, int ot)
{
int i;
uint32_t wanted_mask, irw_mask;
ALL_LWPS (lp)
{
tid = ptid_get_lwp (lp->ptid);
- if (ptrace (PTRACE_SET_WATCH_REGS, tid, &watch_mirror) == -1)
+ if (ptrace (PTRACE_SET_WATCH_REGS, tid, &watch_mirror, NULL) == -1)
perror_with_name (_("Couldn't write debug register"));
}
return 0;
return;
tid = ptid_get_lwp (lp->ptid);
- if (ptrace (PTRACE_SET_WATCH_REGS, tid, &watch_mirror) == -1)
+ if (ptrace (PTRACE_SET_WATCH_REGS, tid, &watch_mirror, NULL) == -1)
perror_with_name (_("Couldn't write debug register"));
}
static int
mips_linux_insert_watchpoint (struct target_ops *self,
- CORE_ADDR addr, int len, int type,
+ CORE_ADDR addr, int len,
+ enum target_hw_bp_type type,
struct expression *cond)
{
struct pt_watch_regs regs;
return -1;
/* It fit. Stick it on the end of the list. */
- new_watch = (struct mips_watchpoint *)
- xmalloc (sizeof (struct mips_watchpoint));
+ new_watch = XNEW (struct mips_watchpoint);
new_watch->addr = addr;
new_watch->len = len;
new_watch->type = type;
watch_mirror = regs;
retval = write_watchpoint_regs ();
- if (maint_show_dr)
+ if (show_debug_regs)
mips_show_dr ("insert_watchpoint", addr, len, type);
return retval;
static int
mips_linux_remove_watchpoint (struct target_ops *self,
- CORE_ADDR addr, int len, int type,
+ CORE_ADDR addr, int len,
+ enum target_hw_bp_type type,
struct expression *cond)
{
int retval;
retval = write_watchpoint_regs ();
- if (maint_show_dr)
+ if (show_debug_regs)
mips_show_dr ("remove_watchpoint", addr, len, type);
return retval;
struct target_ops *t;
add_setshow_boolean_cmd ("show-debug-regs", class_maintenance,
- &maint_show_dr, _("\
+ &show_debug_regs, _("\
Set whether to show variables that mirror the mips debug registers."), _("\
Show whether to show variables that mirror the mips debug registers."), _("\
Use \"on\" to enable, \"off\" to disable.\n\