This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] ia64: Fix breakpoints memory shadow


> > +  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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]