This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 2/3] Fix inferior memory reading in GDBServer for ppc.


Before this patch, parse_spufs_run 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.

This patch is built tested but not regression tested.

gdb/gdbserver/ChangeLog:

	* linux-ppc-low.c (parse_spufs_run): Use target_read_memory.
	(ppc_get_pc): Likewise.
---
 gdb/gdbserver/linux-ppc-low.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/gdb/gdbserver/linux-ppc-low.c b/gdb/gdbserver/linux-ppc-low.c
index 1d013f1..6fcad84 100644
--- a/gdb/gdbserver/linux-ppc-low.c
+++ b/gdb/gdbserver/linux-ppc-low.c
@@ -231,8 +231,8 @@ parse_spufs_run (struct regcache *regcache, int *fd, CORE_ADDR *addr)
     }
 
   /* Fetch instruction preceding current NIP.  */
-  if ((*the_target->read_memory) (curr_pc - 4,
-				  (unsigned char *) &curr_insn, 4) != 0)
+  if (target_read_memory (curr_pc - 4,
+			  (unsigned char *) &curr_insn, 4) != 0)
     return 0;
   /* It should be a "sc" instruction.  */
   if (curr_insn != INSTR_SC)
@@ -253,7 +253,7 @@ ppc_get_pc (struct regcache *regcache)
   if (parse_spufs_run (regcache, &fd, &addr))
     {
       unsigned int pc;
-      (*the_target->read_memory) (addr, (unsigned char *) &pc, 4);
+      target_read_memory (addr, (unsigned char *) &pc, 4);
       return ((CORE_ADDR)1 << 63)
 	| ((CORE_ADDR)fd << 32) | (CORE_ADDR) (pc - 4);
     }
-- 
2.9.2


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]