Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@false.org>
To: gdb@sourceware.org
Subject: Re: Checking if addess is on stack?
Date: Thu, 20 Apr 2006 14:39:00 -0000	[thread overview]
Message-ID: <20060420124903.GA11015@nevyn.them.org> (raw)
In-Reply-To: <u8xq0wi8g.fsf@gnu.org>

On Thu, Apr 20, 2006 at 03:21:03PM +0300, Eli Zaretskii wrote:
> Well, I thought the trick with tb does the equivalent of what you
> wanted.  It automatically inserts the watchpoint when the scope is
> entered, while its deletion is handled by GDB itself.  Next time the
> function is entered, GDB will insert the watchpoint again.  Isn't that
> what you want, as far as the variable-out-of-scope issue is
> considered?  (Whether to watch the address or the expression is a
> different matter, as mentioned above.)

What he wants is not to stop the watchpoint when ptr goes out of scope,
but when ptr->i goes out of scope - if ptr points to a stack allocated
variable, in this function or another one.

Sorry, Vladimir, there's no way to do this.  You'd have to keep an eye
on the value of $sp manually, and know whether the stack grew up or
down.  Even that wouldn't help enough, since you might miss a stack pop
and push.  There's no way to keep track of register values in the way
we can watchpoint memory.

-- 
Daniel Jacobowitz
CodeSourcery


  reply	other threads:[~2006-04-20 12:49 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-20 10:27 Vladimir Prus
2006-04-20 11:42 ` Eli Zaretskii
2006-04-20 11:48   ` Vladimir Prus
2006-04-20 12:21     ` Eli Zaretskii
2006-04-20 12:49       ` Vladimir Prus
2006-04-20 14:27         ` Eli Zaretskii
2006-04-20 14:39           ` Daniel Jacobowitz [this message]
2006-04-20 15:24             ` Eli Zaretskii
2006-04-20 15:32               ` Daniel Jacobowitz
2006-04-20 18:41                 ` Eli Zaretskii
2006-04-20 19:12                   ` Daniel Jacobowitz
2006-04-21 11:45                     ` Eli Zaretskii
2006-04-22  8:06                       ` Daniel Jacobowitz
2006-04-20 16:29           ` Vladimir Prus
2006-04-20 19:03             ` 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=20060420124903.GA11015@nevyn.them.org \
    --to=drow@false.org \
    --cc=gdb@sourceware.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