Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Eli Zaretskii" <eliz@is.elta.co.il>
To: drow@mvista.com
Cc: gdb-patches@sources.redhat.com
Subject: Re: [RFA] Fix watchpoints when stepping over a breakpoint
Date: Fri, 05 Apr 2002 23:48:00 -0000	[thread overview]
Message-ID: <4331-Sat06Apr2002104144+0300-eliz@is.elta.co.il> (raw)
In-Reply-To: <20020405120851.A17113@nevyn.them.org> (message from Daniel Jacobowitz on Fri, 5 Apr 2002 12:08:51 -0500)

> Date: Fri, 5 Apr 2002 12:08:51 -0500
> From: Daniel Jacobowitz <drow@mvista.com>
> 
> I think GDB ought to show that both the breakpoint and watchpoint have
> fired.  At least, that's the behavior I would expect. I also thought
> that was what it would do, but I can't seem to make that happen. 

Try using a hardware-assisted breakpoint, not a normal breakpoint.
Since the latter works by replacing the instruction with a breakpoint
opcode, you cannot have a breakpoint and a watchpoint at exactly the
same PC value, because doing so replaces the instruction that's
supposed to write into some data with the breakpoint opcode.

> Also bear in mind that if you have this sequence:
> - write to x
> - other instruction    <--- breakpoint here
> You will stop based on the watchpoint, because the watchpoint happens
> first.

That's okay, since the instruction that writes to x is before the
breakpoint.  In this case, I'd expect to have a watchpoint, then,
when I continue, I'd expect to hit the breakpoint.

> It's only if we expected a trap (single stepping for instance) that
> this does not work.

If this is limited to stepping, can we check whether we are stepping
instead of (or in addition to) the test for whether to ignore
breakpoints?

> Without my patch, we detect that we are at an address with a
> breakpoint, and don't even try to check our watchpoints.

If we change GDB to report both the breakpoint and watchpoint, the
problem would go away, no?

> [In fact, I'm having a great deal of trouble with hardware watchpoints
> surviving re-running.  Remember that conversation from several months
> ago?

Yes.  This is definitely wrong behavior, IMHO.  IIRC, the problem is
that GDB doesn't initialize the ``old value'' correctly on the rerun,
and so when the watchpoint hits, it thinks it's a false positive,
because watchpoints are suppressed if the watched value doesn't
change.

> > More importantly, an introduction of a general-purpose mechanism to
> > ignore breakpoints is something that I consider to be dangerous,
> > because it is no longer limited to special situations such as
> > single-stepping.
> 
> Well, we could just as easily call the flag "single_stepping"...  That
> would probably limit abuse.

If all else fails, at least that, yes.


  parent reply	other threads:[~2002-04-06  7:48 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-04-02 15:43 Daniel Jacobowitz
2002-04-04 23:38 ` Eli Zaretskii
2002-04-05  7:54   ` Daniel Jacobowitz
2002-04-05  8:45     ` Eli Zaretskii
2002-04-05  9:08       ` Daniel Jacobowitz
2002-04-05  9:55         ` Andrew Cagney
2002-04-05 23:48         ` Eli Zaretskii [this message]
2002-04-06  7:36           ` Daniel Jacobowitz
2002-04-06  9:21             ` Eli Zaretskii
2002-04-06  9:49               ` Daniel Jacobowitz
2002-04-07  9:16                 ` Andrew Cagney
2002-04-07 10:03                   ` Eli Zaretskii
2002-04-14 14:49                     ` Andrew Cagney
2002-04-14 22:07                       ` Eli Zaretskii
2002-04-18 18:34                         ` Andrew Cagney
2002-04-02 22:18 Michael Elizabeth Chastain

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=4331-Sat06Apr2002104144+0300-eliz@is.elta.co.il \
    --to=eliz@is.elta.co.il \
    --cc=drow@mvista.com \
    --cc=gdb-patches@sources.redhat.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