diff options
author | Ulrich Weigand <uweigand@de.ibm.com> | 2007-06-15 22:44:56 +0000 |
---|---|---|
committer | Ulrich Weigand <uweigand@de.ibm.com> | 2007-06-15 22:44:56 +0000 |
commit | 61a1198acf6397fc68016561e165a8ca89dcbc16 (patch) | |
tree | 8169ab1f776d5f5063cae391bd81cfa0141af3fa /gdb/regcache.c | |
parent | e4fd649ae26abcf2528f0d64593bce95d94321e5 (diff) | |
download | gdb-61a1198acf6397fc68016561e165a8ca89dcbc16.zip gdb-61a1198acf6397fc68016561e165a8ca89dcbc16.tar.gz gdb-61a1198acf6397fc68016561e165a8ca89dcbc16.tar.bz2 |
* gdbarch.sh (read_pc): Add REGCACHE argument. Remove PTID argument.
(write_pc): Likewise. Remove default implementation, add predicate.
* gdbarch.c, gdbarch.h: Regenerate.
* regcache.c (read_pc_pid): Use current regcache instead of calling
read_register_pid.
(write_pc_pid): Check gdbarch_write_pc predicate, implement default
case inline.
(generic_target_write_pc): Remove.
* inferior.h (generic_target_write_pc): Remove.
* frv-tdep.c (frv_gdbarch_init): Do not install it.
* m68hc11-tdep.c (m68hc11_gdbarch_init): Likewise.
* rs6000-tdep.c (rs6000_gdbarch_init): Likewise.
* sh64-tdep.c (sh64_gdbarch_init): Likewise.
* sh-tdep.c (sh_gdbarch_init): Likewise.
* xstormy16-tdep.c (xstormy16_gdbarch_init): Likewise.
* avr-tdep.c (avr_read_pc): Add REGCACHE argument. Remove PTID
argument. Use REGCACHE instead of calling read_register_pid.
* hppa-hpux-tdep.c (hppa_hpux_read_pc): Likewise.
* hppa-tdep.c (hppa_read_pc): Likewise.
* hppa-tdep.h (hppa_read_pc): Likewise.
* ia64-tdep.c (ia64_read_pc): Likewise.
* m32r-tdep.c (m32r_read_pc): Likewise.
* mep-tdep.c (mep_read_pc): Likewise.
* mn10300-tdep.c (mn10300_read_pc): Likewise.
* spu-tdep.c (spu_read_pc): Likewise.
* arm-tdep.c (arm_write_pc): Add REGCACHE argument. Remove PTID
argument. Use REGCACHE instead of calling write_register_pid.
* avr-tdep.c (avr_write_pc): Likewise.
* hppa-hpux-tdep.c (hppa_hpux_write_pc): Likewise.
* hppa-tdep.c (hppa_write_pc): Likewise.
* hppa-tdep.h (hppa_write_pc): Likewise.
* i386-linux-tdep.c (i386_linux_write_pc): Likewise.
* amd64-linux-tdep.c (amd64_linux_write_pc): Likewise.
* ia64-linux-tdep.c (ia64_linux_write_pc): Likewise.
* ia64-tdep.c (ia64_write_pc): Likewise.
* ia64-tdep.h (ia64_write_pc): Likewise.
* m32r-tdep.c (m32r_write_pc): Likewise.
* m88k-tdep.c (m88k_write_pc): Likewise.
* mep-tdep.c (mep_write_pc): Likewise.
* mips-tdep.c (mips_write_pc): Likewise.
* mips-linux-tdep.c (mips_linux_write_pc): Likewise.
* mn10300-tdep.c (mn10300_write_pc): Likewise.
* sparc-tdep.c (sparc_write_pc): Likewise.
* spu-tdep.c (spu_write_pc): Likewise.
* mips-tdep.c (read_signed_register): Remove.
(read_signed_register_pid): Likewise.
(mips_read_pc): Add REGCACHE argument. Remove PTID argument.
Use REGCACHE instead of calling read_signed_register_pid.
Diffstat (limited to 'gdb/regcache.c')
-rw-r--r-- | gdb/regcache.c | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/gdb/regcache.c b/gdb/regcache.c index 8a535e1..dc07c9f 100644 --- a/gdb/regcache.c +++ b/gdb/regcache.c @@ -887,6 +887,9 @@ regcache_raw_collect (const struct regcache *regcache, int regnum, void *buf) CORE_ADDR read_pc_pid (ptid_t ptid) { + struct regcache *regcache = current_regcache; + struct gdbarch *gdbarch = get_regcache_arch (regcache); + ptid_t saved_inferior_ptid; CORE_ADDR pc_val; @@ -894,12 +897,13 @@ read_pc_pid (ptid_t ptid) saved_inferior_ptid = inferior_ptid; inferior_ptid = ptid; - if (TARGET_READ_PC_P ()) - pc_val = TARGET_READ_PC (ptid); + if (gdbarch_read_pc_p (gdbarch)) + pc_val = gdbarch_read_pc (gdbarch, regcache); /* Else use per-frame method on get_current_frame. */ else if (PC_REGNUM >= 0) { - CORE_ADDR raw_val = read_register_pid (PC_REGNUM, ptid); + ULONGEST raw_val; + regcache_cooked_read_unsigned (regcache, PC_REGNUM, &raw_val); pc_val = gdbarch_addr_bits_remove (current_gdbarch, raw_val); } else @@ -916,25 +920,24 @@ read_pc (void) } void -generic_target_write_pc (CORE_ADDR pc, ptid_t ptid) -{ - if (PC_REGNUM >= 0) - write_register_pid (PC_REGNUM, pc, ptid); - else - internal_error (__FILE__, __LINE__, - _("generic_target_write_pc")); -} - -void write_pc_pid (CORE_ADDR pc, ptid_t ptid) { + struct regcache *regcache = current_regcache; + struct gdbarch *gdbarch = get_regcache_arch (regcache); + ptid_t saved_inferior_ptid; /* In case ptid != inferior_ptid. */ saved_inferior_ptid = inferior_ptid; inferior_ptid = ptid; - TARGET_WRITE_PC (pc, ptid); + if (gdbarch_write_pc_p (gdbarch)) + gdbarch_write_pc (gdbarch, regcache, pc); + else if (PC_REGNUM >= 0) + regcache_cooked_write_unsigned (regcache, PC_REGNUM, pc); + else + internal_error (__FILE__, __LINE__, + _("write_pc_pid: Unable to update PC")); inferior_ptid = saved_inferior_ptid; } |