From: Vladimir Prus <vladimir@codesourcery.com>
To: gdb-patches@sources.redhat.com
Subject: Re: [RFA] Try 2: Use multiple locations for hardware watchpoints.
Date: Thu, 29 Nov 2007 10:44:00 -0000 [thread overview]
Message-ID: <200711291342.12336.vladimir@codesourcery.com> (raw)
In-Reply-To: <200711282014.28537.vladimir@codesourcery.com>
[-- Attachment #1: Type: text/plain, Size: 1656 bytes --]
On Wednesday 28 November 2007 20:14:28 you wrote:
>
> This is a revised patch to make watchpoint use regular locations
> mechanism for storing locations to be watched. Compared to the
> previous patch:
>
> - The 'update_watchpoint' function now updates the value stored
> inside breakpoint, removing the need for a special code for that
> purpose inside 'insert_breakpoints', which code had a FIXME saying
> it should be moved elsewhere. Since we call evaluate_expression
> anyway, update_watchpoint only needs a little care with memory management
> to do that -- there's no extra overhead.
>
> - The 'update_watchpoint' function also has 'reparse' parameter, which
> causes it to reparse the watched expression. The breakpoint_re_set_one,
> for the case of watchpoints, now merely calls update_watchpoint.
>
> - Presently, if I set a watchpoint on a global variable in an
> explicitly loaded shared library, and re-run the program, gdb promptly
> segfaults. This patch fixes that, and adds a testcase for that behaviour.
>
> This patch should be applied on top of my previous breakpoint_re_set_on
> watchpoint cleanup patch.
I've noticed that update_watchpoint fail to exit early in case the
breakpoint's disposition is disp_del_at_next_stop. That disposition is
used for breakpoints that we need to delete when they are out of scope --
that's kind of hack, as trying to call delete_breakpoint directly will
lead to crashes as later code touches this breakpoint.
Without this check, nothing breaks, but we sometimes get a message about
a deleted watchpoint twice. To fix it, the below one-liner should
be applied on top of this patch.
- Volodya
[-- Attachment #2: delta.diff --]
[-- Type: text/x-diff, Size: 435 bytes --]
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 4f6f161..7a07678 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -855,6 +855,9 @@ update_watchpoint (struct breakpoint *b, int reparse)
value_free (b->val);
b->val = NULL;
+
+ if (b->disposition == disp_del_at_next_stop)
+ return;
/* Save the current frame's ID so we can restore it after
evaluating the watchpoint expression on its own frame. */
prev parent reply other threads:[~2007-11-29 10:44 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-28 17:14 Vladimir Prus
2007-11-29 10:44 ` Vladimir Prus [this message]
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=200711291342.12336.vladimir@codesourcery.com \
--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