Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Maciej W. Rozycki" <macro@mips.com>
To: Daniel Jacobowitz <drow@false.org>
Cc: gdb-patches@sourceware.org, "Maciej W. Rozycki" <macro@linux-mips.org>
Subject: Re: mips-tdep.c: Fix sw watchpoint-out-of-scope events
Date: Wed, 19 Sep 2007 13:05:00 -0000	[thread overview]
Message-ID: <Pine.LNX.4.61.0709191341240.27377@perivale.mips.com> (raw)
In-Reply-To: <20070919123827.GA27457@caradoc.them.org>

On Wed, 19 Sep 2007, Daniel Jacobowitz wrote:

> Could you give me an example?  The watchpoint shouldn't go out of
> scope before the scope breakpoint is hit.  The problem is, instead,

 Well, the scope breakpoint is set up in the caller of the function 
providing the frame containing the variable being watched.  So by 
definition at the point it is hit the watchpoint has always gone away 
already.  This is how it works with hw watchpoints.

> that it appears to change value.  There's two cases.  In the epilogue
> of the function containing the watched variable, the stack frame gets
> destroyed, so the watchpoint is no longer valid... but we don't have
> any marker to indicate that.  In the epilogue of other called
> functions, the watchpoint is still valid but we fail to backtrace
> correctly so we don't find the original function on the stack.

 Correct.  There is actually a third case which is somewhere inbetween -- 
where the function containing the watched variable ends by jumping to a 
sibling call.  For a C program from the language's point of view the 
watchpoint is still in the scope during the execution of the sibling call, 
while in reality its stack frame has gone away already.

> Both of these can happen for hardware watchpoints too, e.g., if the
> user is single stepping or has other breakpoints set.  In practice
> they rarely do.

 True.

> I think I wasn't clear.  I'm asking if returning to the original call
> line, the way MIPS o32 PIC does, should be a PASS.  Other platforms
> that have teardown after function calls will show the same behavior.

 Well, that sounds reasonable given the complication around getting things 
perfect here.  Ideally the out-of-scope event should happen at the same 
place where "finish" from the function in question would stop; in my 
opinion at least.

  Maciej


  reply	other threads:[~2007-09-19 13:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-11 16:24 Maciej W. Rozycki
2007-09-18 15:54 ` Daniel Jacobowitz
2007-09-19 12:31   ` Maciej W. Rozycki
2007-09-19 12:38     ` Daniel Jacobowitz
2007-09-19 13:05       ` Maciej W. Rozycki [this message]
2007-09-19 13:16         ` Daniel Jacobowitz

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=Pine.LNX.4.61.0709191341240.27377@perivale.mips.com \
    --to=macro@mips.com \
    --cc=drow@false.org \
    --cc=gdb-patches@sourceware.org \
    --cc=macro@linux-mips.org \
    /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