This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
RFA: Breakpoint infrastructure cleanups [4/8] - update read_memory_nobpt
- From: Daniel Jacobowitz <drow at mvista dot com>
- To: gdb-patches at sources dot redhat dot com
- Date: Wed, 8 Oct 2003 13:13:51 -0400
- Subject: RFA: Breakpoint infrastructure cleanups [4/8] - update read_memory_nobpt
This simple patch converts read_memory_nobpt to use ALL_IMPL_BREAKPOINTS,
since all it cares about are software breakpoints and their shadow contents.
This patch contains an actual bug fix. It used to be that hardware
breakpoints would cause read_memory_nobpt to access uninitialized
shadow_contents. Not a one of our target_insert_hw_breakpoints uses the
shadow_contents buffer (although at least one target_insert_breakpoint
fails to initialize it, in remote-mips!). Now we only check for software
breakpoints.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
2003-10-08 Daniel Jacobowitz <drow@mvista.com>
* breakpoint.c (read_memory_nobpt): Use ALL_IMPL_BREAKPOINTS
instead of ALL_BREAKPOINTS. Only check software breakpoints.
Index: gdb/breakpoint.c
===================================================================
--- gdb.orig/breakpoint.c 2003-10-08 12:42:10.000000000 -0400
+++ gdb/breakpoint.c 2003-10-08 12:42:11.000000000 -0400
@@ -621,7 +621,7 @@ int
read_memory_nobpt (CORE_ADDR memaddr, char *myaddr, unsigned len)
{
int status;
- struct breakpoint *b;
+ struct impl_breakpoint *b;
CORE_ADDR bp_addr = 0;
int bp_size = 0;
@@ -629,20 +629,15 @@ read_memory_nobpt (CORE_ADDR memaddr, ch
/* No breakpoints on this machine. */
return target_read_memory (memaddr, myaddr, len);
- ALL_BREAKPOINTS (b)
+ ALL_IMPL_BREAKPOINTS (b)
{
- if (b->type == bp_none)
- warning ("reading through apparently deleted breakpoint #%d?",
- b->number);
+ if (b->owner->type == bp_none)
+ warning ("reading through apparently deleted breakpoint #%d?",
+ b->owner->number);
- /* memory breakpoint? */
- if (b->type == bp_watchpoint
- || b->type == bp_hardware_watchpoint
- || b->type == bp_read_watchpoint
- || b->type == bp_access_watchpoint)
+ if (b->type != impl_bp_software_breakpoint)
continue;
- /* bp in memory? */
- if (!b->impl->inserted)
+ if (!b->inserted)
continue;
/* Addresses and length of the part of the breakpoint that
we need to copy. */
@@ -650,7 +645,7 @@ read_memory_nobpt (CORE_ADDR memaddr, ch
breakpoint values. BREAKPOINT_FROM_PC still manages to
correctly determine the breakpoints memory address and size
for these targets. */
- bp_addr = b->impl->address;
+ bp_addr = b->address;
bp_size = 0;
if (BREAKPOINT_FROM_PC (&bp_addr, &bp_size) == NULL)
continue;
@@ -686,7 +681,7 @@ read_memory_nobpt (CORE_ADDR memaddr, ch
}
memcpy (myaddr + bp_addr - memaddr,
- b->impl->shadow_contents + bptoffset, bp_size);
+ b->shadow_contents + bptoffset, bp_size);
if (bp_addr > memaddr)
{