Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@false.org>
To: Paul Koning <pkoning@equallogic.com>
Cc: eliz@gnu.org, ghost@cs.msu.su, gdb@sources.redhat.com
Subject: Re: MI: reporting of multiple breakpoints
Date: Fri, 17 Feb 2006 21:43:00 -0000	[thread overview]
Message-ID: <20060217211942.GA609@nevyn.them.org> (raw)
In-Reply-To: <17398.15554.431196.208031@gargle.gargle.HOWL>

On Fri, Feb 17, 2006 at 04:14:42PM -0500, Paul Koning wrote:
>  Daniel> So?
> 
>  Daniel> The user does "set $var = $pc" after hitting the breakpoint
>  Daniel> at bar.  Then later they do jump *$var.  They have every
>  Daniel> right (IMO) to expect that they are, once again, after the
>  Daniel> breakpoint at line 422, and that it won't be hit again - and
>  Daniel> even though you could make a good argument for the opposite
>  Daniel> case, this is how GDB has behaved for a long while.  I think
>  Daniel> you'll encounter just as manage strange cases if you reverse
>  Daniel> it.
> 
>  Daniel> Another way to think about it, if this helps.  Right now you
>  Daniel> will not hit a GDB-requested event after "step" or "continue"
>  Daniel> without executing at least one instruction.  You might be
>  Daniel> interrupted (by a trap instruction, an async signal, et
>  Daniel> cetera).  But GDB will do its level best to step when you ask
>  Daniel> for a step, not hit a breakpoint that you've already noticed.
> 
> Exactly my point.  The case you're talking about is the opposite of
> the one I was talking about.
> 
> The program runs, executes the store into foo.  GDB should report
> hitting the watchpoint on foo, and should NOT report hitting the
> breakpoint at 422.
> 
> User says "step".  We execute one instruction, which is the breakpoint
> trap, and report that as the breakpoint at line 422.  User is happy.

No, this is not the opposite of what I described; could you explain why
you think it is?  It's indistinguishable from what I described.  If we
set the PC to the PC of the breakpoint, we assume we are past (have
already hit) the breakpoint.  Therefore when we're stopped by a
watchpoint at the PC of a breakpoint, it's sensible to treat this
situation to the user as if we have already hit the breakpoint.

Try single-stepping up to a breakpoint if that clarifies things:

4       main (int argc, char **argv)
5       {
6         printf ("Hello world\n");
7         return 0;
8       }
(gdb) b 7
Breakpoint 2 at 0x80483a4: file debugging/printf.c, line 7.
(gdb) s
Hello world

Breakpoint 2, main (argc=1, argv=0xbfe9b154) at debugging/printf.c:7
7         return 0;

> Maybe I'm messing up the discussion by being confused about what the
> problem is that started the thread.  I thought what I heard is: the
> watchpoint traps with the PC pointing *after* the store, i.e., it
> points at the trap instruction, so it looks like two simultaneous
> stops.  
> 
> My point is that this is not correct reasoning: the watchpoint stop is
> at PC-instruction_size, which is in line 421 (last instruction of 421)
> and clearly different from line 422.  Yes, the hardware reports PC,
> not PC-instruction_size, but that's GDB's job to sort out, not the
> user's.

What I'm maintaining is that we shouldn't "sort this out".  What we
display should be, IMO, all the events which we consider to have
logically occurred in the current conditions.  The value of a
watchpoint has changed since we last checked it?  Report the
watchpoint.  We've reached the PC of a breakpoint?  Report the
breakpoint.

What you're suggesting would have two stops at identical PC values.
You'd want to say continue and have GDB stop again, right away, without
executing any instructions.  I'd find that much more confusing!

-- 
Daniel Jacobowitz
CodeSourcery


  reply	other threads:[~2006-02-17 21:19 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 [this message]
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
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=20060217211942.GA609@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