Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Daniel Berlin <dan@cgsoftware.com>
To: Edward Peschko <edwardp@excitehome.net>
Cc: Eli Zaretskii <eliz@is.elta.co.il>, gdb@sources.redhat.com
Subject: Re: watchpoints inside 'commands'
Date: Sun, 08 Apr 2001 17:45:00 -0000	[thread overview]
Message-ID: <m2hezykij0.fsf@dynamic-addr-83-177.resnet.rochester.edu> (raw)
In-Reply-To: <20010408165852.A24221@excitehome.net>

Edward Peschko <edwardp@excitehome.net> writes:

> > Ah, okay, then how about setting a breakpoint near the exit from the
> > scope where the watchpoint is defined, and setting up the commands of
> > that breakpoint to silently delete the watchpoint and continue?  Would
> > that do what you want?
> 
> Ok, but there is no command - as far as I can tell - to 'silently delete the 
> watchpoint and continue'. Take the following code:
> 
> ---
> #include <stdio.h>
> 
> void a();
> 
> int main()
> {
> 	int xx;
> 	for (xx = 0; xx < 100; xx++)
> 	{
> 		function();
> 	}
> }
> 
> int yy = 0;
> 
> void a()
> {
> 
> 	char data[10]  = "hello";
> 	if (yy++%10 == 0) 
> 		data[0] = 'i';
> 
> 	
> }
> 
> if you say something like:
> 
> b 20
> Breakpoint 1 at 0x10924: file a.c, line 20.
> commands 1
> > silent
> > watch data[0];
> > continue
> 
> then, gdb will set up a watchpoint (which I assume is a breakpoint) at 20 when 
> line #20 is hit. So far so good.
> 
> But the watchpoint has a different *number* each time it comes up (ie: watch
> data[0] is 'watchpoint 2' on the first way round, watch data[0] is 'watchpoint
> 3' the second time round, etc. etc.

$bpnum will give you the number of the last breakpoint set (which
include watchpoints)

HTH,
Dan

-- 
I went to a general store.  They wouldn't let me buy anything
specifically.


  reply	other threads:[~2001-04-08 17:45 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
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 [this message]
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=m2hezykij0.fsf@dynamic-addr-83-177.resnet.rochester.edu \
    --to=dan@cgsoftware.com \
    --cc=edwardp@excitehome.net \
    --cc=eliz@is.elta.co.il \
    --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