This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [rfc] Allow watchpoints on inaccessible memory
- From: Vladimir Prus <vladimir at codesourcery dot com>
- To: gdb-patches at sources dot redhat dot com
- Date: Tue, 20 Nov 2007 07:56:08 +0000 (UTC)
- Subject: Re: [rfc] Allow watchpoints on inaccessible memory
- References: <20070821142500.GA28295@caradoc.them.org>
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