This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFC/WIP PATCH 02/14] Mask software breakpoints from memory writes too
- From: Pedro Alves <pedro at codesourcery dot com>
- To: Andreas Schwab <schwab at linux-m68k dot org>
- Cc: gdb-patches at sourceware dot org
- Date: Wed, 14 Dec 2011 11:52:33 +0000
- Subject: Re: [RFC/WIP PATCH 02/14] Mask software breakpoints from memory writes too
- References: <20111128153742.17761.21459.stgit@localhost6.localdomain6> <201112132132.41317.pedro@codesourcery.com> <m2k460ovk6.fsf@igel.home>
On Wednesday 14 December 2011 00:18:01, Andreas Schwab wrote:
> Pedro Alves <pedro@codesourcery.com> writes:
>
> > On Tuesday 13 December 2011 21:24:24, Andreas Schwab wrote:
> >> Pedro Alves <pedro@codesourcery.com> writes:
> >>
> >> > 2011-12-06 Pedro Alves <pedro@codesourcery.com>
> >> >
> >> > gdb/
> >> > * breakpoint.c (breakpoint_restore_shadows): Rename to ...
> >> > (breakpoint_xfer_memory): ... this. Change prototype. Handle
> >> > memory writes too.
> >> > * breakpoint.h (breakpoint_restore_shadows): Delete.
> >> > (breakpoint_xfer_memory): Declare.
> >> > * mem-break.c (default_memory_insert_breakpoint)
> >> > (default_memory_remove_breakpoint): Use target_write_raw_memory.
> >> > (memory_xfer_partial): Rename to ...
> >> > (memory_xfer_partial_1): ... this. Don't mask out breakpoints
> >> > here.
> >> > (memory_xfer_partial): New.
> >> > (target_write_raw_memory): New.
> >> > * target.h (target_write_raw_memory): New.
> >>
> >> That completely breaks gdb on powerpc. Breakpoints cause gdb to infloop.
> >
> > Got a backtrace showing the loop? It'd be really helpful.
>
> This is repeated endlessly with stop_pc never advancing:
So ppc doesn't use mem-break.c:default_memory_remove_breakpoint.
Does this fix it?
--- a/gdb/ppc-linux-tdep.c
+++ b/gdb/ppc-linux-tdep.c
@@ -218,7 +218,7 @@ ppc_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
program modified the code on us, so it is wrong to put back the
old value. */
if (val == 0 && memcmp (bp, old_contents, bplen) == 0)
- val = target_write_memory (addr, bp_tgt->shadow_contents, bplen);
+ val = target_write_raw_memory (addr, bp_tgt->shadow_contents, bplen);
do_cleanups (cleanup);
return val;
--
Pedro Alves