Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Vladimir Prus <ghost@cs.msu.su>
To: Eli Zaretskii <eliz@gnu.org>
Cc: gdb@sources.redhat.com
Subject: Re: Checking if addess is on stack?
Date: Thu, 20 Apr 2006 12:49:00 -0000	[thread overview]
Message-ID: <200604201548.36899.ghost@cs.msu.su> (raw)
In-Reply-To: <uacagwk0e.fsf@gnu.org>

On Thursday 20 April 2006 15:42, Eli Zaretskii wrote:
> > From: Vladimir Prus <ghost@cs.msu.su>
> > Date: Thu, 20 Apr 2006 14:26:58 +0400
> > Cc: gdb@sources.redhat.com
> >
> > I'm not sure that's exactly what I need. This way, watchpoint will be
> > automatically inserted when I enter 'do_that', but as soon as I leave
> > 'do_that', gdb will remove wathchpoint because 'ptr' has gone out of
> > scope. This will prevent me from catching accesses to ptr->i made outside
> > of the function where 'ptr' is valid. Am I missing something?
>
> Perhaps _I_ am missing something.  Isn't `ptr' a variable that is
> local to the function `do_that'?  I thought it was; if so, then it
> couldn't possibly be accessed after `do_that' returns, because all
> locals are popped off the stack when `do_that' returns.  These locals
> will get entirely new values when `do_that' is entered the next time.
>
> (If you want to catch accesses to the address where `ptr' _was_ on the
> stack, then you really need to set the wathchpoint on an absolute
> address.  

Precisely, I want to catch accesses to a specific address, and I want that to 
be the only (or at least default) behaviour in KDevelop. That is, if user 
types in any expression, KDevelop will compute the address of that expression 
and set watchpoint on address.

The rationale is that in the case I've given:

  void do_that(My_class* ptr)
  {     
                ptr->i = .....;
                ........
  }

user most likely wants to catch all future accesses to variable 'i', and does 
not care if those accesses go via 'ptr' in 'do_that', or via some other 
pointer variable in some other function.

> But watching addresses on the stack beyond the stack top is 
> a very unusual thing to do, so I don't think this is what your users
> would need.)

Exactly, so I want to detect the case where address in on the stack, and in 
that case disable the watchpoint when function exists. But there's no easy 
way to detect if address is on stack, and that's the problem.

- Volodya


  reply	other threads:[~2006-04-20 11:48 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 [this message]
2006-04-20 14:27         ` Eli Zaretskii
2006-04-20 14:39           ` Daniel Jacobowitz
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=200604201548.36899.ghost@cs.msu.su \
    --to=ghost@cs.msu.su \
    --cc=eliz@gnu.org \
    --cc=gdb@sources.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