Your change to can_use_hardware_watchpoint breaks hw wp
H.J. Lu
hjl@varesearch.com
Mon Sep 13 07:15:00 GMT 1999
>
>
> > * 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
I knew this one.
> 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.
I have a modified gdb. I use a kludge to watch the struct member.
Could you please tell me what bug your patch tried to fix?
>
> > 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
>
I don't like this work around. BTW, if you use Linux, you can try
my modified gdb at
ftp://ftp.valinux.com/pub/support/hjl/gdb
to see if it works for you. I also have a patch for gdb snapshot
which
1. Adds linuxthreads support for alpha and ppc.
2. Changes the hardware watchpoint such that I can watch array
element and struct member among other things.
--
H.J. Lu (hjl@gnu.org)
More information about the Gdb
mailing list