aboutsummaryrefslogtreecommitdiff
path: root/gdb/riscv-tdep.c
diff options
context:
space:
mode:
authorJoel Brobecker <brobecker@adacore.com>2018-10-23 11:27:50 +0100
committerAndrew Burgess <andrew.burgess@embecosm.com>2018-10-23 11:31:27 +0100
commit5a77b1b49f49cc5cfdb30727d8fc1bf456cad429 (patch)
treeacd4eafe55849313bcf7cbf15b51623de68aec20 /gdb/riscv-tdep.c
parent0dbfcfffe9abbc5198bce95eb8c66b6bc9b364be (diff)
downloadgdb-5a77b1b49f49cc5cfdb30727d8fc1bf456cad429.zip
gdb-5a77b1b49f49cc5cfdb30727d8fc1bf456cad429.tar.gz
gdb-5a77b1b49f49cc5cfdb30727d8fc1bf456cad429.tar.bz2
gdb/riscv: expect h/w watchpoints to trigger before the memory is written
When using QEMU as a RISCV simulator, hardware watchpoint events are reported to GDB before the target memory gets written. GDB currently expects the event to be reported after it is written. As a result of this mismatch, upon receiving the event, GDB sees that the target memory region has not changed, and therefore decides to ignore the event. It therefore resumes the program's execution with a continue, which is the start of an infinite loop between QEMU repeatedly reporting the same watchpoint event over and over, and GDB repeatedly ignoring it. This patch fixes the issue by telling GDB to expect the watchpoint event to be reported ahead of the memory region being modified. Upon receiving the event, GDB then single-steps the program before checking the watched memory value. gdb/ChangeLog: * riscv-tdep.c (riscv_gdbarch_init): Set the gdbarch's have_nonsteppable_watchpoint attribute to 1.
Diffstat (limited to 'gdb/riscv-tdep.c')
-rw-r--r--gdb/riscv-tdep.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/gdb/riscv-tdep.c b/gdb/riscv-tdep.c
index 2fd335a..48ca2ac 100644
--- a/gdb/riscv-tdep.c
+++ b/gdb/riscv-tdep.c
@@ -2856,6 +2856,7 @@ riscv_gdbarch_init (struct gdbarch_info info,
set_gdbarch_return_value (gdbarch, riscv_return_value);
set_gdbarch_breakpoint_kind_from_pc (gdbarch, riscv_breakpoint_kind_from_pc);
set_gdbarch_sw_breakpoint_from_kind (gdbarch, riscv_sw_breakpoint_from_kind);
+ set_gdbarch_have_nonsteppable_watchpoint (gdbarch, 1);
/* Register architecture. */
set_gdbarch_num_regs (gdbarch, RISCV_LAST_REGNUM + 1);