aboutsummaryrefslogtreecommitdiff
path: root/gdb/ppc-linux-nat.c
diff options
context:
space:
mode:
authorMarkus Deuling <deuling@de.ibm.com>2007-11-16 04:53:46 +0000
committerMarkus Deuling <deuling@de.ibm.com>2007-11-16 04:53:46 +0000
commit40a6adc1f847a722db47fa6dc14e4664d59f07b6 (patch)
treee494603c6b9549a1fafe2ece0faa30c84676e093 /gdb/ppc-linux-nat.c
parent49f964133f28d88464f0f1febc4bb34487f72e83 (diff)
downloadgdb-40a6adc1f847a722db47fa6dc14e4664d59f07b6.zip
gdb-40a6adc1f847a722db47fa6dc14e4664d59f07b6.tar.gz
gdb-40a6adc1f847a722db47fa6dc14e4664d59f07b6.tar.bz2
2007-11-16 Markus Deuling <deuling@de.ibm.com>
* m32r-rom.c (m32r_supply_register): Use get_regcache_arch to get at the current architecture by regcache. * ppcnbsd-nat.c (ppcnbsd_supply_pcb): Likewise. * ppc-linux-nat.c (fetch_altivec_register, fetch_spe_register) (fetch_register, supply_vrregset, fetch_ppc_registers) (store_altivec_register, store_spe_register, store_register) (fill_vrregset, store_ppc_registers): Likewise. * ppcobsd-nat.c (ppcobsd_supply_pcb): Likewise. * win32-nat.c (do_win32_fetch_inferior_registers) (do_win32_store_inferior_registers): Likewise. * procfs.c (procfs_fetch_registers, procfs_store_registers): Likewise. * remote-m32r-sdi.c (m32r_fetch_registers) (m32r_store_registers): Likewise. * remote-sim.c (gdbsim_fetch_register, gdbsim_store_register): Likewise. * trad-frame.c (trad_frame_alloc_saved_regs): Replace current_gdbarch by gdbarch. * user-regs.c (user_reg_map_name_to_regnum): Likewise. * ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call) (do_ppc_sysv_return_value, ppc64_sysv_abi_push_dummy_call) (ppc64_sysv_abi_return_value): Likewise. * m32c-tdep.c (m32c_register_reggroup_p): Likewise. * m2-lang.c (build_m2_types): Likewise. * ppc-linux-tdep.c (ppc_linux_sigtramp_cache * ppcnbsd-tdep.c (ppcnbsd_sigtramp_cache_init): Likewise. * ppcobsd-tdep.c (ppcobsd_sigtramp_frame_cache): Likewise. * rs6000-tdep.c (ppc_dwarf2_frame_init_reg): Likewise. * m68hc11-tdep.c (m68hc11_frame_unwind_cache): Use get_frame_arch to get at the current architecture by frame_info. * gcore.c (derive_stack_segment): Likewise. * shnbsd-nat.c (GETREGS_SUPPLIES): Add gdbarch parameter. (shnbsd_fetch_inferior_registers, shnbsd_store_inferior_registers): Add gdbarch to GETREGS_SUPPLIES call.
Diffstat (limited to 'gdb/ppc-linux-nat.c')
-rw-r--r--gdb/ppc-linux-nat.c89
1 files changed, 48 insertions, 41 deletions
diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c
index 7735fc0..f1758c8 100644
--- a/gdb/ppc-linux-nat.c
+++ b/gdb/ppc-linux-nat.c
@@ -227,8 +227,9 @@ fetch_altivec_register (struct regcache *regcache, int tid, int regno)
int ret;
int offset = 0;
gdb_vrregset_t regs;
- struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
- int vrregsize = register_size (current_gdbarch, tdep->ppc_vr0_regnum);
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ int vrregsize = register_size (gdbarch, tdep->ppc_vr0_regnum);
ret = ptrace (PTRACE_GETVRREGS, tid, 0, &regs);
if (ret < 0)
@@ -246,7 +247,7 @@ fetch_altivec_register (struct regcache *regcache, int tid, int regno)
vector. VRSAVE is at the end of the array in a 4 bytes slot, so
there is no need to define an offset for it. */
if (regno == (tdep->ppc_vrsave_regnum - 1))
- offset = vrregsize - register_size (current_gdbarch, tdep->ppc_vrsave_regnum);
+ offset = vrregsize - register_size (gdbarch, tdep->ppc_vrsave_regnum);
regcache_raw_supply (regcache, regno,
regs + (regno - tdep->ppc_vr0_regnum) * vrregsize + offset);
@@ -289,15 +290,16 @@ get_spe_registers (int tid, struct gdb_evrregset_t *evrregset)
static void
fetch_spe_register (struct regcache *regcache, int tid, int regno)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
struct gdb_evrregset_t evrregs;
gdb_assert (sizeof (evrregs.evr[0])
- == register_size (current_gdbarch, tdep->ppc_ev0_upper_regnum));
+ == register_size (gdbarch, tdep->ppc_ev0_upper_regnum));
gdb_assert (sizeof (evrregs.acc)
- == register_size (current_gdbarch, tdep->ppc_acc_regnum));
+ == register_size (gdbarch, tdep->ppc_acc_regnum));
gdb_assert (sizeof (evrregs.spefscr)
- == register_size (current_gdbarch, tdep->ppc_spefscr_regnum));
+ == register_size (gdbarch, tdep->ppc_spefscr_regnum));
get_spe_registers (tid, &evrregs);
@@ -327,7 +329,8 @@ fetch_spe_register (struct regcache *regcache, int tid, int regno)
static void
fetch_register (struct regcache *regcache, int tid, int regno)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
/* This isn't really an address. But ptrace thinks of it as one. */
CORE_ADDR regaddr = ppc_register_u_addr (regno);
int bytes_transferred;
@@ -357,7 +360,7 @@ fetch_register (struct regcache *regcache, int tid, int regno)
if (regaddr == -1)
{
- memset (buf, '\0', register_size (current_gdbarch, regno)); /* Supply zeroes */
+ memset (buf, '\0', register_size (gdbarch, regno)); /* Supply zeroes */
regcache_raw_supply (regcache, regno, buf);
return;
}
@@ -366,7 +369,7 @@ fetch_register (struct regcache *regcache, int tid, int regno)
32-bit platform, 64-bit floating-point registers will require two
transfers. */
for (bytes_transferred = 0;
- bytes_transferred < register_size (current_gdbarch, regno);
+ bytes_transferred < register_size (gdbarch, regno);
bytes_transferred += sizeof (long))
{
errno = 0;
@@ -377,7 +380,7 @@ fetch_register (struct regcache *regcache, int tid, int regno)
{
char message[128];
sprintf (message, "reading register %s (#%d)",
- gdbarch_register_name (current_gdbarch, regno), regno);
+ gdbarch_register_name (gdbarch, regno), regno);
perror_with_name (message);
}
}
@@ -385,34 +388,34 @@ fetch_register (struct regcache *regcache, int tid, int regno)
/* Now supply the register. Keep in mind that the regcache's idea
of the register's size may not be a multiple of sizeof
(long). */
- if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_LITTLE)
+ if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_LITTLE)
{
/* Little-endian values are always found at the left end of the
bytes transferred. */
regcache_raw_supply (regcache, regno, buf);
}
- else if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG)
+ else if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
{
/* Big-endian values are found at the right end of the bytes
transferred. */
- size_t padding = (bytes_transferred
- - register_size (current_gdbarch, regno));
+ size_t padding = (bytes_transferred - register_size (gdbarch, regno));
regcache_raw_supply (regcache, regno, buf + padding);
}
else
internal_error (__FILE__, __LINE__,
_("fetch_register: unexpected byte order: %d"),
- gdbarch_byte_order (current_gdbarch));
+ gdbarch_byte_order (gdbarch));
}
static void
supply_vrregset (struct regcache *regcache, gdb_vrregset_t *vrregsetp)
{
int i;
- struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
int num_of_vrregs = tdep->ppc_vrsave_regnum - tdep->ppc_vr0_regnum + 1;
- int vrregsize = register_size (current_gdbarch, tdep->ppc_vr0_regnum);
- int offset = vrregsize - register_size (current_gdbarch, tdep->ppc_vrsave_regnum);
+ int vrregsize = register_size (gdbarch, tdep->ppc_vr0_regnum);
+ int offset = vrregsize - register_size (gdbarch, tdep->ppc_vrsave_regnum);
for (i = 0; i < num_of_vrregs; i++)
{
@@ -452,14 +455,15 @@ static void
fetch_ppc_registers (struct regcache *regcache, int tid)
{
int i;
- struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
for (i = 0; i < ppc_num_gprs; i++)
fetch_register (regcache, tid, tdep->ppc_gp0_regnum + i);
if (tdep->ppc_fp0_regnum >= 0)
for (i = 0; i < ppc_num_fprs; i++)
fetch_register (regcache, tid, tdep->ppc_fp0_regnum + i);
- fetch_register (regcache, tid, gdbarch_pc_regnum (current_gdbarch));
+ fetch_register (regcache, tid, gdbarch_pc_regnum (gdbarch));
if (tdep->ppc_ps_regnum != -1)
fetch_register (regcache, tid, tdep->ppc_ps_regnum);
if (tdep->ppc_cr_regnum != -1)
@@ -507,8 +511,9 @@ store_altivec_register (const struct regcache *regcache, int tid, int regno)
int ret;
int offset = 0;
gdb_vrregset_t regs;
- struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
- int vrregsize = register_size (current_gdbarch, tdep->ppc_vr0_regnum);
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ int vrregsize = register_size (gdbarch, tdep->ppc_vr0_regnum);
ret = ptrace (PTRACE_GETVRREGS, tid, 0, &regs);
if (ret < 0)
@@ -524,7 +529,7 @@ store_altivec_register (const struct regcache *regcache, int tid, int regno)
/* VSCR is fetched as a 16 bytes quantity, but it is really 4 bytes
long on the hardware. */
if (regno == (tdep->ppc_vrsave_regnum - 1))
- offset = vrregsize - register_size (current_gdbarch, tdep->ppc_vrsave_regnum);
+ offset = vrregsize - register_size (gdbarch, tdep->ppc_vrsave_regnum);
regcache_raw_collect (regcache, regno,
regs + (regno - tdep->ppc_vr0_regnum) * vrregsize + offset);
@@ -569,15 +574,16 @@ set_spe_registers (int tid, struct gdb_evrregset_t *evrregset)
static void
store_spe_register (const struct regcache *regcache, int tid, int regno)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
struct gdb_evrregset_t evrregs;
gdb_assert (sizeof (evrregs.evr[0])
- == register_size (current_gdbarch, tdep->ppc_ev0_upper_regnum));
+ == register_size (gdbarch, tdep->ppc_ev0_upper_regnum));
gdb_assert (sizeof (evrregs.acc)
- == register_size (current_gdbarch, tdep->ppc_acc_regnum));
+ == register_size (gdbarch, tdep->ppc_acc_regnum));
gdb_assert (sizeof (evrregs.spefscr)
- == register_size (current_gdbarch, tdep->ppc_spefscr_regnum));
+ == register_size (gdbarch, tdep->ppc_spefscr_regnum));
if (regno == -1)
/* Since we're going to write out every register, the code below
@@ -623,7 +629,8 @@ store_spe_register (const struct regcache *regcache, int tid, int regno)
static void
store_register (const struct regcache *regcache, int tid, int regno)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
/* This isn't really an address. But ptrace thinks of it as one. */
CORE_ADDR regaddr = ppc_register_u_addr (regno);
int i;
@@ -648,18 +655,16 @@ store_register (const struct regcache *regcache, int tid, int regno)
idea of the register's size may not be a multiple of sizeof
(long). */
memset (buf, 0, sizeof buf);
- bytes_to_transfer = align_up (register_size (current_gdbarch, regno),
- sizeof (long));
- if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_LITTLE)
+ bytes_to_transfer = align_up (register_size (gdbarch, regno), sizeof (long));
+ if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_LITTLE)
{
/* Little-endian values always sit at the left end of the buffer. */
regcache_raw_collect (regcache, regno, buf);
}
- else if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG)
+ else if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
{
/* Big-endian values sit at the right end of the buffer. */
- size_t padding = (bytes_to_transfer
- - register_size (current_gdbarch, regno));
+ size_t padding = (bytes_to_transfer - register_size (gdbarch, regno));
regcache_raw_collect (regcache, regno, buf + padding);
}
@@ -681,7 +686,7 @@ store_register (const struct regcache *regcache, int tid, int regno)
{
char message[128];
sprintf (message, "writing register %s (#%d)",
- gdbarch_register_name (current_gdbarch, regno), regno);
+ gdbarch_register_name (gdbarch, regno), regno);
perror_with_name (message);
}
}
@@ -691,10 +696,11 @@ static void
fill_vrregset (const struct regcache *regcache, gdb_vrregset_t *vrregsetp)
{
int i;
- struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
int num_of_vrregs = tdep->ppc_vrsave_regnum - tdep->ppc_vr0_regnum + 1;
- int vrregsize = register_size (current_gdbarch, tdep->ppc_vr0_regnum);
- int offset = vrregsize - register_size (current_gdbarch, tdep->ppc_vrsave_regnum);
+ int vrregsize = register_size (gdbarch, tdep->ppc_vr0_regnum);
+ int offset = vrregsize - register_size (gdbarch, tdep->ppc_vrsave_regnum);
for (i = 0; i < num_of_vrregs; i++)
{
@@ -736,14 +742,15 @@ static void
store_ppc_registers (const struct regcache *regcache, int tid)
{
int i;
- struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
for (i = 0; i < ppc_num_gprs; i++)
store_register (regcache, tid, tdep->ppc_gp0_regnum + i);
if (tdep->ppc_fp0_regnum >= 0)
for (i = 0; i < ppc_num_fprs; i++)
store_register (regcache, tid, tdep->ppc_fp0_regnum + i);
- store_register (regcache, tid, gdbarch_pc_regnum (current_gdbarch));
+ store_register (regcache, tid, gdbarch_pc_regnum (gdbarch));
if (tdep->ppc_ps_regnum != -1)
store_register (regcache, tid, tdep->ppc_ps_regnum);
if (tdep->ppc_cr_regnum != -1)