Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@false.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Paul Koning <pkoning@equallogic.com>,
	ghost@cs.msu.su, 	gdb@sources.redhat.com
Subject: Re: MI: reporting of multiple breakpoints
Date: Sat, 18 Feb 2006 17:28:00 -0000	[thread overview]
Message-ID: <20060218154653.GB21241@nevyn.them.org> (raw)
In-Reply-To: <ur760gaum.fsf@gnu.org> <uslqggbxm.fsf@gnu.org>

On Sat, Feb 18, 2006 at 01:10:13PM +0200, Eli Zaretskii wrote:
> I think at the core of this argument is this problem: there's no PC
> value that is _between_ two adjacent instructions.  Thus, being
> _after_ an instruction at a certain value of PC means that we at the
> same time are _at_ or _on_ the next instruction at PC+1.  And being
> _at_ an instruction where we put a breakpoint means that the
> breakpoint have already triggered, since breakpoints are expected to
> break _before_ the instruction executes.
> 
> Do you both agree with this interpretation?

This I agree with completely.

> If so, you should also
> both agree that being _after_ an instruction that wrote into a watched
> data location also means we are at the same precise location where a
> breakpoint was already supposed to break.  There's nothing in between
> these two locations, no place where we could stop _before_ getting to
> a place where a breakpoint should break.

And this.

On Sat, Feb 18, 2006 at 01:33:37PM +0200, Eli Zaretskii wrote:
> No, it's not a hardware limitation, it's a ``limitation'' (I think
> it's rather a feature) of _any_ reasonable implementation of
> watchpoints, even software watchpoints: a watchpoint _always_ breaks
> _after_ the instruction that writes to the watched location.  It
> cannot be any other way, because no debugger and no hardware can
> possibly know whether an instruction will write to an arbitrary
> location before running that instruction.

While I agree with your conclusions above, this bit's not right.

(A) Hardware can pretty straightforwardly trigger the exception while
executing the instruction, between address calculation and store
completion, and back up the PC.  I have been poring over the MIPS
documentation, but I haven't worked out yet whether this happens
or not.  However, I think some platforms do - I think this is what
HAVE_NONSTEPPABLE_WATCHPOINT is all about. 
HAVE_CONTINUABLE_WATCHPOINT, on the other hand, is going to usually
imply that we stop after the event.

(B) Most targets have few store instructions.  Not x86, true.  But
for others, disassembling the instruction at $pc to see where it will
read or write is pretty trivial.  ARM has maybe a dozen relevant
instructions at most.

(C) Page protection write watchpoints will always fault before the
store, and the OS will often provide the faulting address for you
in the signal information.

Do we want to uniformly present watchpoints as after-the-store, as
a least common denominator and for consistency?  If so, a reasonable
sort of thing to do, then all of the first part of this message
applies.  If not, it applies to targets on which watchpoints stop
after execution...

> You seem to suggest that we back up one instruction after a watchpoint
> triggers.  Is that true?  If so, I think it's not a good idea, since
> (1) we'd have the watchpoint trigger again when we continue after
> that, and (2) the user who knows (as they all should, IMHO) that a
> watchpoint always triggers _after_ the code that wrote to the data
> will be utterly confused by that.

... except for this, which is the same problem I described for
breakpoints; that's a compelling reason to behave as we do now.

-- 
Daniel Jacobowitz
CodeSourcery


  reply	other threads:[~2006-02-18 15:47 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-17 15:32 Vladimir Prus
2006-02-17 15:48 ` Daniel Jacobowitz
2006-02-17 16:04   ` Vladimir Prus
2006-02-17 18:59     ` Daniel Jacobowitz
2006-02-17 19:04       ` Daniel Jacobowitz
2006-02-17 19:52     ` Eli Zaretskii
2006-02-17 19:54       ` Daniel Jacobowitz
2006-02-17 19:59         ` Eli Zaretskii
2006-02-17 20:06           ` Paul Koning
2006-02-17 20:08             ` Daniel Jacobowitz
2006-02-17 20:16               ` Eli Zaretskii
2006-02-17 20:19                 ` Daniel Jacobowitz
2006-02-17 20:18               ` Paul Koning
2006-02-17 20:24                 ` Daniel Jacobowitz
2006-02-17 21:37                   ` Paul Koning
2006-02-17 21:43                     ` Daniel Jacobowitz
2006-02-17 21:56                       ` Paul Koning
2006-02-17 22:12                         ` Daniel Jacobowitz
2006-02-18  9:54                           ` Paul Koning
2006-02-18 10:56                             ` Daniel Jacobowitz
2006-02-18 15:47                             ` Eli Zaretskii
2006-02-18 15:28                         ` Eli Zaretskii
2006-02-18 17:28                           ` Daniel Jacobowitz [this message]
2006-02-18 17:42                             ` Eli Zaretskii
2006-02-18 17:50                               ` Daniel Jacobowitz
2006-02-18 18:33                                 ` Eli Zaretskii
2006-02-19 18:20                           ` Paul Koning
2006-02-19 18:31                             ` Daniel Jacobowitz
2006-02-19 18:44                               ` Robert Dewar
2006-02-20  3:16                             ` Eli Zaretskii
2006-02-18 11:39                       ` Eli Zaretskii
2006-02-19 18:19                         ` Paul Koning
2006-02-19 18:38                           ` Daniel Jacobowitz
2006-02-19 18:54                             ` Paul Koning
2006-02-19 19:05                               ` Robert Dewar
2006-02-19 19:30                                 ` Paul Koning
2006-02-19 19:52                                   ` Daniel Jacobowitz
2006-02-19 19:57                                     ` Paul Koning
2006-02-19 21:55                           ` Eli Zaretskii
2006-02-20  4:33                             ` Daniel Jacobowitz
2006-02-20  7:25                               ` Eli Zaretskii
2006-02-20 18:20                                 ` Daniel Jacobowitz
2006-02-17 20:14             ` Eli Zaretskii
2006-02-17 20:08           ` Daniel Jacobowitz
2006-02-17 20:22             ` Eli Zaretskii
2006-02-17 20:31               ` Daniel Jacobowitz
2006-02-17 20:32                 ` Eli Zaretskii
2006-02-17 20:41                   ` Daniel Jacobowitz
2006-02-17 20:02         ` Eli Zaretskii
2006-02-17 20:15           ` Daniel Jacobowitz
2006-02-17 19:36 ` Eli Zaretskii

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=20060218154653.GB21241@nevyn.them.org \
    --to=drow@false.org \
    --cc=eliz@gnu.org \
    --cc=gdb@sources.redhat.com \
    --cc=ghost@cs.msu.su \
    --cc=pkoning@equallogic.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