Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Joel Brobecker <brobecker@adacore.com>
Cc: Peter Maydell <peter.maydell@linaro.org>,
	       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 14:11:00 -0000	[thread overview]
Message-ID: <542AB9E3.5090100@redhat.com> (raw)
In-Reply-To: <20140930135031.GD6927@adacore.com>

On 09/30/2014 02:50 PM, Joel Brobecker wrote:
>> BTW, given v7-m behaves like this as well, it sounds
>> like this may not be the last we hear about asynchronous
>> watchpoints (thinking bare-metal here).
>>
>> But, I've given this further thought while cooking lunch.  :-)
>>
>> Given that with asynchronous watchpoints, any number
>> of instructions could have been executed, which isn't
>> exactly the same as always triggering the exception just
>> after the instruction completes, and, since the instruction
>> that triggered the watchpoint can be discovered (in WFAR), I
>> think we should indeed assume synchronous watchpoints by
>> default, and then handle asynchronous watchpoints by
>> augmenting the watchpoint event (packet) reported to GDB
>> by indicating the asyncness and the instruction
>> that triggered the exception (if known).  On such targets,
>> GDB could be a bit more helpful and if execution stops far
>> from where the watchpoint triggered, it could tell that to
>> the user.  On Linux, if we wanted to expose this to the
>> ptracer, we'd stuff it somewhere in the SIGTRAP's siginfo.
>>
>> How does that sound?
>>
>> In a nutshell, less guesswork for GDB, by making the
>> target be more precise in its event reporting.
> 
> I was thinking about something along the same lines; a little
> less sophisticated perhaps: check WFAR, and if far enough,
> then cancel the single-step. 

I assume that WFAR/DSCR are privileged registers though.
On Linux, for example, they're not exported to userspace.

> Informing the user about how
> far would certainly be a useful info for the user. The only
> part I'm unclear about is whether it's OK to check WFAR when
> in synchronous mode, and whether it'll have a WFAR=0 in case
> of a synchronous breakpoint...

I think it'd be better leave those details to the
remote stub / OS though.  E.g., this way, qemu's gdbserver
stub may support watchpoint variants that the hardware
qemu is emulating doesn't support.

For instance, as a natural extension of this, we could
make it possible for qemu to have non-continuable watchpoints
(trap before the instruction that changes memory executes) on all
targets, even x86.  Or have it trap after the instruction
that changes memory, but tell GDB the address of the instruction
that triggered the watchpoint (there's no magic number to subtract
on x86, due to variable-length instructions).

Thanks,
Pedro Alves


  reply	other threads:[~2014-09-30 14:11 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
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 [this message]
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=542AB9E3.5090100@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