Hardware watchpoints
Eli Zaretskii
eliz@gnu.org
Wed Oct 27 13:07:00 GMT 1999
As promised, diffs for all the changes that avoid inserting/removing
watchpoints for lazy values are attached below.
Now for the next problem: hardware watchpoints still don't work, even
after these changes, for struct members that are bitfields. As far as
I could see, the reason for this is that value_primitive_field needs
to fetch the value of the field in order to unpack it into an int, and
that causes the lazy flag of the struct itself to be reset.
It seems that relying on the lazy flag is too fragile: any code that
needs to fetch the value of the struct, for some purpose, will break
the ability to watch members of that struct.
Perhaps we need a special flag for this, which will be set for structs
and arrays only if they are not the watched expression itself.
* breakpoint.c (insert_breakpoints): Fetch the value of the
expression we need to watch, to make sure its LAZY flag is off.
Don't insert watchpoints for values whose LAZY flag is set.
(remove_breakpoint): Don't remove a watchpoint if the value's LAZY
flag is set (since we didn't insert them in the first place).
(bpstat_stop_status): Don't check values whose LAZY flag is set,
since we don't watch them.
*** gdb/breakpoi.c~4 Sun Aug 22 19:03:14 1999
--- gdb/breakpoi.c Wed Oct 27 19:37:04 1999
*************** insert_breakpoints ()
*** 779,784 ****
--- 779,786 ----
/* Evaluate the expression and cut the chain of values
produced off from the value chain. */
v = evaluate_expression (b->exp);
+ if (VALUE_LAZY (v))
+ value_fetch_lazy (v);
value_release_to_mark (mark);
b->val_chain = v;
*************** insert_breakpoints ()
*** 788,794 ****
for ( ; v; v=v->next)
{
/* If it's a memory location, then we must watch it. */
! if (v->lval == lval_memory)
{
int addr, len, type;
--- 790,796 ----
for ( ; v; v=v->next)
{
/* If it's a memory location, then we must watch it. */
! if (v->lval == lval_memory && !v->lazy)
{
int addr, len, type;
*************** remove_breakpoint (b, is)
*** 1127,1133 ****
{
/* For each memory reference remove the watchpoint
at that address. */
! if (v->lval == lval_memory)
{
int addr, len, type;
--- 1129,1135 ----
{
/* For each memory reference remove the watchpoint
at that address. */
! if (v->lval == lval_memory && !v->lazy)
{
int addr, len, type;
*************** bpstat_stop_status (pc, not_a_breakpoint
*** 2199,2205 ****
}
for (v = b->val_chain; v; v = v->next)
{
! if (v->lval == lval_memory)
{
CORE_ADDR vaddr;
--- 2201,2207 ----
}
for (v = b->val_chain; v; v = v->next)
{
! if (v->lval == lval_memory && !v->lazy)
{
CORE_ADDR vaddr;
*************** can_use_hardware_watchpoint (v)
*** 4486,4492 ****
hardware watchpoint for the constant expression. */
for ( ; v; v = v->next)
{
! if (v->lval == lval_memory)
{
int vaddr = VALUE_ADDRESS (v) + VALUE_OFFSET (v);
int len = TYPE_LENGTH (VALUE_TYPE (v));
--- 4488,4494 ----
hardware watchpoint for the constant expression. */
for ( ; v; v = v->next)
{
! if (v->lval == lval_memory && !v->lazy)
{
int vaddr = VALUE_ADDRESS (v) + VALUE_OFFSET (v);
int len = TYPE_LENGTH (VALUE_TYPE (v));
More information about the Gdb
mailing list