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.



> Starting program: /home/hjl/bugs/gdb/hw/y 
> warning: Could not insert hardware watchpoint 1.
> warning: Could not insert hardware watchpoint 3.
> ptrace: Unknown error 4294967295.
> Cannot insert breakpoints.
> The same program may be running in another process.
> (gdb)
> 
> ia32 only has 4 hardware debug registers. But gdb shouldn't crash.

I don't see any crashes in the above script.  GDB simply didn't start
the process.  It is arguable whether it should instead proceed after
inserting only those watchpoints it can, but I agree that it should at
least be a user option.

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

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.

> (gdb) watch a1
> Watchpoint 1: a1
> (gdb) watch a2
> Watchpoint 2: a2
> (gdb)
> 
> 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.)

> I will send in a patch in another email.

Please see my response with objections to your patch.

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