From b9fd179153353a88a34dd97a03ee698376212d29 Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Mon, 31 Oct 2011 12:55:26 +0000 Subject: 2011-10-31 Pedro Alves gdb/gdbserver/ * mem-break.c (check_mem_write): Add `myaddr' parameter. Don't clobber the breakpoints' shadows with fast tracepoint jumps. * mem-break.h (check_mem_write): Add `myaddr' parameter. * target.c (write_inferior_memory): Also pass MYADDR down to check_mem_write. gdb/testsuite/ * gdb.trace/trace-break.c: New. * gdb.trace/trace-break.exp: New. --- gdb/gdbserver/ChangeLog | 8 ++++++++ gdb/gdbserver/mem-break.c | 7 ++++--- gdb/gdbserver/mem-break.h | 6 ++++-- gdb/gdbserver/target.c | 2 +- 4 files changed, 17 insertions(+), 6 deletions(-) (limited to 'gdb/gdbserver') diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index eab3ac8..45d3f86 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,3 +1,11 @@ +2011-10-31 Pedro Alves + + * mem-break.c (check_mem_write): Add `myaddr' parameter. Don't + clobber the breakpoints' shadows with fast tracepoint jumps. + * mem-break.h (check_mem_write): Add `myaddr' parameter. + * target.c (write_inferior_memory): Also pass MYADDR down to + check_mem_write. + 2011-10-07 Ulrich Weigand * configure.ac: Check support for personality routine. diff --git a/gdb/gdbserver/mem-break.c b/gdb/gdbserver/mem-break.c index eea8c71..348f59d 100644 --- a/gdb/gdbserver/mem-break.c +++ b/gdb/gdbserver/mem-break.c @@ -1029,7 +1029,8 @@ check_mem_read (CORE_ADDR mem_addr, unsigned char *buf, int mem_len) } void -check_mem_write (CORE_ADDR mem_addr, unsigned char *buf, int mem_len) +check_mem_write (CORE_ADDR mem_addr, unsigned char *buf, + const unsigned char *myaddr, int mem_len) { struct process_info *proc = current_process (); struct raw_breakpoint *bp = proc->raw_breakpoints; @@ -1063,7 +1064,7 @@ check_mem_write (CORE_ADDR mem_addr, unsigned char *buf, int mem_len) buf_offset = start - mem_addr; memcpy (fast_tracepoint_jump_shadow (jp) + copy_offset, - buf + buf_offset, copy_len); + myaddr + buf_offset, copy_len); if (jp->inserted) memcpy (buf + buf_offset, fast_tracepoint_jump_insn (jp) + copy_offset, copy_len); @@ -1092,7 +1093,7 @@ check_mem_write (CORE_ADDR mem_addr, unsigned char *buf, int mem_len) copy_offset = start - bp->pc; buf_offset = start - mem_addr; - memcpy (bp->old_data + copy_offset, buf + buf_offset, copy_len); + memcpy (bp->old_data + copy_offset, myaddr + buf_offset, copy_len); if (bp->inserted) { if (validate_inserted_breakpoint (bp)) diff --git a/gdb/gdbserver/mem-break.h b/gdb/gdbserver/mem-break.h index 2f1dbea..c5cb20c 100644 --- a/gdb/gdbserver/mem-break.h +++ b/gdb/gdbserver/mem-break.h @@ -102,9 +102,11 @@ void check_mem_read (CORE_ADDR mem_addr, unsigned char *buf, int mem_len); /* See if any breakpoints shadow the target memory area from MEM_ADDR to MEM_ADDR + MEM_LEN. Update the data to be written to the target - (in BUF) if necessary, as well as the original data for any breakpoints. */ + (in BUF, a copy of MYADDR on entry) if necessary, as well as the + original data for any breakpoints. */ -void check_mem_write (CORE_ADDR mem_addr, unsigned char *buf, int mem_len); +void check_mem_write (CORE_ADDR mem_addr, + unsigned char *buf, const unsigned char *myaddr, int mem_len); /* Set the byte pattern to insert for memory breakpoints. This function must be called before any breakpoints are set. */ diff --git a/gdb/gdbserver/target.c b/gdb/gdbserver/target.c index 83eb27f..873ee68 100644 --- a/gdb/gdbserver/target.c +++ b/gdb/gdbserver/target.c @@ -63,7 +63,7 @@ write_inferior_memory (CORE_ADDR memaddr, const unsigned char *myaddr, buffer = xmalloc (len); memcpy (buffer, myaddr, len); - check_mem_write (memaddr, buffer, len); + check_mem_write (memaddr, buffer, myaddr, len); res = (*the_target->write_memory) (memaddr, buffer, len); free (buffer); buffer = NULL; -- cgit v1.1