This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA] Fix watchpoints when stepping over a breakpoint


> Date: Sat, 6 Apr 2002 10:36:21 -0500
> From: Daniel Jacobowitz <drow@mvista.com>
> > 
> > Try using a hardware-assisted breakpoint, not a normal breakpoint.
> > Since the latter works by replacing the instruction with a breakpoint
> > opcode, you cannot have a breakpoint and a watchpoint at exactly the
> > same PC value, because doing so replaces the instruction that's
> > supposed to write into some data with the breakpoint opcode.
> 
> You can't anyway.  You break before an instruction is executed and
> watchpoint before the next instruction is executed, right?

On x86, yes.  But the question what does GDB do when the watchpoint
fires remains anyway.  GDB should report the watchpoint, not the
breakpoint.

> > 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?

> 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.

> 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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]