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: Your change to can_use_hardware_watchpoint breaks hw wp



> 	* breakpoint.c (can_use_hardware_watchpoint): Call
> 	TARGET_REGION_OK_FOR_HW_WATCHPOINT; if it returns zero,
> 	return zero immediately.
> 
> I can no longer set hardware watchpoint like
> 
> int foo [20];
> 
> (gdb) watch foo[1];
> 
> on x86.

As far as I can see, this is another incarnation of a bug in GDB
whereby GDB wants to watch the entire array/structure when you only
need to watch one array element or one struct member.  See my message
to gdb-patches on 15 Aug with the Subject "Watching a struct member"
and Jim Blandy's reply on 16 Aug.

So the problem is not the above change, it is simply another bug that
was previously hiding behind the code in can_use_hardware_watchpoint.

> Do you have a patch to get it to work again?

The code that evaluates expressions is very complicated, and I haven't
yet figured out how to fix it.  Perhaps someone who knows more about
that could suggest a patch.

For now, I only have a work-around: 

 (gdb) p &foo[2]
 $1 = (int *) 0x9880
 (gdb) watch *(int *)0x9880
 Hardware watchpoint 1: *(int *) 39040

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