This is the mail archive of the gdb@sourceware.cygnus.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]

Re: Problems with hardware watchpoint on ia32.



> I said it crushed because I spent 5 hours in gdb and were very close
> to the problem, all of a sudden, I couldn't continue to debug in gdb
> no matter what I did.  To me, it has the same effect as crush.

Understood.  My problem was that I couldn't reproduce this particular
problem: namely, if I use your test program, define 5 watchpoints,
just like you did, run the debuggee, and after GDB complains, remove
one of the watchpoints, I can then run the program without any
problems.  So I'm led to believe that this particular problem is
specific to the Linux implementation of watchpoints.  Perhaps the
removal of the watchpoints doesn't work well in the case where
insertion of watchpoints fails.  I remember I had quite a few problems
with getting it right in go32-nat.c.

> > > Even worse, after deleted one hardware watchpoint, gdb still refused
> > > to work.
> > 
> > It works for me, but I have patches to do that, which I'm trying for 6
> > months to get accepted :-(.
> 
> Should we at least review it?

I posted them more than once in the past.  Since a lot of water went
under GDB's bridge since then, I now retrofitted the ones which are
still relevant into the current snapshot, and I'm posting them in this
thread in separate messages.

> > Those patches also correct numerous other problems with watchpoints on
> > x86, which you didn't mention.  For example, try setting several
> > watchpoints (of different types) on the same variable, and see the
> > mess.  Another problem which I corrected is that you cannot watch
> > struct members, array elements, and bit fields with hardware-assisted
> > watchpoints.
> 
> I believe it is fixed in the currnt gdb.

Problems with struct members and array elements are fixed, but bit
fields are not.  See my message about this, with a suggested patch.

The problems with awatch and rwatch also aren't fixed; see my other
message.

> > > gdb won't set hardware watchpoints on long long nor double.
> > 
> > You could look at go32-nat.c, it supports watching any region up to 16
> > bytes large.  (I'm at a loss how come DJGPP needed to invent this: I'd
> > expect any x86 platform to have this already, since watchpoints are
> > such an indispensable tool in some circumstances.)
> > 
> 
> Maybe we should have an i386hw-nat.c used by all ia32 platforms.

I agree.  If the implementation in go32-nat.c is close enough to what
all platforms should do, I can volunteer to create i386hw-nat.c.  (My
primary lack of knowledge in this context is about ptrace-related
limitations on using hardware debug registers.)

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