From: Bob Rossi <bob@brasko.net>
To: Eli Zaretskii <eliz@gnu.org>
Cc: GDB <gdb@sources.redhat.com>
Subject: Re: [mi] watchpoint-scope exec async command
Date: Thu, 31 Mar 2005 00:49:00 -0000 [thread overview]
Message-ID: <20050331014749.GA264@white> (raw)
In-Reply-To: <01c53564$Blat.v2.4$1da3c140@zahav.net.il>
On Wed, Mar 30, 2005 at 10:06:33PM +0200, Eli Zaretskii wrote:
> > Date: Tue, 29 Mar 2005 16:44:14 -0500
> > From: Daniel Jacobowitz <drow@false.org>
> > Cc: GDB <gdb@sources.redhat.com>
> >
> > If the scope breakpoint triggers, we delete it. From watch_command_1:
> > /* Automatically delete the breakpoint when it hits. */
> > scope_breakpoint->disposition = disp_del;
> >
> > That's what's happening in this case. Then, shortly thereafter, the
> > watchpoint triggers. That's when we detect that it has gone out of
> > scope, and set it to delete at next stop; and we crash, because we
> > already deleted the scope breakpoint when it was hit.
>
> I hoped to see this from Bob's tracebacks, but I only saw the first
> part of what you describe: that the scope breakpoint is being deleted
> after it triggers (not _when_, _after_: it is deleted by
> breakpoint_auto_delete).
>
> Assuming that the watchpoint triggers after that, it is marked as
> disp_del_at_next_stop, so it would be slated for deletion by the same
> breakpoint_auto_delete function when it is called shortly after. This
> is the part that I didn't see in Bob's session. I will assume that
> things indeed happen like you say: that when we try to delete that
> watchpoint, we crash when we access its scope breakpoint, which was
> already deleted and freed.
>
> I think we have the following alternatives to fix this. First, we
> could stop using scope breakpoints for hardware-assisted watchpoints.
> (The scope breakpoint is not needed in this case, since they don't
> slow down the executable, and because we have an independent facility
> to detect that a hardware watchpoint went out of scope: that is the
> code run by insert_bp_location and watchpoint_check which prints a
> warning about the fact that the watchpoint went out of scope.)
> Software watchpoints do need the scope breakpoint (to stop
> single-stepping the inferior once the watchpoint goes out of scope),
> and in that case Bob's testing demonstrates that the scope breakpoint
> machinery works correctly. So we need to continue using scope
> breakpoints for software watchpoints alone.
>
> If we don't arrange a scope breakpoint for a hardware watchpoint, we
> won't hit the problem Bob reported.
>
> The second alternative is to treat scope breakpoints specially in
> breakpoint_auto_delete: when we see a scope breakpoint that is marked
> for deletion, we will have to find its watchpoint, and if that
> watchpoint is a hardware watchpoint, we will have to delete that
> watchpoint as well.
>
> I like the first alternative better, since it seems cleaner.
The second alternative was my initial idea. However, I was just
guessing, since I really know nothing about the code. The first
approach seems good, I was just wondering if that would slow things
down? Aren't hardware watchpoints must faster than software?
If desired, I'd be interested in looking into either of these 2 fixes.
However, I'll need a small amount of hand holding, so it might be faster
for someone else to do it ...
> As an aside, I'd ask Bob to run the same test program, but this time
> use awatch instead of watch command. I'd be interested to hear if the
> same problems (i.e. memory write into a freed block reported by
> valgrind and an occasional crash) happen in that case as well. The
> reason that I'm asking this is that we handle watch and rwatch/awatch
> slightly differently, since the code that handles watch is run for
> both software and hardware watchpoints.
Funny you ask. When using hardware watchpoints, both rwatch and awatch
result in the same bad behavior. However, when using software
watchpoints,
(gdb) rwatch param
Expression cannot be implemented with read/access watchpoint.
(gdb) awatch param
Expression cannot be implemented with read/access watchpoint.
(gdb) watch param
Watchpoint 2: param
(gdb)
both rwatch and awatch are refused by GDB.
> > I don't know if it still triggers today
>
> I think Bob's testing shows that it does, for the software
> watchpoints.
>
> Did I help resolving this issue?
But of course!
Thanks for all the help,
Bob Rossi
next prev parent reply other threads:[~2005-03-31 0:49 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-03-25 16:12 Bob Rossi
2005-03-25 16:25 ` gdbserver question james osburn
2005-03-25 16:33 ` Daniel Jacobowitz
2005-03-26 13:27 ` [mi] watchpoint-scope exec async command Eli Zaretskii
2005-03-26 13:44 ` Bob Rossi
2005-03-27 14:10 ` Bob Rossi
2005-03-28 21:57 ` Bob Rossi
2005-03-28 22:40 ` Daniel Jacobowitz
2005-03-28 22:54 ` Bob Rossi
2005-03-28 22:59 ` Daniel Jacobowitz
2005-03-29 0:43 ` Bob Rossi
2005-03-29 1:35 ` Daniel Jacobowitz
2005-03-29 1:51 ` Bob Rossi
2005-03-29 2:00 ` Daniel Jacobowitz
2005-03-29 21:33 ` Eli Zaretskii
2005-03-29 21:39 ` Mark Kettenis
2005-03-29 21:47 ` Bob Rossi
2005-03-30 5:15 ` Eli Zaretskii
2005-03-29 21:43 ` Daniel Jacobowitz
2005-03-30 20:10 ` Eli Zaretskii
2005-03-31 0:49 ` Bob Rossi [this message]
2005-03-31 4:43 ` Eli Zaretskii
2005-03-31 19:59 ` Bob Rossi
2005-04-01 8:10 ` Eli Zaretskii
2005-04-01 14:09 ` Daniel Jacobowitz
2005-04-02 9:54 ` Eli Zaretskii
2005-04-06 2:13 ` Bob Rossi
2005-04-06 3:51 ` Eli Zaretskii
2005-03-31 2:32 ` Daniel Jacobowitz
2005-03-31 4:48 ` Eli Zaretskii
2005-03-31 6:00 ` Daniel Jacobowitz
2005-03-31 19:49 ` Eli Zaretskii
2005-03-29 23:29 ` Bob Rossi
2005-03-30 5:12 ` Eli Zaretskii
2005-03-30 0:29 ` Bob Rossi
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=20050331014749.GA264@white \
--to=bob@brasko.net \
--cc=eliz@gnu.org \
--cc=gdb@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