aboutsummaryrefslogtreecommitdiff
path: root/gdb/rs6000-nat.c
diff options
context:
space:
mode:
authorUlrich Weigand <uweigand@de.ibm.com>2007-10-10 17:06:30 +0000
committerUlrich Weigand <uweigand@de.ibm.com>2007-10-10 17:06:30 +0000
commit8b164abbfd6b72bdcd87516fe1db4bc56be354cf (patch)
treecff5eeb3d4b39c00a217c86ea6af195d2c5b21ab /gdb/rs6000-nat.c
parente6d4f032a508328be58d14fb08b323531c543c0f (diff)
downloadgdb-8b164abbfd6b72bdcd87516fe1db4bc56be354cf.zip
gdb-8b164abbfd6b72bdcd87516fe1db4bc56be354cf.tar.gz
gdb-8b164abbfd6b72bdcd87516fe1db4bc56be354cf.tar.bz2
2007-10-10 Markus Deuling <deuling@de.ibm.com>
* rs6000-nat.c (fetch_register, store_register) (rs6000_fetch_inferior_registers, rs6000_store_inferior_registers): Use get_regcache_arch to get at the current architecture by regcache. * rs6000-tdep.c (rs6000_push_dummy_call, rs6000_return_value) (rs6000_register_reggroup_p, e500_move_ev_registe, rs6000_unwind_pc) (rs6000_unwind_dummy_id, rs6000_frame_cache, rs6000_dump_tdep): Replace current_gdbarch by gdbarch. (rs6000_skip_trampoline_code, rs6000_register_to_value) (rs6000_value_to_register): Use get_frame_arch to get at the current architecture by frame_info.
Diffstat (limited to 'gdb/rs6000-nat.c')
-rw-r--r--gdb/rs6000-nat.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/gdb/rs6000-nat.c b/gdb/rs6000-nat.c
index 3d51b3b..8361e90 100644
--- a/gdb/rs6000-nat.c
+++ b/gdb/rs6000-nat.c
@@ -211,6 +211,7 @@ rs6000_ptrace64 (int req, int id, long long addr, int data, void *buf)
static void
fetch_register (struct regcache *regcache, int regno)
{
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
int addr[MAX_REGISTER_SIZE];
int nr, isfloat;
@@ -226,7 +227,7 @@ fetch_register (struct regcache *regcache, int regno)
/* Bogus register number. */
else if (nr < 0)
{
- if (regno >= gdbarch_num_regs (current_gdbarch))
+ if (regno >= gdbarch_num_regs (gdbarch))
fprintf_unfiltered (gdb_stderr,
"gdb error: register no %d not implemented.\n",
regno);
@@ -244,7 +245,7 @@ fetch_register (struct regcache *regcache, int regno)
even if the register is really only 32 bits. */
long long buf;
rs6000_ptrace64 (PT_READ_GPR, PIDGET (inferior_ptid), nr, 0, &buf);
- if (register_size (current_gdbarch, regno) == 8)
+ if (register_size (gdbarch, regno) == 8)
memcpy (addr, &buf, 8);
else
*addr = buf;
@@ -268,6 +269,7 @@ fetch_register (struct regcache *regcache, int regno)
static void
store_register (const struct regcache *regcache, int regno)
{
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
int addr[MAX_REGISTER_SIZE];
int nr, isfloat;
@@ -286,7 +288,7 @@ store_register (const struct regcache *regcache, int regno)
/* Bogus register number. */
else if (nr < 0)
{
- if (regno >= gdbarch_num_regs (current_gdbarch))
+ if (regno >= gdbarch_num_regs (gdbarch))
fprintf_unfiltered (gdb_stderr,
"gdb error: register no %d not implemented.\n",
regno);
@@ -295,7 +297,7 @@ store_register (const struct regcache *regcache, int regno)
/* Fixed-point registers. */
else
{
- if (regno == gdbarch_sp_regnum (current_gdbarch))
+ if (regno == gdbarch_sp_regnum (gdbarch))
/* Execute one dummy instruction (which is a breakpoint) in inferior
process to give kernel a chance to do internal housekeeping.
Otherwise the following ptrace(2) calls will mess up user stack
@@ -313,7 +315,7 @@ store_register (const struct regcache *regcache, int regno)
/* PT_WRITE_GPR requires the buffer parameter to point to an 8-byte
area, even if the register is really only 32 bits. */
long long buf;
- if (register_size (current_gdbarch, regno) == 8)
+ if (register_size (gdbarch, regno) == 8)
memcpy (&buf, addr, 8);
else
buf = *addr;
@@ -334,12 +336,13 @@ store_register (const struct regcache *regcache, int regno)
static void
rs6000_fetch_inferior_registers (struct regcache *regcache, int regno)
{
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
if (regno != -1)
fetch_register (regcache, regno);
else
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
/* Read 32 general purpose registers. */
for (regno = tdep->ppc_gp0_regnum;
@@ -355,7 +358,7 @@ rs6000_fetch_inferior_registers (struct regcache *regcache, int regno)
fetch_register (regcache, tdep->ppc_fp0_regnum + regno);
/* Read special registers. */
- fetch_register (regcache, gdbarch_pc_regnum (current_gdbarch));
+ fetch_register (regcache, gdbarch_pc_regnum (gdbarch));
fetch_register (regcache, tdep->ppc_ps_regnum);
fetch_register (regcache, tdep->ppc_cr_regnum);
fetch_register (regcache, tdep->ppc_lr_regnum);
@@ -375,12 +378,13 @@ rs6000_fetch_inferior_registers (struct regcache *regcache, int regno)
static void
rs6000_store_inferior_registers (struct regcache *regcache, int regno)
{
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
if (regno != -1)
store_register (regcache, regno);
else
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
/* Write general purpose registers first. */
for (regno = tdep->ppc_gp0_regnum;
@@ -396,7 +400,7 @@ rs6000_store_inferior_registers (struct regcache *regcache, int regno)
store_register (regcache, tdep->ppc_fp0_regnum + regno);
/* Write special registers. */
- store_register (regcache, gdbarch_pc_regnum (current_gdbarch));
+ store_register (regcache, gdbarch_pc_regnum (gdbarch));
store_register (regcache, tdep->ppc_ps_regnum);
store_register (regcache, tdep->ppc_cr_regnum);
store_register (regcache, tdep->ppc_lr_regnum);