This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA/commit] arm-tdep.c: Do not single-step after hitting a watchpoint
- From: Will Deacon <will dot deacon at arm dot com>
- To: Pedro Alves <palves at redhat dot com>
- Cc: Peter Maydell <peter dot maydell at linaro dot org>, Joel Brobecker <brobecker at adacore dot com>, Marcus Shawcroft <marcus dot shawcroft at gmail dot com>, Terry Guo <Terry dot Guo at arm dot com>, Marcus Shawcroft <Marcus dot Shawcroft at arm dot com>, "lgustavo at codesourcery dot com" <lgustavo at codesourcery dot com>, "yao at codesourcery dot com" <yao at codesourcery dot com>, "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>, "Gareth, McMullin" <gareth at blacksphere dot co dot nz>
- Date: Tue, 30 Sep 2014 10:24:16 +0100
- Subject: Re: [RFA/commit] arm-tdep.c: Do not single-step after hitting a watchpoint
- Authentication-results: sourceware.org; auth=none
- References: <CAFEAcA_0C+UqGwM39A4EQCQLg59fNbJ2du8rhrt++Q-pdE9rgQ at mail dot gmail dot com> <20140930085746 dot GC8075 at arm dot com> <542A746C dot 5010901 at redhat dot com>
On Tue, Sep 30, 2014 at 10:14:20AM +0100, Pedro Alves wrote:
> On 09/30/2014 09:57 AM, Will Deacon wrote:
> > On Mon, Sep 29, 2014 at 07:23:05PM +0100, Peter Maydell wrote:
> >> Joel Brobecker wrote:
> >>> I have been trying to understand the various contributions, and
> >>> I admit I am still not quite sure...
> >>>
> >>> Does it look like the patch I proposed is correct? It seems to be
> >>> supported by Terry Guo's experiments as well...
> >>
> >> Note that the ARMv7 architecture allows watchpoints to
> >> be implemented as *asynchronous*, in which case what
> >> you will see is that you take a watchpoint exception
> >> but it may not fire until after the instruction that
> >> triggers the watchpoint and possibly several following
> >> instructions have all finished execution. This may be
> >> what you are seeing in your hardware tests.
> >
> > No you won't; the kernel will swallow the async watchpoint and complain in
> > dmesg.
>
> It doesn't seem to swallow it; only warn. In hw_breakpoint_pending:
>
>
> /* Perform perf callbacks. */
> switch (ARM_DSCR_MOE(dscr)) {
> case ARM_ENTRY_BREAKPOINT:
> breakpoint_handler(addr, regs);
> break;
> case ARM_ENTRY_ASYNC_WATCHPOINT:
> WARN(1, "Asynchronous watchpoint exception taken. Debugging results may be unreliable\n");
> case ARM_ENTRY_SYNC_WATCHPOINT:
> watchpoint_handler(addr, fsr, regs);
> break;
>
> Note the fallthrough.
>
> In any case, GDB has to care about halt mode, jtag, system, etc.
> debugging, not just Linux.
>
> > I'm not aware of any CPU implementations that actually generate these.
>
> Thanks. Until we hear a clearer report otherwise, that's what I'll
> assume going forward.
Now that I've realised you were also talking about ARMv6, I should clarify
that I was only referring to v7-A (and v8, since that's architected) CPUs.
For v6, all watchpoint exceptions are reported via the asynchronous method.
You can use the WFAR register to determine the instruction responsible for
the fault.
Will