Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Joel Brobecker <brobecker@adacore.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Jan Kratochvil <jan.kratochvil@redhat.com>, gdb-patches@sourceware.org
Subject: Re: [patch] ia64: Fix breakpoints memory shadow
Date: Mon, 24 Nov 2008 02:25:00 -0000	[thread overview]
Message-ID: <20081122181525.GG4318@adacore.com> (raw)
In-Reply-To: <uy6zchubn.fsf@gnu.org>

> > +  instr_breakpoint = slotN_contents (bundle_mem, slotnum);
> > +  if (instr_breakpoint != IA64_BREAKPOINT)
> > +    warning (_("Breakpoint removal cannot find the placed breakpoint at %s"),
> > +             paddr_nz (bp_tgt->placed_address));
> 
> Can this happen as part of normal GDB behavior?  If not, we should
> make this internal_error, I think.  If indeed this is a warning, we
> should tell users what to do with such a warning, either as part of
> the message or at least in the manual.

Maybe we can imagine some far-fetched scenario where the user is in
non-stop mode, meaning that the breakpoints are always inserted, and
that the user somehow overwrites the breakpoint instruction manually
before switching back to all-stop (is that even possible?). In that
case, that would be a valid warning.

Regardless of that, I thought that the warning was a judicious choice
because the debugger might be able to recover from this situation.
Whether or not there was a breakpoint there, it can still restore
the instruction at that address and hopefully continue working normally.
Changing the warning into an internal_error would cause the debugger
to abruptly abort the current operation (after which the user might
choose to end the debugging session).  I thought that attempting to
recover would bring more benefit in this case.

I would agree that some extra documentation explaining this warning
might be useful.  That being said, I'm not opposed to changing the
warning into an internal_error, if you still think it's better.

> > +  if (slotnum > 2)
> > +    error (_("Can't insert breakpoint for slot numbers greater than 2."));
> 
> Similarly here: assuming slot numbers are not something exposed to the
> user, I'd be bewildered if presented with such a message.  If this is
> an internal GDB error (a.k.a. bug), let's treat it like one.

In this case, the invalid address can occur as a result of bad user input:

    (top-gdb) b *0x4000000000054c73
    Breakpoint 4 at 0x4000000000054c73: file gdb.c, line 28.
    (top-gdb) c
    Continuing.
    Can't insert breakpoint for slot numbers greater than 2.

So this is not necessarily an internal error.

I wish GDB would catch the invalid address a little earlier, though.

-- 
Joel


  reply	other threads:[~2008-11-22 18:16 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-28 17:52 Jan Kratochvil
2008-10-30  1:51 ` Joel Brobecker
2008-10-31  0:03   ` Jan Kratochvil
2008-11-01 18:54     ` Joel Brobecker
2008-11-11 20:20       ` Jan Kratochvil
2008-11-13 14:27         ` Joel Brobecker
2008-11-21  1:11           ` Jan Kratochvil
2008-11-22 18:35             ` Joel Brobecker
2008-11-22 19:08             ` Eli Zaretskii
2008-11-24  2:25               ` Joel Brobecker [this message]
2008-11-24  7:09                 ` Jan Kratochvil
2008-11-25 17:49                   ` Joel Brobecker
2008-11-27  0:41                     ` Jan Kratochvil

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=20081122181525.GG4318@adacore.com \
    --to=brobecker@adacore.com \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    --cc=jan.kratochvil@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