[3/3] Fix inferior memory reading in GDBServer for sparc.

Message ID 20161128122758.7762-3-antoine.tremblay@ericsson.com
State New, archived
Headers

Commit Message

Antoine Tremblay Nov. 28, 2016, 12:27 p.m. UTC
  Before this patch, sparc_store_gregset_from_stack would read the inferior
memory with (*the_target)->read_memory, which returns the raw memory,
rather than the shadowed memory.

This is wrong since this function does not expect to read a breakpoint
instruction and can lead to invalid behavior.

Note I could not test or build this patch.

gdb/gdbserver/ChangeLog:

	* linux-sparc-low.c (sparc_store_gregset_from_stack): Use target_read_memory.
---
 gdb/gdbserver/linux-sparc-low.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Antoine Tremblay Dec. 9, 2016, 12:47 p.m. UTC | #1
Antoine Tremblay writes:

> Before this patch, sparc_store_gregset_from_stack would read the inferior
> memory with (*the_target)->read_memory, which returns the raw memory,
> rather than the shadowed memory.

I'm pulling back this patch as the read is done from the stack so using
->read_memory is ok.

Thanks,
Antoine
  

Patch

diff --git a/gdb/gdbserver/linux-sparc-low.c b/gdb/gdbserver/linux-sparc-low.c
index 70c5c93..31ef791 100644
--- a/gdb/gdbserver/linux-sparc-low.c
+++ b/gdb/gdbserver/linux-sparc-low.c
@@ -184,7 +184,7 @@  sparc_store_gregset_from_stack (struct regcache *regcache, const void *buf)
 
   for (i = l0_regno; i <= i7_regno; i++)
     {
-      (*the_target->read_memory) (addr, tmp_reg_buf, sizeof (tmp_reg_buf));
+      target_read_memory (addr, tmp_reg_buf, sizeof (tmp_reg_buf));
       supply_register (regcache, i, tmp_reg_buf);
       addr += sizeof (tmp_reg_buf);
     }