public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@false.org>
To: Thomas Covenant <null_geodesic@yahoo.com>
Cc: gdb@sources.redhat.com
Subject: Re: When do watchpoints go out of scope?
Date: Sun, 25 Sep 2005 17:25:00 -0000	[thread overview]
Message-ID: <20050925172535.GA15486@nevyn.them.org> (raw)
In-Reply-To: <20050925143734.65016.qmail@web34809.mail.mud.yahoo.com>

On Sun, Sep 25, 2005 at 07:37:34AM -0700, Thomas Covenant wrote:
> Consider this program:
> 
> 1 int main(void)
> 2 {
> 3    {
> 4       int i = 2;
> 5       printf("i is %d.\n", i);
> 6       i = 3;
> 7       printf("i is %d.\n", i);
> 8    }
> 9    // lots more code
>      ...
> 90   return 0;
> 100 }
> 
> The variable i goes in scope at line 4, out of scope
> at line 8.
> 
> If I set:
> 
>    watch i
> 
> at line 4, I would assume the watchpoint would be
> deleted at line 8, since i is no longer in scope.

This depends on your compiler and the debug information it generates. 
If GDB still has location information, it will continue to watch the
variable.  If it doesn't, it will stop.  You didn't say what your
platform or compiler was, so it's hard to guess, but many older
versions of GCC and most targets using the stabs format do not have
accurate endings for lifetimes.

-- 
Daniel Jacobowitz
CodeSourcery, LLC

  reply	other threads:[~2005-09-25 17:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-25 14:37 Thomas Covenant
2005-09-25 17:25 ` Daniel Jacobowitz [this message]
2005-10-10 23:21   ` Ross Morley

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=20050925172535.GA15486@nevyn.them.org \
    --to=drow@false.org \
    --cc=gdb@sources.redhat.com \
    --cc=null_geodesic@yahoo.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).