summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Blandy <jimb@codesourcery.com>2003-05-28 20:14:13 +0000
committerJim Blandy <jimb@codesourcery.com>2003-05-28 20:14:13 +0000
commitd8c7d0735e3dc12a032935c76b248bd0407b9b23 (patch)
tree9e477ef7e03dd247701aa9fce5eaf3ef09273f4b
parentac0342b0b3dc188baa6906b4f289e846c8311bac (diff)
downloadgdb-d8c7d0735e3dc12a032935c76b248bd0407b9b23.tar.gz
* ppc-linux-nat.c (ppc_register_u_addr): Compute u-area offsets
using the tdep's wordsize, not just '4'.
-rw-r--r--gdb/ChangeLog3
-rw-r--r--gdb/ppc-linux-nat.c19
2 files changed, 13 insertions, 9 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index a1a712c3ead..2580a1670de 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,8 @@
2003-05-28 Jim Blandy <jimb@redhat.com>
+ * ppc-linux-nat.c (ppc_register_u_addr): Compute u-area offsets
+ using the tdep's wordsize, not just '4'.
+
* config/powerpc/nm-ppc64-linux.h (PTRACE_XFER_TYPE): This is
'long' on ppc64-*-linux*.
diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c
index 97febe042ee..f69c14011b3 100644
--- a/gdb/ppc-linux-nat.c
+++ b/gdb/ppc-linux-nat.c
@@ -127,10 +127,11 @@ ppc_register_u_addr (int regno)
{
int u_addr = -1;
struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+ int wordsize = tdep->wordsize;
/* General purpose registers occupy 1 slot each in the buffer */
if (regno >= tdep->ppc_gp0_regnum && regno <= tdep->ppc_gplast_regnum )
- u_addr = ((PT_R0 + regno) * 4);
+ u_addr = ((PT_R0 + regno) * wordsize);
/* Floating point regs: 2 slots each */
if (regno >= FP0_REGNUM && regno <= FPLAST_REGNUM)
@@ -138,23 +139,23 @@ ppc_register_u_addr (int regno)
/* UISA special purpose registers: 1 slot each */
if (regno == PC_REGNUM)
- u_addr = PT_NIP * 4;
+ u_addr = PT_NIP * wordsize;
if (regno == tdep->ppc_lr_regnum)
- u_addr = PT_LNK * 4;
+ u_addr = PT_LNK * wordsize;
if (regno == tdep->ppc_cr_regnum)
- u_addr = PT_CCR * 4;
+ u_addr = PT_CCR * wordsize;
if (regno == tdep->ppc_xer_regnum)
- u_addr = PT_XER * 4;
+ u_addr = PT_XER * wordsize;
if (regno == tdep->ppc_ctr_regnum)
- u_addr = PT_CTR * 4;
+ u_addr = PT_CTR * wordsize;
#ifdef PT_MQ
if (regno == tdep->ppc_mq_regnum)
- u_addr = PT_MQ * 4;
+ u_addr = PT_MQ * wordsize;
#endif
if (regno == tdep->ppc_ps_regnum)
- u_addr = PT_MSR * 4;
+ u_addr = PT_MSR * wordsize;
if (regno == tdep->ppc_fpscr_regnum)
- u_addr = PT_FPSCR * 4;
+ u_addr = PT_FPSCR * wordsize;
return u_addr;
}