aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorJim Blandy <jimb@codesourcery.com>2004-05-13 19:27:07 +0000
committerJim Blandy <jimb@codesourcery.com>2004-05-13 19:27:07 +0000
commitcdf2c5f516c73172ae0bfe06fed25cb8cb4ea215 (patch)
treed5b11731441df820446adbb27ced03ebabe26f97 /gdb
parent450bd37bb070a60ffefeb87f7c7de68dd0968396 (diff)
downloadgdb-cdf2c5f516c73172ae0bfe06fed25cb8cb4ea215.zip
gdb-cdf2c5f516c73172ae0bfe06fed25cb8cb4ea215.tar.gz
gdb-cdf2c5f516c73172ae0bfe06fed25cb8cb4ea215.tar.bz2
* aix-thread.c (supply_gprs64, fetch_regs_user_thread)
(store_regs_user_thread): Use tdep->ppc_gp0_regnum, instead of assuming that the gprs are numbered starting with zero. * ppc-linux-nat.c (fill_gregset): Same. * ppc-linux-tdep.c (ppc_linux_supply_gregset): Same. * ppcnbsd-nat.c (getregs_supplies): Same. * ppcnbsd-tdep.c (ppcnbsd_supply_reg, ppcnbsd_fill_reg): Same. * rs6000-nat.c (fetch_core_registers): Same. * rs6000-tdep.c (ppc_supply_gregset, ppc_collect_gregset): Same.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog12
-rw-r--r--gdb/aix-thread.c16
-rw-r--r--gdb/ppc-linux-nat.c4
-rw-r--r--gdb/ppc-linux-tdep.c4
-rw-r--r--gdb/ppcnbsd-nat.c3
-rw-r--r--gdb/ppcnbsd-tdep.c10
-rw-r--r--gdb/rs6000-nat.c6
-rw-r--r--gdb/rs6000-tdep.c8
8 files changed, 44 insertions, 19 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 5f39f2f..151f4f3 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,15 @@
+2004-05-13 Jim Blandy <jimb@redhat.com>
+
+ * aix-thread.c (supply_gprs64, fetch_regs_user_thread)
+ (store_regs_user_thread): Use tdep->ppc_gp0_regnum, instead
+ of assuming that the gprs are numbered starting with zero.
+ * ppc-linux-nat.c (fill_gregset): Same.
+ * ppc-linux-tdep.c (ppc_linux_supply_gregset): Same.
+ * ppcnbsd-nat.c (getregs_supplies): Same.
+ * ppcnbsd-tdep.c (ppcnbsd_supply_reg, ppcnbsd_fill_reg): Same.
+ * rs6000-nat.c (fetch_core_registers): Same.
+ * rs6000-tdep.c (ppc_supply_gregset, ppc_collect_gregset): Same.
+
2004-05-07 Michael Snyder <msnyder@redhat.com>
* tracepoint.c (scope_info): Add handling for LOC_COMPUTED,
diff --git a/gdb/aix-thread.c b/gdb/aix-thread.c
index dcaa3fb..0f83edf 100644
--- a/gdb/aix-thread.c
+++ b/gdb/aix-thread.c
@@ -1001,10 +1001,11 @@ aix_thread_wait (ptid_t ptid, struct target_waitstatus *status)
static void
supply_gprs64 (uint64_t *vals)
{
+ struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
int regno;
for (regno = 0; regno < 32; regno++)
- supply_register (regno, (char *) (vals + regno));
+ supply_register (tdep->ppc_gp0_regnum + regno, (char *) (vals + regno));
}
/* Record that 32-bit register REGNO contains VAL. */
@@ -1098,6 +1099,7 @@ supply_sprs32 (uint32_t iar, uint32_t msr, uint32_t cr,
static void
fetch_regs_user_thread (pthdb_pthread_t pdtid)
{
+ struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
int status, i;
pthdb_context_t ctx;
@@ -1115,7 +1117,7 @@ fetch_regs_user_thread (pthdb_pthread_t pdtid)
supply_gprs64 (ctx.gpr);
else
for (i = 0; i < 32; i++)
- supply_reg32 (i, ctx.gpr[i]);
+ supply_reg32 (tdep->ppc_gp0_regnum + i, ctx.gpr[i]);
/* Floating-point registers. */
@@ -1180,7 +1182,7 @@ fetch_regs_kernel_thread (int regno, pthdb_tid_t tid)
if (!ptrace32 (PTT_READ_GPRS, tid, gprs32, 0, NULL))
memset (gprs32, 0, sizeof (gprs32));
for (i = 0; i < 32; i++)
- supply_reg32 (i, gprs32[i]);
+ supply_reg32 (tdep->ppc_gp0_regnum + i, gprs32[i]);
}
}
@@ -1369,6 +1371,7 @@ fill_sprs32 (unsigned long *iar, unsigned long *msr, unsigned long *cr,
static void
store_regs_user_thread (pthdb_pthread_t pdtid)
{
+ struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
int status, i;
pthdb_context_t ctx;
uint32_t int32;
@@ -1389,16 +1392,16 @@ store_regs_user_thread (pthdb_pthread_t pdtid)
/* Collect general-purpose register values from the regcache. */
for (i = 0; i < 32; i++)
- if (register_cached (i))
+ if (register_cached (tdep->ppc_gp0_regnum + i))
{
if (arch64)
{
- regcache_collect (i, (void *) &int64);
+ regcache_collect (tdep->ppc_gp0_regnum + i, (void *) &int64);
ctx.gpr[i] = int64;
}
else
{
- regcache_collect (i, (void *) &int32);
+ regcache_collect (tdep->ppc_gp0_regnum + i, (void *) &int32);
ctx.gpr[i] = int32;
}
}
@@ -1421,7 +1424,6 @@ store_regs_user_thread (pthdb_pthread_t pdtid)
happens, GDB needs to be reconfigured so that longs are 32-bits.) */
unsigned long tmp_iar, tmp_msr, tmp_cr, tmp_lr, tmp_ctr, tmp_xer,
tmp_fpscr;
- struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
fill_sprs32 (&tmp_iar, &tmp_msr, &tmp_cr, &tmp_lr, &tmp_ctr, &tmp_xer,
&tmp_fpscr);
diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c
index 460d48a..72912f2 100644
--- a/gdb/ppc-linux-nat.c
+++ b/gdb/ppc-linux-nat.c
@@ -592,8 +592,8 @@ fill_gregset (gdb_gregset_t *gregsetp, int regno)
for (regi = 0; regi < 32; regi++)
{
- if ((regno == -1) || regno == regi)
- right_fill_reg (regi, (regp + PT_R0 + regi));
+ if ((regno == -1) || regno == tdep->ppc_gp0_regnum + regi)
+ right_fill_reg (tdep->ppc_gp0_regnum + regi, (regp + PT_R0 + regi));
}
if ((regno == -1) || regno == PC_REGNUM)
diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c
index 49f4ad6..a6e7564 100644
--- a/gdb/ppc-linux-tdep.c
+++ b/gdb/ppc-linux-tdep.c
@@ -861,7 +861,9 @@ ppc_linux_supply_gregset (struct regcache *regcache,
const bfd_byte *buf = gregs;
for (regi = 0; regi < 32; regi++)
- right_supply_register (regcache, wordsize, regi, buf + wordsize * regi);
+ right_supply_register (regcache, wordsize,
+ regcache_tdep->ppc_gp0_regnum + regi,
+ buf + wordsize * regi);
right_supply_register (regcache, wordsize, gdbarch_pc_regnum (regcache_arch),
buf + wordsize * PPC_LINUX_PT_NIP);
diff --git a/gdb/ppcnbsd-nat.c b/gdb/ppcnbsd-nat.c
index 037b8d7..7b22b12 100644
--- a/gdb/ppcnbsd-nat.c
+++ b/gdb/ppcnbsd-nat.c
@@ -36,7 +36,8 @@ getregs_supplies (int regno)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
- return ((regno >= 0 && regno <= 31)
+ return ((regno >= tdep->ppc_gp0_regnum
+ && regno < tdep->ppc_gp0_regnum + ppc_num_gprs)
|| regno == tdep->ppc_lr_regnum
|| regno == tdep->ppc_cr_regnum
|| regno == tdep->ppc_xer_regnum
diff --git a/gdb/ppcnbsd-tdep.c b/gdb/ppcnbsd-tdep.c
index 0765292..a00d24a 100644
--- a/gdb/ppcnbsd-tdep.c
+++ b/gdb/ppcnbsd-tdep.c
@@ -57,8 +57,9 @@ ppcnbsd_supply_reg (char *regs, int regno)
for (i = 0; i <= 31; i++)
{
- if (regno == i || regno == -1)
- supply_register (i, regs + REG_FIXREG_OFFSET (i));
+ if (regno == tdep->ppc_gp0_regnum + i || regno == -1)
+ supply_register (tdep->ppc_gp0_regnum + i,
+ regs + REG_FIXREG_OFFSET (i));
}
if (regno == tdep->ppc_lr_regnum || regno == -1)
@@ -85,8 +86,9 @@ ppcnbsd_fill_reg (char *regs, int regno)
for (i = 0; i <= 31; i++)
{
- if (regno == i || regno == -1)
- regcache_collect (i, regs + REG_FIXREG_OFFSET (i));
+ if (regno == tdep->ppc_gp0_regnum + i || regno == -1)
+ regcache_collect (tdep->ppc_gp0_regnum + i,
+ regs + REG_FIXREG_OFFSET (i));
}
if (regno == tdep->ppc_lr_regnum || regno == -1)
diff --git a/gdb/rs6000-nat.c b/gdb/rs6000-nat.c
index 5fbf334..8e24bed 100644
--- a/gdb/rs6000-nat.c
+++ b/gdb/rs6000-nat.c
@@ -587,7 +587,8 @@ fetch_core_registers (char *core_reg_sect, unsigned core_reg_size,
if (ARCH64 ())
{
for (regi = 0; regi < 32; regi++)
- supply_register (regi, (char *) &regs->r64.gpr[regi]);
+ supply_register (tdep->ppc_gp0_regnum + regi,
+ (char *) &regs->r64.gpr[regi]);
if (tdep->ppc_fp0_regnum >= 0)
for (regi = 0; regi < 32; regi++)
@@ -606,7 +607,8 @@ fetch_core_registers (char *core_reg_sect, unsigned core_reg_size,
else
{
for (regi = 0; regi < 32; regi++)
- supply_register (regi, (char *) &regs->r32.gpr[regi]);
+ supply_register (tdep->ppc_gp0_regnum + regi,
+ (char *) &regs->r32.gpr[regi]);
if (tdep->ppc_fp0_regnum >= 0)
for (regi = 0; regi < 32; regi++)
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index 5879c2c..4f2190b 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -185,7 +185,9 @@ ppc_supply_gregset (const struct regset *regset, struct regcache *regcache,
size_t offset;
int i;
- for (i = 0, offset = offsets->r0_offset; i < 32; i++, offset += 4)
+ for (i = tdep->ppc_gp0_regnum, offset = offsets->r0_offset;
+ i < tdep->ppc_gp0_regnum + 32;
+ i++, offset += 4)
{
if (regnum == -1 || regnum == i)
ppc_supply_reg (regcache, i, gregs, offset);
@@ -259,7 +261,9 @@ ppc_collect_gregset (const struct regset *regset,
int i;
offset = offsets->r0_offset;
- for (i = 0; i < 32; i++, offset += 4)
+ for (i = tdep->ppc_gp0_regnum;
+ i < tdep->ppc_gp0_regnum + 32;
+ i++, offset += 4)
{
if (regnum == -1 || regnum == i)
ppc_collect_reg (regcache, i, gregs, offset);