--- breakpoint.c@@/INSIGHT-6.8-ST-2.0 2008-09-11 12:00:00.000000000 +0100 +++ breakpoint.c 2009-03-03 14:20:50.232257000 +0000 @@ -898,7 +898,7 @@ update_watchpoint (struct breakpoint *b, is different from out-of-scope watchpoint. */ if (within_current_scope && b->exp) { - struct value *v, *next; + struct value *v, *result, *next; /* Evaluate the expression and make sure it's not lazy, so that after target stops again, we have a non-lazy previous value @@ -910,18 +910,18 @@ update_watchpoint (struct breakpoint *b, In addition, we look at all values which were created during evaluation, and set watchoints at addresses as needed. Those values are explicitly deleted here. */ - v = evaluate_expression (b->exp); + result = evaluate_expression (b->exp); /* Avoid setting b->val if it's already set. The meaning of b->val is 'the last value' user saw, and we should update it only if we reported that last value to user. As it happens, the code that reports it updates b->val directly. */ if (b->val == NULL) - b->val = v; - value_contents (v); + b->val = result; + value_contents (result); value_release_to_mark (mark); /* Look at each value on the value chain. */ - for (; v; v = next) + for (v = result; v; v = next) { /* If it's a memory location, and GDB actually needed its contents to evaluate the expression, then we @@ -934,7 +934,7 @@ update_watchpoint (struct breakpoint *b, /* We only watch structs and arrays if user asked for it explicitly, never if they just happen to appear in the middle of some value chain. */ - if (v == b->val + if (v == result || (TYPE_CODE (vtype) != TYPE_CODE_STRUCT && TYPE_CODE (vtype) != TYPE_CODE_ARRAY)) {