X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Fmips-linux-nat.c;h=bfe9fcbe687724349f19ad4ea0267df9d1c0c6a7;hb=0154d99053a95392380cd4629a89b0ac46df3737;hp=d8781fc6543bdeaa0c9872e2a6b0a84fd8c7a946;hpb=7bb99c53837248382434ccf26f50b42e69d0b874;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/mips-linux-nat.c b/gdb/mips-linux-nat.c index d8781fc654..bfe9fcbe68 100644 --- a/gdb/mips-linux-nat.c +++ b/gdb/mips-linux-nat.c @@ -1,6 +1,6 @@ /* Native-dependent code for GNU/Linux on MIPS processors. - Copyright (C) 2001-2014 Free Software Foundation, Inc. + Copyright (C) 2001-2016 Free Software Foundation, Inc. This file is part of GDB. @@ -20,7 +20,6 @@ #include "defs.h" #include "command.h" #include "gdbcmd.h" -#include "gdb_assert.h" #include "inferior.h" #include "mips-tdep.h" #include "target.h" @@ -33,10 +32,10 @@ #include "gregset.h" #include -#include +#include "nat/gdb_ptrace.h" #include -#include "mips-linux-watch.h" +#include "nat/mips-linux-watch.h" #include "features/mips-linux.c" #include "features/mips-dsp-linux.c" @@ -51,10 +50,6 @@ 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. */ @@ -63,7 +58,7 @@ static void (*super_fetch_registers) (struct target_ops *, static void (*super_store_registers) (struct target_ops *, struct regcache *, int); -static void (*super_close) (void); +static void (*super_close) (struct target_ops *); /* Map gdb internal register number to ptrace ``address''. These ``addresses'' are normally defined in . @@ -440,6 +435,7 @@ mips_linux_read_description (struct target_ops *ops) if (tid == 0) tid = ptid_get_pid (inferior_ptid); + errno = 0; ptrace (PTRACE_PEEKUSER, tid, DSP_CONTROL, 0); switch (errno) { @@ -513,7 +509,8 @@ mips_show_dr (const char *func, CORE_ADDR addr, 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; @@ -589,7 +586,8 @@ mips_linux_stopped_data_address (struct target_ops *t, CORE_ADDR *paddr) the specified region can be covered by the watch registers. */ static int -mips_linux_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len) +mips_linux_region_ok_for_hw_watchpoint (struct target_ops *self, + CORE_ADDR addr, int len) { struct pt_watch_regs dummy_regs; int i; @@ -617,7 +615,7 @@ write_watchpoint_regs (void) 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; @@ -637,7 +635,7 @@ mips_linux_new_thread (struct lwp_info *lp) 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")); } @@ -646,7 +644,8 @@ mips_linux_new_thread (struct lwp_info *lp) 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; @@ -674,8 +673,7 @@ mips_linux_insert_watchpoint (struct target_ops *self, 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; @@ -689,7 +687,7 @@ mips_linux_insert_watchpoint (struct target_ops *self, 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; @@ -700,7 +698,8 @@ mips_linux_insert_watchpoint (struct target_ops *self, 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; @@ -737,7 +736,7 @@ mips_linux_remove_watchpoint (struct target_ops *self, retval = write_watchpoint_regs (); - if (maint_show_dr) + if (show_debug_regs) mips_show_dr ("remove_watchpoint", addr, len, type); return retval; @@ -763,7 +762,7 @@ mips_linux_close (struct target_ops *self) current_watches = NULL; if (super_close) - super_close (); + super_close (self); } void _initialize_mips_linux_nat (void); @@ -774,7 +773,7 @@ _initialize_mips_linux_nat (void) 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\