This is the mail archive of the
mailing list for the GDB project.
Re: [RFA/commit] arm-tdep.c: Do not single-step after hitting a watchpoint
- From: Peter Maydell <peter dot maydell at linaro dot org>
- To: Pedro Alves <palves at redhat dot com>
- Cc: Joel Brobecker <brobecker at adacore dot com>, Marcus Shawcroft <marcus dot shawcroft at gmail dot com>, 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, gdb-patches at sourceware dot org, Will Deacon <Will dot Deacon at arm dot com>, "Gareth, McMullin" <gareth at blacksphere dot co dot nz>
- Date: Tue, 30 Sep 2014 11:00:49 +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> <5429D9FC dot 6000509 at redhat dot com> <CAFEAcA9Dx5GE6QCktvbQF8sL1MsRxE5BmPNruSw4FsW9VyD_2w at mail dot gmail dot com> <542A72F9 dot 5090203 at redhat dot com>
On 30 September 2014 10:08, Pedro Alves <email@example.com> wrote:
> On 09/29/2014 11:53 PM, Peter Maydell wrote:
>> There's an assertion in this LKML post from 2010:
>> that v7 cores do actually all generate synchronous
>> watchpoint exceptions (even though architecturally
>> they're permitted not to). Was your test h/w a v6?
> Joel's test was against qemu (without your patch).
> Terry's tests were against armv7l and armv8. Both synchronous.
> The report that confuses me is Gareth's:
> As it sounds like he has v7-m hardware that has asynchronous
> behavior. Gareth, can you confirm this, please?
In general it's unwise to assume that statements
about the ARM A and R profiles carry across to M
profile... v7M profile watchpoints are rather
different from v7AR watchpoints in terms of how you
set them, how they're reported, etc, and they're
always asynchronous (other insns may execute after
the one which triggers the wp before the debug event
> Still, in any case, from that LKML post:
> "v6 cores are the opposite; they only generate asynchronous
> watchpoint exceptions".
> So, eh!? Does your qemu patch take this into account? Seems
> like it should.
My QEMU patch is for the built in gdbstub, which is
completely different code to the emulation of the
CPU's own architected debug hardware. (We implement
the latter only for v7 and above, not v6.)
It doesn't seem very sensible to me to deliberately
provide unhelpful asynchronous watchpoint support
on v6-and-lower guest CPUs just because that's what
the hardware does, especially since it would mean we
wouldn't interoperate with current gdb. (Similarly,
we provide watchpoint support in our stub even if
the CPU we're emulating has no watchpoint support
of its own at all. Think of us as like a JTAG probe.)
> Now I'm confused on the mention of the Linux kernel
> subtracting 8 from the PC to help GDB. I can't find that
> anywhere in the kernel's sources.
This is a reference to the standard ARM exception
entry behaviour where the value saved to the link
register may be +2, +4 or +8 from the "preferred
return address" for the exception. The kernel handles
this via a 'vector_stub' macro that adjusts the
value read from LR so the rest of the kernel can
deal simply in preferred return addresses. Since
sync. watchpoints are a kind of data abort they
go through here, with a correction value of 8: