Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@mvista.com>
To: Eli Zaretskii <eliz@is.elta.co.il>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [RFA] Fix watchpoints when stepping over a breakpoint
Date: Sat, 06 Apr 2002 09:49:00 -0000	[thread overview]
Message-ID: <20020406124912.A24394@nevyn.them.org> (raw)
In-Reply-To: <2950-Sat06Apr2002201725+0300-eliz@is.elta.co.il>

On Sat, Apr 06, 2002 at 08:17:25PM +0300, Eli Zaretskii wrote:
> > > If this is limited to stepping, can we check whether we are stepping
> > > instead of (or in addition to) the test for whether to ignore
> > > breakpoints?
> > 
> > Well, I set the ignore breakpoints flag in the caller only if we are
> > stepping.
> 
> Isn't it better to make bpstat_stop_status test for stepping directly?

The test I'm using is 'trap_expected' - well:
        if (stop_signal == TARGET_SIGNAL_TRAP && trap_expected
            && through_sigtramp_breakpoint == NULL)

It's static to infrun.c, and it describes the precise circumstances in
which we want this behavior.  We can ignore stop_signal (since we only
call bpstat_stop_status if we got a trap), but I have no idea how
through_sigtramp_breakpoint works.  I'd rather calculate this at the
call site than duplicating logic I don't understand very well in
breakpoint.c (which has no business knowing about the internals of
infrun).

> > No.  In my original message I made a comment about shlib_event
> > breakpoints being a problem.  Other breakpoints would to.  This is all
> > because of the "watchpoint after instr, breakpoint before" thing - we
> > would still have to deal with this, or we'd just keep hitting the same
> > breakpoint over and over if there was a watchpoint on the next
> > instruction.
> 
> Sounds like Andrew was right: the decrement-PC logic is screwed.

I agree.  It's a rat's nest.

> > But something more fundamental is wrong, because we never
> > stop -at all-.  I remember something involving initializing the
> > watchpoint registers...
> 
> I thought that part was solved, but perhaps I'm confused.

So did I, but it does not appear to be the case.  Even access
watchpoints die.  At a guess, in the good case:

insert_watchpoint (addr=8049574, len=4, type=data-read/write):
        CONTROL (DR7): 000f0101          STATUS (DR6): ffff4ff1
        DR0: addr=0x08049574, ref.count=1  DR1: addr=0x00000000, ref.count=0
        DR2: addr=0x00000000, ref.count=0  DR3: addr=0x00000000, ref.count=0

In the bad case:

insert_watchpoint (addr=8049574, len=4, type=data-read/write):
        CONTROL (DR7): 000f0101          STATUS (DR6): ffff4ff0
        DR0: addr=0x08049574, ref.count=2  DR1: addr=0x00000000, ref.count=0
        DR2: addr=0x00000000, ref.count=0  DR3: addr=0x00000000, ref.count=0

insert_watchpoint (addr=8049574, len=4, type=data-read/write):
        CONTROL (DR7): 000f0101          STATUS (DR6): ffff4ff0
        DR0: addr=0x08049574, ref.count=3  DR1: addr=0x00000000, ref.count=0
        DR2: addr=0x00000000, ref.count=0  DR3: addr=0x00000000, ref.count=0

The watchpoint is not removed after program normal exit, and the refcount escalates.

-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer


  reply	other threads:[~2002-04-06 17:49 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-04-02 15:43 Daniel Jacobowitz
2002-04-04 23:38 ` Eli Zaretskii
2002-04-05  7:54   ` Daniel Jacobowitz
2002-04-05  8:45     ` Eli Zaretskii
2002-04-05  9:08       ` Daniel Jacobowitz
2002-04-05  9:55         ` Andrew Cagney
2002-04-05 23:48         ` Eli Zaretskii
2002-04-06  7:36           ` Daniel Jacobowitz
2002-04-06  9:21             ` Eli Zaretskii
2002-04-06  9:49               ` Daniel Jacobowitz [this message]
2002-04-07  9:16                 ` Andrew Cagney
2002-04-07 10:03                   ` Eli Zaretskii
2002-04-14 14:49                     ` Andrew Cagney
2002-04-14 22:07                       ` Eli Zaretskii
2002-04-18 18:34                         ` Andrew Cagney
2002-04-02 22:18 Michael Elizabeth Chastain

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=20020406124912.A24394@nevyn.them.org \
    --to=drow@mvista.com \
    --cc=eliz@is.elta.co.il \
    --cc=gdb-patches@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