Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Edward Peschko <edwardp@excitehome.net>
To: gdb@sources.redhat.com
Subject: watchpoints inside 'commands'
Date: Thu, 05 Apr 2001 20:05:00 -0000	[thread overview]
Message-ID: <20010405200525.A18623@excitehome.net> (raw)
In-Reply-To: <20010405200028.A18474@excitehome.net>

On Thu, Apr 05, 2001 at 08:00:28PM -0700, Edward Peschko wrote:
hey,

I was wondering how people might tackle the following problem:

I'm trying to track down a memory corruption bug in my C++ code, and am finding
it very difficult. it comes in a function that creates several items... 

Anyways, I was thinking of putting in a watchpoint, but I would have to put 
in several watchpoints because the bug is intermittant:

Key *Object::getItem(Key key)
{
	return (Object::getItem(&key));  bug here.
}

So. I tried the following:

b Object.cpp:12
commands 1
> silent
> watch key._data[0]
> continue

Unfortunately, this doesn't seem to work because, when the watchpoint is 
eliminated, the program auto halts. Why?

And can you set an 'intelligent' watchpoint, one that watches the value of a 
variable *name* (not a variable instance) between point 'a' and point 'b' in 
your code? This would be far more useful than the current behaviour - 
currently, tracing one instance of a variable is useless if you've got a 
function which creates and destroys tons of them...

ed

(ps -- this brings up another thing.. if you've got a heisenbug, how do you go
about tracking it down? Say that another piece of your code (in another thread)
is trashing your thread via an array bounds write (or some such thing) How can
you track this down as being the cause? And how do you fix it?)


       reply	other threads:[~2001-04-05 20:05 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20010405200028.A18474@excitehome.net>
2001-04-05 20:05 ` Edward Peschko [this message]
2001-04-06  2:09   ` Eli Zaretskii
2001-04-06 11:20     ` Edward Peschko
2001-04-07  0:17       ` Eli Zaretskii
2001-04-07 17:33         ` Edward Peschko
2001-04-08  1:09           ` Eli Zaretskii
2001-04-08 16:59             ` Edward Peschko
2001-04-08 17:45               ` Daniel Berlin
2001-04-08 23:21               ` Eli Zaretskii
2001-04-17 10:38             ` Andrew Cagney

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=20010405200525.A18623@excitehome.net \
    --to=edwardp@excitehome.net \
    --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