diff options
author | Pedro Alves <palves@redhat.com> | 2015-03-05 23:39:45 +0000 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2015-03-05 23:39:45 +0000 |
commit | 68901c4d439ebceecab927932c17ea1504747c02 (patch) | |
tree | 9d231ec80aef76aa0b9e8e85f060ee6352e78d29 /gdb/ChangeLog | |
parent | 41cd1ad1b9760ba962fde607ac218b5af760dfbf (diff) | |
download | gdb-68901c4d439ebceecab927932c17ea1504747c02.zip gdb-68901c4d439ebceecab927932c17ea1504747c02.tar.gz gdb-68901c4d439ebceecab927932c17ea1504747c02.tar.bz2 |
PR gdb/18002: Fix reinsert of a permanent breakpoints
When we find out that a breakpoint is set on top of a program
breakpoint, we mark it as "permanent". E.g.,:
...
if (bp_loc_is_permanent (loc))
{
loc->inserted = 1;
loc->permanent = 1;
}
...
Note we didn't fill in the breakpoint's shadow (shadow_len remains 0).
In case the target claims support for evaluating breakpoint
conditions, GDB sometimes reinserts breakpoints that are already
inserted (to update the conditions on the target side). Since GDB
doesn't know whether the target supports evaluating conditions _of_
software breakpoints (vs hardware breakpoints, etc.) until it actually
tries it, if the target doesn't actually support z0 breakpoints, GDB
ends up reinserting a GDB-managed software/memory breakpoint
(mem-break.c).
And that is the case that is buggy: breakpoints that are marked
inserted contribute their shadows (if any) to the memory returned by
target_read_memory, to mask out breakpoints. Permanent breakpoints
are always marked as inserted. So if the permanent breakpoint doesn't
have a shadow yet in its shadow buffer, but we set shadow_len before
calling target_read_memory, then the still clear shadow_contents
buffer will be used by the breakpoint masking code... And then from
there on, the permanent breakpoint has a broken shadow buffer, and
thus any memory read out of that address will read bogus code, and
many random bad things fall out from that.
The fix is just to set shadow_len at the same time shadow_contents is
set, not one before and another after...
Fixes all gdb.base/bp-permanent.exp FAILs on PPC64 GNU/Linux gdbserver
and probably any other gdbserver port that doesn't do z0 breakpoints.
gdb/ChangeLog:
2015-03-05 Pedro Alves <palves@redhat.com>
PR gdb/18002
* mem-break.c (default_memory_insert_breakpoint): Set shadow_len
after reading the breakpoint's shadow memory.
Diffstat (limited to 'gdb/ChangeLog')
-rw-r--r-- | gdb/ChangeLog | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 5ee18e7..bfb584c 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2015-03-05 Pedro Alves <palves@redhat.com> + + PR gdb/18002 + * mem-break.c (default_memory_insert_breakpoint): Set shadow_len + after reading the breakpoint's shadow memory. + 2015-03-05 Mark Kettenis <kettenis@gnu.org> * hppabsd-nat.c: Remove file. |