Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Vladimir Prus <vladimir@codesourcery.com>
To: gdb-patches@sources.redhat.com
Subject: Re: [rfc] Allow watchpoints on inaccessible memory
Date: Tue, 20 Nov 2007 07:56:00 -0000	[thread overview]
Message-ID: <loom.20071120T075053-618@post.gmane.org> (raw)
In-Reply-To: <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


  parent reply	other threads:[~2007-11-20  7:56 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-21 14:25 Daniel Jacobowitz
2007-08-21 16:33 ` Jim Blandy
2007-08-21 18:06   ` Daniel Jacobowitz
2007-08-21 22:49     ` Jim Blandy
2007-08-21 23:17       ` Daniel Jacobowitz
2007-08-21 19:04 ` Eli Zaretskii
2007-11-20  7:56 ` Vladimir Prus [this message]
2008-02-28 16:27 ` Daniel Jacobowitz
2008-02-29 10:11   ` Eli Zaretskii
2008-03-02  4:24     ` Daniel Jacobowitz
2008-03-02 21:09       ` Eli Zaretskii
2008-03-02 23:23         ` Daniel Jacobowitz
2008-03-03  4:27           ` Eli Zaretskii
2008-03-03 14:07             ` Daniel Jacobowitz
2008-02-29 17:54   ` Jim Blandy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=loom.20071120T075053-618@post.gmane.org \
    --to=vladimir@codesourcery.com \
    --cc=gdb-patches@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox