From: "Ulrich Weigand" <uweigand@de.ibm.com>
To: gdb-patches@sourceware.org
Subject: [rfc] [4/4] SPU overlay support: Bugfix in remove_breakpoint
Date: Mon, 07 May 2007 22:27:00 -0000 [thread overview]
Message-ID: <200705072227.l47MR5AZ024929@d12av02.megacenter.de.ibm.com> (raw)
Hello,
this fixes a bug we discovered during SPU overlay testing.
The problem occurs when remove_breakpoint attempts to remove a
software breakpoint in an overlay section that is not currently
mapped. The routine simply goes and writes the saved shadow
contents over that location -- but if another overlay section
is now mapped there, this will clobber its code.
The current behaviour was introduced by Michael Snyder's patch:
http://sourceware.org/ml/gdb-patches/2002-04/msg00149.html
to support hardware breakpoints in overlays.
And I guess if this is a hardware breakpoint, it *should* be
removed -- otherwise the overlay manager would have to fiddle
with hardware breakpoint registers when swapping overlays.
However, for *software* breakpoints this looks definitely
wrong to me. So the patch below restores the old behaviour
for those: the shadow contents are restored only if the
section is still mapped.
Any comments? I plan on committing this after the rest of
the SPU overlay support patches.
Bye,
Ulrich
ChangeLog:
* breakpoint.c (remove_breakpoint): Do not remove software
breakpoints in unmapped overlay sections.
diff -urNp gdb-orig/gdb/breakpoint.c gdb-head/gdb/breakpoint.c
--- gdb-orig/gdb/breakpoint.c 2007-05-06 16:07:05.000000000 +0200
+++ gdb-head/gdb/breakpoint.c 2007-05-07 22:44:15.698329784 +0200
@@ -1585,8 +1585,14 @@ remove_breakpoint (struct bp_location *b
don't know what the overlay manager might do. */
if (b->loc_type == bp_loc_hardware_breakpoint)
val = target_remove_hw_breakpoint (&b->target_info);
- else
+
+ /* However, we should remove *software* breakpoints only
+ if the section is still mapped, or else we overwrite
+ wrong code with the saved shadow contents. */
+ else if (section_is_mapped (b->section))
val = target_remove_breakpoint (&b->target_info);
+ else
+ val = 0;
}
else
{
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com
next reply other threads:[~2007-05-07 22:27 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-07 22:27 Ulrich Weigand [this message]
2007-05-10 21:52 ` Daniel Jacobowitz
2007-05-10 22:05 ` Ulrich Weigand
2007-05-11 17:29 ` Daniel Jacobowitz
2007-05-11 18:55 ` Ulrich Weigand
2007-05-11 19:00 ` Daniel Jacobowitz
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=200705072227.l47MR5AZ024929@d12av02.megacenter.de.ibm.com \
--to=uweigand@de.ibm.com \
--cc=gdb-patches@sourceware.org \
/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