/* Native-dependent code for x86 (i386 and x86-64).
- Copyright (C) 2001-2014 Free Software Foundation, Inc.
+ Copyright (C) 2001-2016 Free Software Foundation, Inc.
This file is part of GDB.
The functions below implement debug registers sharing by reference
counts, and allow to watch regions up to 16 bytes long. */
-/* Whether or not to print the mirrored debug registers. */
-int debug_hw_points;
-
/* Low-level function vector. */
struct x86_dr_low_type x86_dr_low;
static struct x86_process_info *
x86_add_process (pid_t pid)
{
- struct x86_process_info *proc;
+ struct x86_process_info *proc = XCNEW (struct x86_process_info);
- proc = xcalloc (1, sizeof (*proc));
proc->pid = pid;
-
proc->next = x86_process_list;
x86_process_list = proc;
return &x86_process_info_get (pid)->state;
}
-/* See declaration in i386-nat.h. */
+/* See declaration in x86-nat.h. */
void
x86_forget_process (pid_t pid)
of the type TYPE. Return 0 on success, -1 on failure. */
static int
-x86_insert_watchpoint (struct target_ops *self,
- CORE_ADDR addr, int len, int type,
- struct expression *cond)
+x86_insert_watchpoint (struct target_ops *self, CORE_ADDR addr, int len,
+ enum target_hw_bp_type type, struct expression *cond)
{
struct x86_debug_reg_state *state
= x86_debug_reg_state (ptid_get_pid (inferior_ptid));
address ADDR, whose length is LEN bytes, and for accesses of the
type TYPE. Return 0 on success, -1 on failure. */
static int
-x86_remove_watchpoint (struct target_ops *self,
- CORE_ADDR addr, int len, int type,
- struct expression *cond)
+x86_remove_watchpoint (struct target_ops *self, CORE_ADDR addr, int len,
+ enum target_hw_bp_type type, struct expression *cond)
{
struct x86_debug_reg_state *state
= x86_debug_reg_state (ptid_get_pid (inferior_ptid));
return x86_dr_stopped_by_watchpoint (state);
}
-/* Insert a hardware-assisted breakpoint at BP_TGT->placed_address.
+/* Insert a hardware-assisted breakpoint at BP_TGT->reqstd_address.
Return 0 on success, EBUSY on failure. */
static int
struct x86_debug_reg_state *state
= x86_debug_reg_state (ptid_get_pid (inferior_ptid));
+ bp_tgt->placed_address = bp_tgt->reqstd_address;
return x86_dr_insert_watchpoint (state, hw_execute,
bp_tgt->placed_address, 1) ? EBUSY : 0;
}
extreme example, consider the case where all the watchpoints watch
the same address and the same region length: then we can handle a
virtually unlimited number of watchpoints, due to debug register
- sharing implemented via reference counts in i386-nat.c. */
+ sharing implemented via reference counts in x86-nat.c. */
static int
x86_can_use_hw_breakpoint (struct target_ops *self,
- int type, int cnt, int othertype)
+ enum bptype type, int cnt, int othertype)
{
return 1;
}
/* A maintenance command to enable printing the internal DRi mirror
variables. */
add_setshow_boolean_cmd ("show-debug-regs", class_maintenance,
- &debug_hw_points, _("\
+ &show_debug_regs, _("\
Set whether to show variables that mirror the x86 debug registers."), _("\
Show whether to show variables that mirror the x86 debug registers."), _("\
Use \"on\" to enable, \"off\" to disable.\n\