This is the mail archive of the 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-v2] Fix a windows bug if two watchpoints are used

> >   My problem is indeed fixed without that part,
> > but without my change to I386_DR_DISABLE, the second check
> > in i386_stopped_data_address:
> >
> >     {
> >       if (I386_DR_WATCH_HIT (i)
> > 	  /* This second condition makes sure DRi is set up for a data
> > 	     watchpoint, not a hardware breakpoint.  The reason is
> > 	     that GDB doesn't call the target_stopped_data_address
> > 	     method except for data watchpoints.  In other words, I'm
> > 	     being paranoiac.  */
> > 	  && I386_DR_GET_RW_LEN (i) != 0)
> >
> > is not reliable as the return value of I386_DR_GET_RW_LEN (i)
> > is non-zero if I was used before... Even if it was disabled
> > later!
> This is C: if the result of the first test is false, the result of the
> second test is not important, right?
> Or am I missing something?

  If all works fine, there is no problem, you are right,
but otherwise...
  If, like for my cygwin problem, 
dr_status_mirror has both bits 1 and 2 set
while only the first debug register is used according 
to previous calls of the i386-nat functions.
 This is probably an OS problem, but the whole thread is related to that...

  In that situation, the second test, which is supposed to check if indeed
we have
that second register used as a hardware watchpoint, and not a
hardware breakpoint, according to the comment, fails.

  Maybe we should use 
       if (I386_DR_WATCH_HIT (i)
		&& !I386_DR_VACANT(i)
		&& I386_DR_GET_RW_LEN (i) != 0)
In that case, I think that the code should be fine even if
the underlying OS reports a spurious bit of the debug status register as


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