Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Joel Brobecker <brobecker@adacore.com>,
	       Marcus Shawcroft <marcus.shawcroft@gmail.com>,
	Terry.Guo@arm.com,
	       Marcus Shawcroft <Marcus.Shawcroft@arm.com>,
	       "lgustavo@codesourcery.com" <lgustavo@codesourcery.com>,
	       yao@codesourcery.com, gdb-patches@sourceware.org,
	       Will Deacon <Will.Deacon@arm.com>,
	       "Gareth, McMullin" <gareth@blacksphere.co.nz>
Subject: Re: [RFA/commit] arm-tdep.c: Do not single-step after hitting a watchpoint
Date: Tue, 30 Sep 2014 09:08:00 -0000	[thread overview]
Message-ID: <542A72F9.5090203@redhat.com> (raw)
In-Reply-To: <CAFEAcA9Dx5GE6QCktvbQF8sL1MsRxE5BmPNruSw4FsW9VyD_2w@mail.gmail.com>

On 09/29/2014 11:53 PM, Peter Maydell wrote:
> On 29 September 2014 23:15, Pedro Alves <palves@redhat.com> wrote:
>> On 09/29/2014 07:23 PM, Peter Maydell wrote:


>> "Incorrect" may be too strong then, but understood.
> 
> I wrote the QEMU patch; I'm happy to call our old
> behaviour incorrect :-)

:-)

>> I think the most flexible would be if the watchpoint
>> event reported to GDB indicated which type it got, so
>> that'd support the case an arch ever supports mixing both
>> kinds of watchpoints.
> 
> Ha, I hadn't noticed that the architecture permits an
> implementation to provide both kinds (or indeed to
> have one watchpoint that might fire in either way), but
> you're right that it's theoretically allowed.

Yeah.  But not just ARM -- but more flexible for all archs
and emulators.

>> Or we just forget all this, assuming that ARM chips that
>> have async watchpoints will disappear into obsolescence
>> forever soon enough.  :-)
> 
> There's an assertion in this LKML post from 2010:
> https://lkml.org/lkml/2010/4/14/127
> 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:

  https://sourceware.org/ml/gdb/2014-09/msg00013.html

As it sounds like he has v7-m hardware that has asynchronous
behavior.  Gareth, can you confirm this, please?

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.

In Linux's sources I see this:

/* Determine number of usable WRPs available. */
static int get_num_wrps(void)
{
	/*
	 * On debug architectures prior to 7.1, when a watchpoint fires, the
	 * only way to work out which watchpoint it was is by disassembling
	 * the faulting instruction and working out the address of the memory
	 * access.
	 *
	 * Furthermore, we can only do this if the watchpoint was precise
	 * since imprecise watchpoints prevent us from calculating register
	 * based addresses.
	 *
	 * Providing we have more than 1 breakpoint register, we only report
	 * a single watchpoint register for the time being. This way, we always
	 * know which watchpoint fired. In the future we can either add a
	 * disassembler and address generation emulator, or we can insert a
	 * check to see if the DFAR is set on watchpoint exception entry
	 * [the ARM ARM states that the DFAR is UNKNOWN, but experience shows
	 * that it is set on some implementations].
	 */
	if (get_debug_arch() < ARM_DEBUG_ARCH_V7_1)
		return 1;

So, even on Linux, on v6, etc. (< v7.1), it seems to me that we're
indeed very likely to get _asynchronous_ watchpoints reported to GDB,
and so this in GDB:

  /* Watchpoints are not steppable.  */
  set_gdbarch_have_nonsteppable_watchpoint (gdbarch, 1);

should be skipped on < v7.1 ...

> If this is a v6-and-earlier thing I'd certainly be tempted
> to sweep the issue under the carpet...

Thanks,
Pedro Alves


  reply	other threads:[~2014-09-30  9:08 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-29 18:23 Peter Maydell
2014-09-29 22:15 ` Pedro Alves
2014-09-29 22:54   ` Peter Maydell
2014-09-30  9:08     ` Pedro Alves [this message]
2014-09-30  9:18       ` Will Deacon
2014-09-30 10:07         ` Pedro Alves
2014-09-30 10:18           ` Peter Maydell
2014-09-30 10:38             ` Pedro Alves
2014-09-30 10:01       ` Peter Maydell
2014-09-30 10:34         ` Pedro Alves
2014-09-30 12:54           ` Pedro Alves
2014-09-30 13:50             ` Joel Brobecker
2014-09-30 14:11               ` Pedro Alves
2014-09-30 14:26                 ` Joel Brobecker
2014-09-30 14:50                   ` Peter Maydell
2014-09-30  8:57 ` Will Deacon
2014-09-30  9:04   ` Will Deacon
2014-09-30  9:14   ` Pedro Alves
2014-09-30  9:24     ` Will Deacon
  -- strict thread matches above, loose matches on Subject: below --
2014-09-15 13:01 Joel Brobecker
2014-09-16 11:12 ` Yao Qi
2014-09-16 11:59   ` Joel Brobecker
2014-09-16 12:05     ` Luis Machado
2014-09-16 12:48       ` Joel Brobecker
2014-09-16 13:09         ` Luis Machado
2014-09-16 15:21           ` Pedro Alves
2014-09-18 11:40             ` Marcus Shawcroft
2014-09-19 17:31               ` Pedro Alves
2014-09-29 17:51                 ` Joel Brobecker
2014-09-29 17:57                   ` Luis Machado
2014-09-29 21:04                   ` Pedro Alves
2014-09-30  8:54                     ` Will Deacon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=542A72F9.5090203@redhat.com \
    --to=palves@redhat.com \
    --cc=Marcus.Shawcroft@arm.com \
    --cc=Terry.Guo@arm.com \
    --cc=Will.Deacon@arm.com \
    --cc=brobecker@adacore.com \
    --cc=gareth@blacksphere.co.nz \
    --cc=gdb-patches@sourceware.org \
    --cc=lgustavo@codesourcery.com \
    --cc=marcus.shawcroft@gmail.com \
    --cc=peter.maydell@linaro.org \
    --cc=yao@codesourcery.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox