[rfc] Allow watchpoints on inaccessible memory
Vladimir Prus
vladimir@codesourcery.com
Tue Nov 20 07:56:00 GMT 2007
Daniel Jacobowitz <drow <at> false.org> writes:
>
> Here's something I've been meaning to try for ages. Suppose you have
> a global variable pointing to some dynamically allocated storage, and
> you want to find writes into that storage. When the pointer isn't
> initialized you can't even set the watchpoint:
......
> - v = evaluate_expression (bpt->owner->exp);
> - value_contents (v);
> - value_release_to_mark (mark);
> + gdb_evaluate_expression (bpt->owner->exp, &v);
> + if (v != NULL)
> + {
> + gdb_value_fetch_lazy (v);
> + value_release_to_mark (mark);
> + }
In fact, this patch is likely to fix a nasty issue with watchpoints in shared
libraries. Say you have a watchpoint set on global variable 'g' in a shared
library, and the shared library is unloaded. Next time you try to "next",
or "continue", insert_bp_location will try to evaluate watchpoint expression
again, and throw -- which will terminate next or continue operation, leaving
program at the same place -- which is extremely confusing.
- Volodya
More information about the Gdb-patches
mailing list