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
This commit is contained in:
Simon Marchi 2021-11-15 15:22:34 -05:00
parent 39cdfdb261
commit aa70a99eb0
13 changed files with 118 additions and 105 deletions

View File

@ -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

View File

@ -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];

View File

@ -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))

View File

@ -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)
{

View File

@ -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;

View File

@ -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;

View File

@ -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. */

View File

@ -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)

View File

@ -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. */

View File

@ -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;

View File

@ -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;

View File

@ -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);

View File

@ -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), &regs->pc);
if (regnum == gdbarch_ps_regnum (gdbarch) || regnum == -1)
regcache->raw_collect (gdbarch_ps_regnum (gdbarch), &regs->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,
&regs->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,
&regs->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,
&regs->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,
&regs->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,
&regs->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,
&regs->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,
&regs->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,
&regs->ar[regnum - gdbarch_tdep (gdbarch)->ar_base]);
&regs->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,
&regs->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,
&regs->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,
(&regs->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), &regs->pc);
if (regnum == gdbarch_ps_regnum (gdbarch) || regnum == -1)
regcache->raw_supply (gdbarch_ps_regnum (gdbarch), &regs->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,
&regs->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,
&regs->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,
&regs->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,
&regs->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,
&regs->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,
&regs->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,
&regs->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,
&regs->ar[regnum - gdbarch_tdep (gdbarch)->ar_base]);
&regs->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,
&regs->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,
&regs->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,
&regs->ar[(4 * regs->windowbase + i)
% gdbarch_tdep (gdbarch)->num_aregs]);
% tdep->num_aregs]);
}
}