From aa70a99eb03444f41f50e100c9b1e00e9a32cde9 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Mon, 15 Nov 2021 15:22:34 -0500 Subject: [PATCH] gdb: adjust gdbarch_tdep calls in nat files Commit 345bd07cce33 ("gdb: fix gdbarch_tdep ODR violation") forgot to update the gdbarch_tdep calls in the native files other than x86-64 Linux. This patch updates them all (to the best of my knowledge). These are the files I was able to build-test: aarch64-linux-nat.c amd64-bsd-nat.c arm-linux-nat.c ppc-linux-nat.c windows-nat.c xtensa-linux-nat.c And these are the ones I could not build-test: aix-thread.c arm-netbsd-nat.c ppc-fbsd-nat.c ppc-netbsd-nat.c ia64-tdep.c (the part that needs libunwind) ppc-obsd-nat.c rs6000-nat.c If there are still some build problems related to gdbarch_tdep in them, they should be pretty obvious to fix. Change-Id: Iaa3d791a850e4432973757598e634e3da6061428 --- gdb/aarch64-linux-nat.c | 19 ++++--- gdb/aix-thread.c | 31 ++++++------ gdb/amd64-bsd-nat.c | 4 +- gdb/arm-linux-nat.c | 8 +-- gdb/arm-netbsd-nat.c | 8 +-- gdb/ia64-tdep.c | 3 +- gdb/ppc-fbsd-nat.c | 4 +- gdb/ppc-linux-nat.c | 22 ++++----- gdb/ppc-netbsd-nat.c | 6 +-- gdb/ppc-obsd-nat.c | 4 +- gdb/rs6000-nat.c | 6 +-- gdb/windows-nat.c | 2 +- gdb/xtensa-linux-nat.c | 106 ++++++++++++++++++++-------------------- 13 files changed, 118 insertions(+), 105 deletions(-) diff --git a/gdb/aarch64-linux-nat.c b/gdb/aarch64-linux-nat.c index c7cbebbc351..aa42365d25d 100644 --- a/gdb/aarch64-linux-nat.c +++ b/gdb/aarch64-linux-nat.c @@ -454,7 +454,8 @@ store_sveregs_to_thread (struct regcache *regcache) static void fetch_pauth_masks_from_thread (struct regcache *regcache) { - struct gdbarch_tdep *tdep = gdbarch_tdep (regcache->arch ()); + aarch64_gdbarch_tdep *tdep + = (aarch64_gdbarch_tdep *) gdbarch_tdep (regcache->arch ()); int ret; struct iovec iovec; uint64_t pauth_regset[2] = {0, 0}; @@ -479,7 +480,8 @@ fetch_pauth_masks_from_thread (struct regcache *regcache) static void fetch_mteregs_from_thread (struct regcache *regcache) { - struct gdbarch_tdep *tdep = gdbarch_tdep (regcache->arch ()); + aarch64_gdbarch_tdep *tdep + = (aarch64_gdbarch_tdep *) gdbarch_tdep (regcache->arch ()); int regno = tdep->mte_reg_base; gdb_assert (regno != -1); @@ -503,7 +505,8 @@ fetch_mteregs_from_thread (struct regcache *regcache) static void store_mteregs_to_thread (struct regcache *regcache) { - struct gdbarch_tdep *tdep = gdbarch_tdep (regcache->arch ()); + aarch64_gdbarch_tdep *tdep + = (aarch64_gdbarch_tdep *) gdbarch_tdep (regcache->arch ()); int regno = tdep->mte_reg_base; gdb_assert (regno != -1); @@ -531,7 +534,8 @@ void aarch64_linux_nat_target::fetch_registers (struct regcache *regcache, int regno) { - struct gdbarch_tdep *tdep = gdbarch_tdep (regcache->arch ()); + aarch64_gdbarch_tdep *tdep + = (aarch64_gdbarch_tdep *) gdbarch_tdep (regcache->arch ()); if (regno == -1) { @@ -573,7 +577,8 @@ void aarch64_linux_nat_target::store_registers (struct regcache *regcache, int regno) { - struct gdbarch_tdep *tdep = gdbarch_tdep (regcache->arch ()); + aarch64_gdbarch_tdep *tdep + = (aarch64_gdbarch_tdep *) gdbarch_tdep (regcache->arch ()); if (regno == -1) { @@ -1052,7 +1057,9 @@ aarch64_linux_nat_target::thread_architecture (ptid_t ptid) return it if the current vector length matches the one in the tdep. */ inferior *inf = find_inferior_ptid (this, ptid); gdb_assert (inf != NULL); - if (vq == gdbarch_tdep (inf->gdbarch)->vq) + aarch64_gdbarch_tdep *tdep + = (aarch64_gdbarch_tdep *) gdbarch_tdep (inf->gdbarch); + if (vq == tdep->vq) return inf->gdbarch; /* We reach here if the vector length for the thread is different from its diff --git a/gdb/aix-thread.c b/gdb/aix-thread.c index a604320d666..77691293bb0 100644 --- a/gdb/aix-thread.c +++ b/gdb/aix-thread.c @@ -1113,7 +1113,8 @@ aix_thread_target::wait (ptid_t ptid, struct target_waitstatus *status, static void supply_gprs64 (struct regcache *regcache, uint64_t *vals) { - struct gdbarch_tdep *tdep = gdbarch_tdep (regcache->arch ()); + ppc_gdbarch_tdep *tdep + = (ppc_gdbarch_tdep *) gdbarch_tdep (regcache->arch ()); int regno; for (regno = 0; regno < ppc_num_gprs; regno++) @@ -1135,7 +1136,7 @@ static void supply_fprs (struct regcache *regcache, double *vals) { struct gdbarch *gdbarch = regcache->arch (); - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch); int regno; /* This function should never be called on architectures without @@ -1153,7 +1154,7 @@ supply_fprs (struct regcache *regcache, double *vals) static int special_register_p (struct gdbarch *gdbarch, int regno) { - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch); return regno == gdbarch_pc_regnum (gdbarch) || regno == tdep->ppc_ps_regnum @@ -1176,7 +1177,7 @@ supply_sprs64 (struct regcache *regcache, uint32_t fpscr) { struct gdbarch *gdbarch = regcache->arch (); - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch); regcache->raw_supply (gdbarch_pc_regnum (gdbarch), (char *) &iar); regcache->raw_supply (tdep->ppc_ps_regnum, (char *) &msr); @@ -1198,7 +1199,7 @@ supply_sprs32 (struct regcache *regcache, uint32_t fpscr) { struct gdbarch *gdbarch = regcache->arch (); - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch); regcache->raw_supply (gdbarch_pc_regnum (gdbarch), (char *) &iar); regcache->raw_supply (tdep->ppc_ps_regnum, (char *) &msr); @@ -1221,7 +1222,7 @@ static void fetch_regs_user_thread (struct regcache *regcache, pthdb_pthread_t pdtid) { struct gdbarch *gdbarch = regcache->arch (); - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch); int status, i; pthdb_context_t ctx; @@ -1276,7 +1277,7 @@ fetch_regs_kernel_thread (struct regcache *regcache, int regno, pthdb_tid_t tid) { struct gdbarch *gdbarch = regcache->arch (); - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch); uint64_t gprs64[ppc_num_gprs]; uint32_t gprs32[ppc_num_gprs]; double fprs[ppc_num_fprs]; @@ -1378,7 +1379,8 @@ aix_thread_target::fetch_registers (struct regcache *regcache, int regno) static void fill_gprs64 (const struct regcache *regcache, uint64_t *vals) { - struct gdbarch_tdep *tdep = gdbarch_tdep (regcache->arch ()); + ppc_gdbarch_tdep *tdep + = (ppc_gdbarch_tdep *) gdbarch_tdep (regcache->arch ()); int regno; for (regno = 0; regno < ppc_num_gprs; regno++) @@ -1390,7 +1392,8 @@ fill_gprs64 (const struct regcache *regcache, uint64_t *vals) static void fill_gprs32 (const struct regcache *regcache, uint32_t *vals) { - struct gdbarch_tdep *tdep = gdbarch_tdep (regcache->arch ()); + ppc_gdbarch_tdep *tdep + = (ppc_gdbarch_tdep *) gdbarch_tdep (regcache->arch ()); int regno; for (regno = 0; regno < ppc_num_gprs; regno++) @@ -1404,7 +1407,7 @@ static void fill_fprs (const struct regcache *regcache, double *vals) { struct gdbarch *gdbarch = regcache->arch (); - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch); int regno; /* This function should never be called on architectures without @@ -1428,7 +1431,7 @@ fill_sprs64 (const struct regcache *regcache, uint32_t *fpscr) { struct gdbarch *gdbarch = regcache->arch (); - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch); /* Verify that the size of the size of the IAR buffer is the same as the raw size of the PC (in the register cache). If @@ -1462,7 +1465,7 @@ fill_sprs32 (const struct regcache *regcache, uint32_t *fpscr) { struct gdbarch *gdbarch = regcache->arch (); - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch); /* Verify that the size of the size of the IAR buffer is the same as the raw size of the PC (in the register cache). If @@ -1499,7 +1502,7 @@ static void store_regs_user_thread (const struct regcache *regcache, pthdb_pthread_t pdtid) { struct gdbarch *gdbarch = regcache->arch (); - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch); int status, i; pthdb_context_t ctx; uint32_t int32; @@ -1589,7 +1592,7 @@ store_regs_kernel_thread (const struct regcache *regcache, int regno, pthdb_tid_t tid) { struct gdbarch *gdbarch = regcache->arch (); - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch); uint64_t gprs64[ppc_num_gprs]; uint32_t gprs32[ppc_num_gprs]; double fprs[ppc_num_fprs]; diff --git a/gdb/amd64-bsd-nat.c b/gdb/amd64-bsd-nat.c index 3e0c29a22f7..1720c84ea06 100644 --- a/gdb/amd64-bsd-nat.c +++ b/gdb/amd64-bsd-nat.c @@ -60,7 +60,7 @@ amd64bsd_fetch_inferior_registers (struct regcache *regcache, int regnum) struct gdbarch *gdbarch = regcache->arch (); ptid_t ptid = regcache->ptid (); #if defined(PT_GETFSBASE) || defined(PT_GETGSBASE) - const struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch); #endif if (regnum == -1 || amd64_native_gregset_supplies_p (gdbarch, regnum)) @@ -136,7 +136,7 @@ amd64bsd_store_inferior_registers (struct regcache *regcache, int regnum) struct gdbarch *gdbarch = regcache->arch (); ptid_t ptid = regcache->ptid (); #if defined(PT_SETFSBASE) || defined(PT_SETGSBASE) - const struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch); #endif if (regnum == -1 || amd64_native_gregset_supplies_p (gdbarch, regnum)) diff --git a/gdb/arm-linux-nat.c b/gdb/arm-linux-nat.c index 880ac0da044..5ae16e19943 100644 --- a/gdb/arm-linux-nat.c +++ b/gdb/arm-linux-nat.c @@ -339,7 +339,7 @@ fetch_vfp_regs (struct regcache *regcache) gdb_byte regbuf[ARM_VFP3_REGS_SIZE]; int ret, tid; struct gdbarch *gdbarch = regcache->arch (); - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + arm_gdbarch_tdep *tdep = (arm_gdbarch_tdep *) gdbarch_tdep (gdbarch); /* Get the thread id for the ptrace call. */ tid = regcache->ptid ().lwp (); @@ -368,7 +368,7 @@ store_vfp_regs (const struct regcache *regcache) gdb_byte regbuf[ARM_VFP3_REGS_SIZE]; int ret, tid; struct gdbarch *gdbarch = regcache->arch (); - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + arm_gdbarch_tdep *tdep = (arm_gdbarch_tdep *) gdbarch_tdep (gdbarch); /* Get the thread id for the ptrace call. */ tid = regcache->ptid ().lwp (); @@ -413,7 +413,7 @@ void arm_linux_nat_target::fetch_registers (struct regcache *regcache, int regno) { struct gdbarch *gdbarch = regcache->arch (); - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + arm_gdbarch_tdep *tdep = (arm_gdbarch_tdep *) gdbarch_tdep (gdbarch); if (-1 == regno) { @@ -450,7 +450,7 @@ void arm_linux_nat_target::store_registers (struct regcache *regcache, int regno) { struct gdbarch *gdbarch = regcache->arch (); - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + arm_gdbarch_tdep *tdep = (arm_gdbarch_tdep *) gdbarch_tdep (gdbarch); if (-1 == regno) { diff --git a/gdb/arm-netbsd-nat.c b/gdb/arm-netbsd-nat.c index e2b84f2f596..0d1884648ac 100644 --- a/gdb/arm-netbsd-nat.c +++ b/gdb/arm-netbsd-nat.c @@ -50,7 +50,7 @@ static arm_netbsd_nat_target the_arm_netbsd_nat_target; static void arm_supply_vfpregset (struct regcache *regcache, struct fpreg *fpregset) { - struct gdbarch_tdep *tdep = gdbarch_tdep (regcache->arch ()); + arm_gdbarch_tdep *tdep = (arm_gdbarch_tdep *) gdbarch_tdep (regcache->arch ()); if (tdep->vfp_register_count == 0) return; @@ -97,7 +97,7 @@ fetch_fp_register (struct regcache *regcache, int regno) return; } - struct gdbarch_tdep *tdep = gdbarch_tdep (regcache->arch ()); + arm_gdbarch_tdep *tdep = (arm_gdbarch_tdep *) gdbarch_tdep (regcache->arch ()); if (regno == ARM_FPSCR_REGNUM && tdep->vfp_register_count != 0) regcache->raw_supply (ARM_FPSCR_REGNUM, (char *) &vfp.vfp_fpscr); else if (regno >= ARM_D0_REGNUM @@ -279,7 +279,7 @@ store_fp_register (const struct regcache *regcache, int regno) return; } - struct gdbarch_tdep *tdep = gdbarch_tdep (regcache->arch ()); + arm_gdbarch_tdep *tdep = (arm_gdbarch_tdep *) gdbarch_tdep (regcache->arch ()); if (regno == ARM_FPSCR_REGNUM && tdep->vfp_register_count != 0) regcache->raw_collect (ARM_FPSCR_REGNUM, (char *) &vfp.vfp_fpscr); else if (regno >= ARM_D0_REGNUM @@ -301,7 +301,7 @@ store_fp_register (const struct regcache *regcache, int regno) static void store_fp_regs (const struct regcache *regcache) { - struct gdbarch_tdep *tdep = gdbarch_tdep (regcache->arch ()); + arm_gdbarch_tdep *tdep = (arm_gdbarch_tdep *) gdbarch_tdep (regcache->arch ()); int lwp = regcache->ptid ().lwp (); if (tdep->vfp_register_count == 0) return; diff --git a/gdb/ia64-tdep.c b/gdb/ia64-tdep.c index 08c5d6a72ef..829909dab18 100644 --- a/gdb/ia64-tdep.c +++ b/gdb/ia64-tdep.c @@ -2485,6 +2485,7 @@ ia64_access_reg (unw_addr_space_t as, unw_regnum_t uw_regnum, unw_word_t *val, unw_word_t bsp, sof, cfm, psr, ip; struct frame_info *this_frame = (struct frame_info *) arg; struct gdbarch *gdbarch = get_frame_arch (this_frame); + ia64_gdbarch_tdep *tdep = (ia64_gdbarch_tdep *) gdbarch_tdep (gdbarch); /* We never call any libunwind routines that need to write registers. */ gdb_assert (!write); @@ -2506,7 +2507,7 @@ ia64_access_reg (unw_addr_space_t as, unw_regnum_t uw_regnum, unw_word_t *val, the current register frame. */ bsp = get_frame_register_unsigned (this_frame, IA64_BSP_REGNUM); cfm = get_frame_register_unsigned (this_frame, IA64_CFM_REGNUM); - sof = gdbarch_tdep (gdbarch)->size_of_register_frame (this_frame, cfm); + sof = tdep->size_of_register_frame (this_frame, cfm); *val = ia64_rse_skip_regs (bsp, -sof); break; diff --git a/gdb/ppc-fbsd-nat.c b/gdb/ppc-fbsd-nat.c index 533e70daba5..a6320a6829a 100644 --- a/gdb/ppc-fbsd-nat.c +++ b/gdb/ppc-fbsd-nat.c @@ -100,7 +100,7 @@ fill_fpregset (const struct regcache *regcache, static int getfpregs_supplies (struct gdbarch *gdbarch, int regno) { - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch); /* FIXME: jimb/2004-05-05: Some PPC variants don't have floating point registers. Traditionally, GDB's register set has still @@ -185,7 +185,7 @@ static int ppcfbsd_supply_pcb (struct regcache *regcache, struct pcb *pcb) { struct gdbarch *gdbarch = regcache->arch (); - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch); int i, regnum; /* The stack pointer shouldn't be zero. */ diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c index 06a30efeaef..9bd940c85a0 100644 --- a/gdb/ppc-linux-nat.c +++ b/gdb/ppc-linux-nat.c @@ -649,7 +649,7 @@ static int ppc_register_u_addr (struct gdbarch *gdbarch, int regno) { int u_addr = -1; - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch); /* NOTE: cagney/2003-11-25: This is the word size used by the ptrace interface, and not the wordsize of the program's ABI. */ int wordsize = sizeof (long); @@ -802,7 +802,7 @@ static void fetch_spe_register (struct regcache *regcache, int tid, int regno) { struct gdbarch *gdbarch = regcache->arch (); - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch); struct gdb_evrregset_t evrregs; gdb_assert (sizeof (evrregs.evr[0]) @@ -911,7 +911,7 @@ static void fetch_register (struct regcache *regcache, int tid, int regno) { struct gdbarch *gdbarch = regcache->arch (); - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch); /* This isn't really an address. But ptrace thinks of it as one. */ CORE_ADDR regaddr = ppc_register_u_addr (gdbarch, regno); int bytes_transferred; @@ -1156,7 +1156,7 @@ static void fetch_gp_regs (struct regcache *regcache, int tid) { struct gdbarch *gdbarch = regcache->arch (); - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch); int i; if (have_ptrace_getsetregs) @@ -1208,7 +1208,7 @@ static void fetch_fp_regs (struct regcache *regcache, int tid) { struct gdbarch *gdbarch = regcache->arch (); - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch); int i; if (have_ptrace_getsetfpregs) @@ -1226,7 +1226,7 @@ static void fetch_ppc_registers (struct regcache *regcache, int tid) { struct gdbarch *gdbarch = regcache->arch (); - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch); fetch_gp_regs (regcache, tid); if (tdep->ppc_fp0_regnum >= 0) @@ -1425,7 +1425,7 @@ static void store_spe_register (const struct regcache *regcache, int tid, int regno) { struct gdbarch *gdbarch = regcache->arch (); - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch); struct gdb_evrregset_t evrregs; gdb_assert (sizeof (evrregs.evr[0]) @@ -1477,7 +1477,7 @@ static void store_register (const struct regcache *regcache, int tid, int regno) { struct gdbarch *gdbarch = regcache->arch (); - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch); /* This isn't really an address. But ptrace thinks of it as one. */ CORE_ADDR regaddr = ppc_register_u_addr (gdbarch, regno); int i; @@ -1718,7 +1718,7 @@ static void store_gp_regs (const struct regcache *regcache, int tid, int regno) { struct gdbarch *gdbarch = regcache->arch (); - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch); int i; if (have_ptrace_getsetregs) @@ -1780,7 +1780,7 @@ static void store_fp_regs (const struct regcache *regcache, int tid, int regno) { struct gdbarch *gdbarch = regcache->arch (); - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch); int i; if (have_ptrace_getsetfpregs) @@ -1798,7 +1798,7 @@ static void store_ppc_registers (const struct regcache *regcache, int tid) { struct gdbarch *gdbarch = regcache->arch (); - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch); store_gp_regs (regcache, tid, -1); if (tdep->ppc_fp0_regnum >= 0) diff --git a/gdb/ppc-netbsd-nat.c b/gdb/ppc-netbsd-nat.c index 316fc781ae6..fa58fd76693 100644 --- a/gdb/ppc-netbsd-nat.c +++ b/gdb/ppc-netbsd-nat.c @@ -52,7 +52,7 @@ static ppc_nbsd_nat_target the_ppc_nbsd_nat_target; static int getregs_supplies (struct gdbarch *gdbarch, int regnum) { - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch); return ((regnum >= tdep->ppc_gp0_regnum && regnum < tdep->ppc_gp0_regnum + ppc_num_gprs) @@ -68,7 +68,7 @@ getregs_supplies (struct gdbarch *gdbarch, int regnum) static int getfpregs_supplies (struct gdbarch *gdbarch, int regnum) { - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch); /* FIXME: jimb/2004-05-05: Some PPC variants don't have floating point registers. Traditionally, GDB's register set has still @@ -159,7 +159,7 @@ ppcnbsd_supply_pcb (struct regcache *regcache, struct pcb *pcb) struct switchframe sf; struct callframe cf; struct gdbarch *gdbarch = regcache->arch (); - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch); int i; /* The stack pointer shouldn't be zero. */ diff --git a/gdb/ppc-obsd-nat.c b/gdb/ppc-obsd-nat.c index 53a679d3cac..ff337009b17 100644 --- a/gdb/ppc-obsd-nat.c +++ b/gdb/ppc-obsd-nat.c @@ -54,7 +54,7 @@ static ppc_obsd_nat_target the_ppc_obsd_nat_target; static int getfpregs_supplies (struct gdbarch *gdbarch, int regnum) { - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch); /* FIXME: jimb/2004-05-05: Some PPC variants don't have floating point registers. Traditionally, GDB's register set has still @@ -154,7 +154,7 @@ static int ppcobsd_supply_pcb (struct regcache *regcache, struct pcb *pcb) { struct gdbarch *gdbarch = regcache->arch (); - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch); struct switchframe sf; struct callframe cf; int i, regnum; diff --git a/gdb/rs6000-nat.c b/gdb/rs6000-nat.c index 6d5996c2011..c266c50777f 100644 --- a/gdb/rs6000-nat.c +++ b/gdb/rs6000-nat.c @@ -111,7 +111,7 @@ static rs6000_nat_target the_rs6000_nat_target; static int regmap (struct gdbarch *gdbarch, int regno, int *isfloat) { - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch); *isfloat = 0; if (tdep->ppc_gp0_regnum <= regno @@ -313,7 +313,7 @@ rs6000_nat_target::fetch_registers (struct regcache *regcache, int regno) else { - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch); /* Read 32 general purpose registers. */ for (regno = tdep->ppc_gp0_regnum; @@ -355,7 +355,7 @@ rs6000_nat_target::store_registers (struct regcache *regcache, int regno) else { - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch); /* Write general purpose registers first. */ for (regno = tdep->ppc_gp0_regnum; diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c index f3201295f31..32b030fdb51 100644 --- a/gdb/windows-nat.c +++ b/gdb/windows-nat.c @@ -475,7 +475,7 @@ windows_fetch_one_register (struct regcache *regcache, char *context_offset = context_ptr + mappings[r]; struct gdbarch *gdbarch = regcache->arch (); - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch); gdb_assert (!gdbarch_read_pc_p (gdbarch)); gdb_assert (gdbarch_pc_regnum (gdbarch) >= 0); diff --git a/gdb/xtensa-linux-nat.c b/gdb/xtensa-linux-nat.c index 7bc1689b9f5..abecb7aec74 100644 --- a/gdb/xtensa-linux-nat.c +++ b/gdb/xtensa-linux-nat.c @@ -62,56 +62,57 @@ fill_gregset (const struct regcache *regcache, int i; xtensa_elf_gregset_t *regs = (xtensa_elf_gregset_t *) gregsetp; struct gdbarch *gdbarch = regcache->arch (); + xtensa_gdbarch_tdep *tdep = (xtensa_gdbarch_tdep *) gdbarch_tdep (gdbarch); if (regnum == gdbarch_pc_regnum (gdbarch) || regnum == -1) regcache->raw_collect (gdbarch_pc_regnum (gdbarch), ®s->pc); if (regnum == gdbarch_ps_regnum (gdbarch) || regnum == -1) regcache->raw_collect (gdbarch_ps_regnum (gdbarch), ®s->ps); - if (regnum == gdbarch_tdep (gdbarch)->wb_regnum || regnum == -1) - regcache->raw_collect (gdbarch_tdep (gdbarch)->wb_regnum, + if (regnum == tdep->wb_regnum || regnum == -1) + regcache->raw_collect (tdep->wb_regnum, ®s->windowbase); - if (regnum == gdbarch_tdep (gdbarch)->ws_regnum || regnum == -1) - regcache->raw_collect (gdbarch_tdep (gdbarch)->ws_regnum, + if (regnum == tdep->ws_regnum || regnum == -1) + regcache->raw_collect (tdep->ws_regnum, ®s->windowstart); - if (regnum == gdbarch_tdep (gdbarch)->lbeg_regnum || regnum == -1) - regcache->raw_collect (gdbarch_tdep (gdbarch)->lbeg_regnum, + if (regnum == tdep->lbeg_regnum || regnum == -1) + regcache->raw_collect (tdep->lbeg_regnum, ®s->lbeg); - if (regnum == gdbarch_tdep (gdbarch)->lend_regnum || regnum == -1) - regcache->raw_collect (gdbarch_tdep (gdbarch)->lend_regnum, + if (regnum == tdep->lend_regnum || regnum == -1) + regcache->raw_collect (tdep->lend_regnum, ®s->lend); - if (regnum == gdbarch_tdep (gdbarch)->lcount_regnum || regnum == -1) - regcache->raw_collect (gdbarch_tdep (gdbarch)->lcount_regnum, + if (regnum == tdep->lcount_regnum || regnum == -1) + regcache->raw_collect (tdep->lcount_regnum, ®s->lcount); - if (regnum == gdbarch_tdep (gdbarch)->sar_regnum || regnum == -1) - regcache->raw_collect (gdbarch_tdep (gdbarch)->sar_regnum, + if (regnum == tdep->sar_regnum || regnum == -1) + regcache->raw_collect (tdep->sar_regnum, ®s->sar); - if (regnum == gdbarch_tdep (gdbarch)->threadptr_regnum || regnum == -1) - regcache->raw_collect (gdbarch_tdep (gdbarch)->threadptr_regnum, + if (regnum == tdep->threadptr_regnum || regnum == -1) + regcache->raw_collect (tdep->threadptr_regnum, ®s->threadptr); - if (regnum >=gdbarch_tdep (gdbarch)->ar_base - && regnum < gdbarch_tdep (gdbarch)->ar_base - + gdbarch_tdep (gdbarch)->num_aregs) + if (regnum >=tdep->ar_base + && regnum < tdep->ar_base + + tdep->num_aregs) regcache->raw_collect (regnum, - ®s->ar[regnum - gdbarch_tdep (gdbarch)->ar_base]); + ®s->ar[regnum - tdep->ar_base]); else if (regnum == -1) { - for (i = 0; i < gdbarch_tdep (gdbarch)->num_aregs; ++i) - regcache->raw_collect (gdbarch_tdep (gdbarch)->ar_base + i, + for (i = 0; i < tdep->num_aregs; ++i) + regcache->raw_collect (tdep->ar_base + i, ®s->ar[i]); } - if (regnum >= gdbarch_tdep (gdbarch)->a0_base - && regnum < gdbarch_tdep (gdbarch)->a0_base + C0_NREGS) + if (regnum >= tdep->a0_base + && regnum < tdep->a0_base + C0_NREGS) regcache->raw_collect (regnum, ®s->ar[(4 * regs->windowbase + regnum - - gdbarch_tdep (gdbarch)->a0_base) - % gdbarch_tdep (gdbarch)->num_aregs]); + - tdep->a0_base) + % tdep->num_aregs]); else if (regnum == -1) { for (i = 0; i < C0_NREGS; ++i) - regcache->raw_collect (gdbarch_tdep (gdbarch)->a0_base + i, + regcache->raw_collect (tdep->a0_base + i, (®s->ar[(4 * regs->windowbase + i) - % gdbarch_tdep (gdbarch)->num_aregs])); + % tdep->num_aregs])); } } @@ -123,56 +124,57 @@ supply_gregset_reg (struct regcache *regcache, xtensa_elf_gregset_t *regs = (xtensa_elf_gregset_t *) gregsetp; struct gdbarch *gdbarch = regcache->arch (); + xtensa_gdbarch_tdep *tdep = (xtensa_gdbarch_tdep *) gdbarch_tdep (gdbarch); if (regnum == gdbarch_pc_regnum (gdbarch) || regnum == -1) regcache->raw_supply (gdbarch_pc_regnum (gdbarch), ®s->pc); if (regnum == gdbarch_ps_regnum (gdbarch) || regnum == -1) regcache->raw_supply (gdbarch_ps_regnum (gdbarch), ®s->ps); - if (regnum == gdbarch_tdep (gdbarch)->wb_regnum || regnum == -1) - regcache->raw_supply (gdbarch_tdep (gdbarch)->wb_regnum, + if (regnum == tdep->wb_regnum || regnum == -1) + regcache->raw_supply (tdep->wb_regnum, ®s->windowbase); - if (regnum == gdbarch_tdep (gdbarch)->ws_regnum || regnum == -1) - regcache->raw_supply (gdbarch_tdep (gdbarch)->ws_regnum, + if (regnum == tdep->ws_regnum || regnum == -1) + regcache->raw_supply (tdep->ws_regnum, ®s->windowstart); - if (regnum == gdbarch_tdep (gdbarch)->lbeg_regnum || regnum == -1) - regcache->raw_supply (gdbarch_tdep (gdbarch)->lbeg_regnum, + if (regnum == tdep->lbeg_regnum || regnum == -1) + regcache->raw_supply (tdep->lbeg_regnum, ®s->lbeg); - if (regnum == gdbarch_tdep (gdbarch)->lend_regnum || regnum == -1) - regcache->raw_supply (gdbarch_tdep (gdbarch)->lend_regnum, + if (regnum == tdep->lend_regnum || regnum == -1) + regcache->raw_supply (tdep->lend_regnum, ®s->lend); - if (regnum == gdbarch_tdep (gdbarch)->lcount_regnum || regnum == -1) - regcache->raw_supply (gdbarch_tdep (gdbarch)->lcount_regnum, + if (regnum == tdep->lcount_regnum || regnum == -1) + regcache->raw_supply (tdep->lcount_regnum, ®s->lcount); - if (regnum == gdbarch_tdep (gdbarch)->sar_regnum || regnum == -1) - regcache->raw_supply (gdbarch_tdep (gdbarch)->sar_regnum, + if (regnum == tdep->sar_regnum || regnum == -1) + regcache->raw_supply (tdep->sar_regnum, ®s->sar); - if (regnum == gdbarch_tdep (gdbarch)->threadptr_regnum || regnum == -1) - regcache->raw_supply (gdbarch_tdep (gdbarch)->threadptr_regnum, + if (regnum == tdep->threadptr_regnum || regnum == -1) + regcache->raw_supply (tdep->threadptr_regnum, ®s->threadptr); - if (regnum >=gdbarch_tdep (gdbarch)->ar_base - && regnum < gdbarch_tdep (gdbarch)->ar_base - + gdbarch_tdep (gdbarch)->num_aregs) + if (regnum >=tdep->ar_base + && regnum < tdep->ar_base + + tdep->num_aregs) regcache->raw_supply (regnum, - ®s->ar[regnum - gdbarch_tdep (gdbarch)->ar_base]); + ®s->ar[regnum - tdep->ar_base]); else if (regnum == -1) { - for (i = 0; i < gdbarch_tdep (gdbarch)->num_aregs; ++i) - regcache->raw_supply (gdbarch_tdep (gdbarch)->ar_base + i, + for (i = 0; i < tdep->num_aregs; ++i) + regcache->raw_supply (tdep->ar_base + i, ®s->ar[i]); } - if (regnum >= gdbarch_tdep (gdbarch)->a0_base - && regnum < gdbarch_tdep (gdbarch)->a0_base + C0_NREGS) + if (regnum >= tdep->a0_base + && regnum < tdep->a0_base + C0_NREGS) regcache->raw_supply (regnum, ®s->ar[(4 * regs->windowbase + regnum - - gdbarch_tdep (gdbarch)->a0_base) - % gdbarch_tdep (gdbarch)->num_aregs]); + - tdep->a0_base) + % tdep->num_aregs]); else if (regnum == -1) { for (i = 0; i < C0_NREGS; ++i) - regcache->raw_supply (gdbarch_tdep (gdbarch)->a0_base + i, + regcache->raw_supply (tdep->a0_base + i, ®s->ar[(4 * regs->windowbase + i) - % gdbarch_tdep (gdbarch)->num_aregs]); + % tdep->num_aregs]); } } -- 2.30.2