Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@false.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: gdb-patches@sourceware.org, Nathan Sidwell <nathan@codesourcery.com>
Subject: Re: patch for invalid hw breakpoints
Date: Fri, 02 Jun 2006 13:52:00 -0000	[thread overview]
Message-ID: <20060602135237.GA23384@nevyn.them.org> (raw)
In-Reply-To: <uac8wdk30.fsf@gnu.org>

On Fri, Jun 02, 2006 at 11:42:59AM +0300, Eli Zaretskii wrote:
> > Anyway, do you think it's sensible for a "target_remove_watchpoint"
> > method to be called on something that is not an inserted watchpoint?
> > I'd think no.  It could mess up reference counts, for instance.
> 
> The problem is, the high-level GDB interface to target-side watchpoint
> support currently assumes that the target will cope with such
> problems.  breakpoint.c doesn't know nor care about such
> ``unimportant'' details as how many addresses the target needs to
> watch for a given data object on the value chain.  The requirement
> from the target is to maintain whatever data it needs to track the
> watchpoint related resources at all times, and silently cope with
> seemingly unreasonable requests issued by the relatively blissful
> high-level code in breakpoint.c.  For that, no target should ever
> throw exceptions when GDB tries to do something unreasonable with
> watchpoints.  For example, in the specific example of reference
> counts, the target end should increment and decrement the counts even
> if it doesn't actually insert/remove the watchpoint at the specified
> address.
> 
> If we are about to change this basic arrangement, i.e. if we want to
> keep some of the information on the application level, I fear we will
> eventually need to redesign the whole interface.

Is this contract that you're asserting documented anywhere?  I haven't
seen it written down, and it's very different from my interpretation.
It's likely that many targets get it wrong.  The documentation just
says "insert or remove a hardware watchpoint", and I wouldn't read that
as a requirement to support removing bogus things which we could not
insert.  We don't attempt to remove a disabled watchpoint; why should
we attempt to remove one we failed to insert?

Anyway, this is not a productive argument.  Let's change remote.c
instead.  If someone ever finishes separating into a location per
watched value, then we can arrange to only remove what we inserted
at that later time.

Nathan, want to remove the errors from both insert and remove methods?

> Meanwhile, I really don't like the fact that remote.c throws an
> internal error in situations that don't require that.  To me, internal
> error means a situation akin to SIGSEGV: something is dead wrong, but
> the code has no means of figuring out what's that.

If I were writing this code it would be a gdb_assert, which generates
an internal error.  Those are designed for two situations: hopelessly
confused, and violated assumptions.  This is the latter, not the
former.  It's thrown here because here is where we can detect that it
happened.

-- 
Daniel Jacobowitz
CodeSourcery


  reply	other threads:[~2006-06-02 13:52 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <447EE9A8.4050800@codesourcery.com>
2006-06-01 17:21 ` Eli Zaretskii
2006-06-01 17:26   ` Daniel Jacobowitz
2006-06-01 17:46     ` Nathan Sidwell
2006-06-01 18:03       ` Daniel Jacobowitz
2006-06-01 20:53         ` Eli Zaretskii
2006-06-01 21:12           ` Daniel Jacobowitz
2006-06-02  8:44             ` Eli Zaretskii
2006-06-02 13:52               ` Daniel Jacobowitz [this message]
2006-06-02 20:56                 ` Eli Zaretskii
2006-06-02 20:57                   ` Daniel Jacobowitz
2006-06-05 14:30               ` Nathan Sidwell
2006-06-05 19:58                 ` Eli Zaretskii
2006-06-02  7:26         ` Nathan Sidwell
2006-06-02  8:13           ` Eli Zaretskii
2006-06-01 18:33       ` Nathan Sidwell

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=20060602135237.GA23384@nevyn.them.org \
    --to=drow@false.org \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    --cc=nathan@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