Code in can_use_hardware_watchpoint()

J.T. Conklin jtc@redback.com
Tue Aug 17 23:50:00 GMT 1999


>>>>> "Eli" == Eli Zaretskii <eliz@gnu.org> writes:
jtc> I believe the enclosed code from can_use_hardware_watchpoint() has
jtc> a problem, but I'm unsure of the proper fix.

Eli> As long as we are talking about this function, here's another
Eli> question: shouldn't the loop below return zero as soon as the
Eli> first value is found on the value chain that is NOT okay to watch
Eli> (as the macro TARGET_REGION_SIZE_OK_FOR_HW_WATCHPOINT says)?

I'm inclined to agree.  

If I understand things, if an expression contains a memory variable
that can be watched by the target's debug registers and another that
cannot, can_use_hardware_watchpoint() will return a value, which GDB
will interpret as the target can implement the watchpoint expression
in hardware.

Eli>   for (; v; v = v->next)
Eli>     {
Eli>       if (v->lval == lval_memory)
Eli>         {
Eli>           if (TARGET_REGION_SIZE_OK_FOR_HW_WATCHPOINT
Eli>           (TYPE_LENGTH (VALUE_TYPE (v))))
Eli>             found_memory_cnt++;
Eli>         }
Eli>       else if (v->lval != not_lval && v->modifiable == 0)
Eli>         return 0;
Eli>     }

-- 
J.T. Conklin
RedBack Networks


More information about the Gdb mailing list