[2/3] Fix inferior memory reading in GDBServer for ppc.
Commit Message
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(-)
@@ -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);
}