From 8376de048fc9f00d83730a284169858864a10c90 Mon Sep 17 00:00:00 2001 From: "Maciej W. Rozycki" Date: Fri, 18 May 2012 12:30:26 +0000 Subject: * mips-tdep.c (mips_read_pc): Use gdbarch_pc_regnum instead of mips_regnum->pc. (mips_unwind_pc, mips_write_pc): Likewise. (mips_gdbarch_init): Remove a comment on gdbarch_pc_regnum and gdbarch_read_pc. --- gdb/ChangeLog | 8 ++++++++ gdb/mips-tdep.c | 11 +++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 8b846ad..c06c771 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,11 @@ +2012-05-18 Maciej W. Rozycki + + * mips-tdep.c (mips_read_pc): Use gdbarch_pc_regnum instead of + mips_regnum->pc. + (mips_unwind_pc, mips_write_pc): Likewise. + (mips_gdbarch_init): Remove a comment on gdbarch_pc_regnum and + gdbarch_read_pc. + 2012-05-17 Joel Brobecker * procfs.c (procfs_find_new_threads, procfs_pid_to_str, diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index 28fec27..37f4041 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -1080,8 +1080,9 @@ mips_in_frame_stub (CORE_ADDR pc) static CORE_ADDR mips_read_pc (struct regcache *regcache) { + int regnum = gdbarch_pc_regnum (get_regcache_arch (regcache)); ULONGEST pc; - int regnum = mips_regnum (get_regcache_arch (regcache))->pc; + regcache_cooked_read_signed (regcache, regnum, &pc); if (is_mips16_addr (pc)) pc = unmake_mips16_addr (pc); @@ -1093,8 +1094,7 @@ mips_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame) { CORE_ADDR pc; - pc = frame_unwind_register_signed - (next_frame, gdbarch_num_regs (gdbarch) + mips_regnum (gdbarch)->pc); + pc = frame_unwind_register_signed (next_frame, gdbarch_pc_regnum (gdbarch)); if (is_mips16_addr (pc)) pc = unmake_mips16_addr (pc); /* macro/2012-04-20: This hack skips over MIPS16 call thunks as @@ -1144,7 +1144,8 @@ mips_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame) static void mips_write_pc (struct regcache *regcache, CORE_ADDR pc) { - int regnum = mips_regnum (get_regcache_arch (regcache))->pc; + int regnum = gdbarch_pc_regnum (get_regcache_arch (regcache)); + if (mips_pc_is_mips16 (pc)) regcache_cooked_write_unsigned (regcache, regnum, make_mips16_addr (pc)); else @@ -7106,8 +7107,6 @@ mips_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* The hook may have adjusted num_regs, fetch the final value and set pc_regnum and sp_regnum now that it has been fixed. */ - /* FIXME: cagney/2003-11-15: For MIPS, hasn't gdbarch_pc_regnum been - replaced by gdbarch_read_pc? */ num_regs = gdbarch_num_regs (gdbarch); set_gdbarch_pc_regnum (gdbarch, regnum->pc + num_regs); set_gdbarch_sp_regnum (gdbarch, MIPS_SP_REGNUM + num_regs); -- cgit v1.1