[RFA/commit] arm-tdep.c: Do not single-step after hitting a watchpoint.

Joel Brobecker
2014-09-15T13:01:17Z

Hello!

Re: question about ARM watchpoints
https://www.sourceware.org/ml/gdb/2014-09/msg00000.html

This patch fixes an issue with watchpoints on ARM targets, where
the debugger stops 2 instructions after the instruction causing
the watchpoint. GDB is expected to stop at the next instruction.

The problem is caused by the fact that GDB does an extra single-step
after receiving the watchpoint notification, because the
have_nonsteppable_watchpoint gdbarch attribute is set for ARM
targets. Our experiments indicate that this is incorrect, at
least for the versions of ARM that we tested on (ARMv7). We tried
to get confirmation of this through the ARM documentation, but
did not manage to get a clear answer. So, in light of evidence
that the current code is wrong for some versions of ARM, and
with the lack of evidence regarding the versions of ARM we could
not test on, this patch simply unsets this gdbarch attribute
for all versions of ARM. The plan is to refine this later on
if/when we find that some systems behave differently.

gdb/ChangeLog:

* arm-tdep.c (arm_gdbarch_init): Remove call to
set_gdbarch_have_nonsteppable_watchpoint.

Unless there are comments, I will commit the patch in a week.

Thank you!

---
gdb/arm-tdep.c | 3 ---
1 file changed, 3 deletions(-)

diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index f9feb52..990c4ad 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -10446,9 +10446,6 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
if (tdep->arm_abi == ARM_ABI_AUTO)
tdep->arm_abi = ARM_ABI_APCS;

- /* Watchpoints are not steppable. */
- set_gdbarch_have_nonsteppable_watchpoint (gdbarch, 1);
-
/* We used to default to FPA for generic ARM, but almost nobody
uses that now, and we now provide a way for the user to force
the model. So default to the most useful variant. */
--
1.9.1