aboutsummaryrefslogtreecommitdiff
path: root/gdb/x86-nat.c
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2018-03-03 21:25:33 -0800
committerJohn Baldwin <jhb@FreeBSD.org>2018-03-03 21:25:33 -0800
commit12279366d71627bfbdd74d1a6675dca825d8feca (patch)
treee15692d8fa4694fb384cd0ef3c19d2b1c5a1dcc0 /gdb/x86-nat.c
parent72f53f22dfc1bb79ae0141a91b8f9786e1964f41 (diff)
downloadbinutils-12279366d71627bfbdd74d1a6675dca825d8feca.zip
binutils-12279366d71627bfbdd74d1a6675dca825d8feca.tar.gz
binutils-12279366d71627bfbdd74d1a6675dca825d8feca.tar.bz2
Implement "to_stopped_by_hw_breakpoint" for x86 debug registers.
Report that a thread is stopped by a hardware breakpoint if a non-data watchpoint is set in DR6. This change should be a no-op since a target still needs to implement the "to_supports_stopped_by_hw_breakpoint" method before this function is used. gdb/ChangeLog: * nat/x86-dregs.c (x86_dr_stopped_by_hw_breakpoint): New function. * nat/x86-dregs.h (x86_dr_stopped_by_hw_breakpoint): New prototype. * x86-nat.c (x86_stopped_by_hw_breakpoint): New function. (x86_use_watchpoints): Set "stopped_by_hw_breakpoint" target method.
Diffstat (limited to 'gdb/x86-nat.c')
-rw-r--r--gdb/x86-nat.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/gdb/x86-nat.c b/gdb/x86-nat.c
index b126c47..bec5137 100644
--- a/gdb/x86-nat.c
+++ b/gdb/x86-nat.c
@@ -260,6 +260,18 @@ x86_can_use_hw_breakpoint (struct target_ops *self,
return 1;
}
+/* Return non-zero if the inferior has some breakpoint that triggered.
+ Otherwise return zero. */
+
+static int
+x86_stopped_by_hw_breakpoint (struct target_ops *ops)
+{
+ struct x86_debug_reg_state *state
+ = x86_debug_reg_state (ptid_get_pid (inferior_ptid));
+
+ return x86_dr_stopped_by_hw_breakpoint (state);
+}
+
static void
add_show_debug_regs_command (void)
{
@@ -297,6 +309,11 @@ x86_use_watchpoints (struct target_ops *t)
t->to_remove_watchpoint = x86_remove_watchpoint;
t->to_insert_hw_breakpoint = x86_insert_hw_breakpoint;
t->to_remove_hw_breakpoint = x86_remove_hw_breakpoint;
+
+ /* A target must provide an implementation of the
+ "to_supports_stopped_by_hw_breakpoint" target method before this
+ callback will be used. */
+ t->to_stopped_by_hw_breakpoint = x86_stopped_by_hw_breakpoint;
}
void