From 2685572f6e11fbd387d4c6a3317373e65f42e7ff Mon Sep 17 00:00:00 2001 From: Ulrich Weigand Date: Sat, 13 Oct 2007 00:49:15 +0000 Subject: [PATCH] * ia64-linux-nat.c (ia64_register_addr): Add gdbarch parameter, replacing use of global current_gdbarch. (ia64_cannot_fetch_register, ia64_cannot_store_register): Likewise. (ia64_linux_fetch_register, ia64_linux_store_register): Update callers. * ia64-tdep.c (SIGCONTEXT_REGISTER_ADDRESS): Remove macro. (ia64_sigtramp_frame_init_saved_regs): Add next_frame parameter, replace uses of SIGCONTEXT_REGISTER_ADDRESS. (ia64_sigtramp_frame_cache): Update caller. --- gdb/ChangeLog | 12 ++++++++++++ gdb/ia64-linux-nat.c | 20 ++++++++++---------- gdb/ia64-tdep.c | 38 +++++++++++++++++++------------------- 3 files changed, 41 insertions(+), 29 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 989eb74cd0..586e4d89eb 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,15 @@ +2007-10-12 Ulrich Weigand + + * ia64-linux-nat.c (ia64_register_addr): Add gdbarch parameter, + replacing use of global current_gdbarch. + (ia64_cannot_fetch_register, ia64_cannot_store_register): Likewise. + (ia64_linux_fetch_register, ia64_linux_store_register): Update callers. + + * ia64-tdep.c (SIGCONTEXT_REGISTER_ADDRESS): Remove macro. + (ia64_sigtramp_frame_init_saved_regs): Add next_frame parameter, + replace uses of SIGCONTEXT_REGISTER_ADDRESS. + (ia64_sigtramp_frame_cache): Update caller. + 2007-10-12 Ulrich Weigand * gdbarch.sh (deprecated_use_struct_convention): Remove. diff --git a/gdb/ia64-linux-nat.c b/gdb/ia64-linux-nat.c index e4f1f7d3bd..6f308c06b2 100644 --- a/gdb/ia64-linux-nat.c +++ b/gdb/ia64-linux-nat.c @@ -302,11 +302,11 @@ static int u_offsets[] = }; static CORE_ADDR -ia64_register_addr (int regno) +ia64_register_addr (struct gdbarch *gdbarch, int regno) { CORE_ADDR addr; - if (regno < 0 || regno >= gdbarch_num_regs (current_gdbarch)) + if (regno < 0 || regno >= gdbarch_num_regs (gdbarch)) error (_("Invalid register number %d."), regno); if (u_offsets[regno] == -1) @@ -318,15 +318,15 @@ ia64_register_addr (int regno) } static int -ia64_cannot_fetch_register (int regno) +ia64_cannot_fetch_register (struct gdbarch *gdbarch, int regno) { return regno < 0 - || regno >= gdbarch_num_regs (current_gdbarch) + || regno >= gdbarch_num_regs (gdbarch) || u_offsets[regno] == -1; } static int -ia64_cannot_store_register (int regno) +ia64_cannot_store_register (struct gdbarch *gdbarch, int regno) { /* Rationale behind not permitting stores to bspstore... @@ -358,7 +358,7 @@ ia64_cannot_store_register (int regno) back.) */ return regno < 0 - || regno >= gdbarch_num_regs (current_gdbarch) + || regno >= gdbarch_num_regs (gdbarch) || u_offsets[regno] == -1 || regno == IA64_BSPSTORE_REGNUM; } @@ -680,7 +680,7 @@ ia64_linux_fetch_register (struct regcache *regcache, int regnum) PTRACE_TYPE_RET *buf; int pid, i; - if (ia64_cannot_fetch_register (regnum)) + if (ia64_cannot_fetch_register (gdbarch, regnum)) { regcache_raw_supply (regcache, regnum, NULL); return; @@ -693,7 +693,7 @@ ia64_linux_fetch_register (struct regcache *regcache, int regnum) pid = ptid_get_pid (inferior_ptid); /* This isn't really an address, but ptrace thinks of it as one. */ - addr = ia64_register_addr (regnum); + addr = ia64_register_addr (gdbarch, regnum); size = register_size (gdbarch, regnum); gdb_assert ((size % sizeof (PTRACE_TYPE_RET)) == 0); @@ -740,7 +740,7 @@ ia64_linux_store_register (const struct regcache *regcache, int regnum) PTRACE_TYPE_RET *buf; int pid, i; - if (ia64_cannot_store_register (regnum)) + if (ia64_cannot_store_register (gdbarch, regnum)) return; /* Cater for systems like GNU/Linux, that implement threads as @@ -750,7 +750,7 @@ ia64_linux_store_register (const struct regcache *regcache, int regnum) pid = ptid_get_pid (inferior_ptid); /* This isn't really an address, but ptrace thinks of it as one. */ - addr = ia64_register_addr (regnum); + addr = ia64_register_addr (gdbarch, regnum); size = register_size (gdbarch, regnum); gdb_assert ((size % sizeof (PTRACE_TYPE_RET)) == 0); diff --git a/gdb/ia64-tdep.c b/gdb/ia64-tdep.c index debee50851..ea030a763e 100644 --- a/gdb/ia64-tdep.c +++ b/gdb/ia64-tdep.c @@ -274,9 +274,6 @@ struct ia64_frame_cache }; -#define SIGCONTEXT_REGISTER_ADDRESS \ - (gdbarch_tdep (current_gdbarch)->sigcontext_register_address) - int ia64_register_reggroup_p (struct gdbarch *gdbarch, int regnum, struct reggroup *group) @@ -1909,41 +1906,44 @@ ia64_frame_sniffer (struct frame_info *next_frame) /* Signal trampolines. */ static void -ia64_sigtramp_frame_init_saved_regs (struct ia64_frame_cache *cache) +ia64_sigtramp_frame_init_saved_regs (struct frame_info *next_frame, + struct ia64_frame_cache *cache) { - if (SIGCONTEXT_REGISTER_ADDRESS) + struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (next_frame)); + + if (tdep->sigcontext_register_address) { int regno; cache->saved_regs[IA64_VRAP_REGNUM] = - SIGCONTEXT_REGISTER_ADDRESS (cache->base, IA64_IP_REGNUM); + tdep->sigcontext_register_address (cache->base, IA64_IP_REGNUM); cache->saved_regs[IA64_CFM_REGNUM] = - SIGCONTEXT_REGISTER_ADDRESS (cache->base, IA64_CFM_REGNUM); + tdep->sigcontext_register_address (cache->base, IA64_CFM_REGNUM); cache->saved_regs[IA64_PSR_REGNUM] = - SIGCONTEXT_REGISTER_ADDRESS (cache->base, IA64_PSR_REGNUM); + tdep->sigcontext_register_address (cache->base, IA64_PSR_REGNUM); cache->saved_regs[IA64_BSP_REGNUM] = - SIGCONTEXT_REGISTER_ADDRESS (cache->base, IA64_BSP_REGNUM); + tdep->sigcontext_register_address (cache->base, IA64_BSP_REGNUM); cache->saved_regs[IA64_RNAT_REGNUM] = - SIGCONTEXT_REGISTER_ADDRESS (cache->base, IA64_RNAT_REGNUM); + tdep->sigcontext_register_address (cache->base, IA64_RNAT_REGNUM); cache->saved_regs[IA64_CCV_REGNUM] = - SIGCONTEXT_REGISTER_ADDRESS (cache->base, IA64_CCV_REGNUM); + tdep->sigcontext_register_address (cache->base, IA64_CCV_REGNUM); cache->saved_regs[IA64_UNAT_REGNUM] = - SIGCONTEXT_REGISTER_ADDRESS (cache->base, IA64_UNAT_REGNUM); + tdep->sigcontext_register_address (cache->base, IA64_UNAT_REGNUM); cache->saved_regs[IA64_FPSR_REGNUM] = - SIGCONTEXT_REGISTER_ADDRESS (cache->base, IA64_FPSR_REGNUM); + tdep->sigcontext_register_address (cache->base, IA64_FPSR_REGNUM); cache->saved_regs[IA64_PFS_REGNUM] = - SIGCONTEXT_REGISTER_ADDRESS (cache->base, IA64_PFS_REGNUM); + tdep->sigcontext_register_address (cache->base, IA64_PFS_REGNUM); cache->saved_regs[IA64_LC_REGNUM] = - SIGCONTEXT_REGISTER_ADDRESS (cache->base, IA64_LC_REGNUM); + tdep->sigcontext_register_address (cache->base, IA64_LC_REGNUM); for (regno = IA64_GR1_REGNUM; regno <= IA64_GR31_REGNUM; regno++) cache->saved_regs[regno] = - SIGCONTEXT_REGISTER_ADDRESS (cache->base, regno); + tdep->sigcontext_register_address (cache->base, regno); for (regno = IA64_BR0_REGNUM; regno <= IA64_BR7_REGNUM; regno++) cache->saved_regs[regno] = - SIGCONTEXT_REGISTER_ADDRESS (cache->base, regno); + tdep->sigcontext_register_address (cache->base, regno); for (regno = IA64_FR2_REGNUM; regno <= IA64_FR31_REGNUM; regno++) cache->saved_regs[regno] = - SIGCONTEXT_REGISTER_ADDRESS (cache->base, regno); + tdep->sigcontext_register_address (cache->base, regno); } } @@ -1972,7 +1972,7 @@ ia64_sigtramp_frame_cache (struct frame_info *next_frame, void **this_cache) cache->cfm = extract_unsigned_integer (buf, 8); cache->sof = cache->cfm & 0x7f; - ia64_sigtramp_frame_init_saved_regs (cache); + ia64_sigtramp_frame_init_saved_regs (next_frame, cache); *this_cache = cache; return cache;