From 063715bf637d9552de6b4d991823cc9854a76d0e Mon Sep 17 00:00:00 2001 From: Jim Blandy Date: Thu, 13 May 2004 19:36:05 +0000 Subject: [PATCH] * aix-thread.c (pdc_read_regs, supply_gprs64, supply_fprs) (fetch_regs_user_thread, fetch_regs_kernel_thread) (store_regs_user_thread, store_regs_kernel_thread): Use ppc_num_gprs and ppc_num_fprs instead of '32' and '31'. * ppc-linux-nat.c (fill_gregset): Same. * ppc-linux-tdep.c (ppc_linux_supply_gregset) (ppc_linux_sigtramp_cache): Same. * ppcnbsd-tdep.c (ppcnbsd_supply_reg, ppcnbsd_fill_reg) (ppcnbsd_sigtramp_cache_init): Same. * rs6000-nat.c (fetch_core_registers): Same. * rs6000-tdep.c (ppc_supply_gregset, ppc_collect_gregset) (rs6000_frame_cache): Same. --- gdb/ChangeLog | 13 +++++++++++++ gdb/aix-thread.c | 28 ++++++++++++++-------------- gdb/ppc-linux-nat.c | 2 +- gdb/ppc-linux-tdep.c | 4 ++-- gdb/ppcnbsd-tdep.c | 6 +++--- gdb/rs6000-nat.c | 8 ++++---- gdb/rs6000-tdep.c | 10 +++++----- 7 files changed, 42 insertions(+), 29 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index ad96413124d..de2b029525e 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -6,6 +6,19 @@ 2004-05-13 Jim Blandy + * aix-thread.c (pdc_read_regs, supply_gprs64, supply_fprs) + (fetch_regs_user_thread, fetch_regs_kernel_thread) + (store_regs_user_thread, store_regs_kernel_thread): Use + ppc_num_gprs and ppc_num_fprs instead of '32' and '31'. + * ppc-linux-nat.c (fill_gregset): Same. + * ppc-linux-tdep.c (ppc_linux_supply_gregset) + (ppc_linux_sigtramp_cache): Same. + * ppcnbsd-tdep.c (ppcnbsd_supply_reg, ppcnbsd_fill_reg) + (ppcnbsd_sigtramp_cache_init): Same. + * rs6000-nat.c (fetch_core_registers): Same. + * rs6000-tdep.c (ppc_supply_gregset, ppc_collect_gregset) + (rs6000_frame_cache): Same. + * 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. diff --git a/gdb/aix-thread.c b/gdb/aix-thread.c index 0f83edf5482..d95f7e39b12 100644 --- a/gdb/aix-thread.c +++ b/gdb/aix-thread.c @@ -338,9 +338,9 @@ pdc_read_regs (pthdb_user_t user, this is needed, I have implemented what I think it should do, however this code is untested. */ - uint64_t gprs64[32]; - uint32_t gprs32[32]; - double fprs[32]; + uint64_t gprs64[ppc_num_gprs]; + uint32_t gprs32[ppc_num_gprs]; + double fprs[ppc_num_fprs]; struct ptxsprs sprs64; struct ptsprs sprs32; @@ -1004,7 +1004,7 @@ supply_gprs64 (uint64_t *vals) struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); int regno; - for (regno = 0; regno < 32; regno++) + for (regno = 0; regno < ppc_num_gprs; regno++) supply_register (tdep->ppc_gp0_regnum + regno, (char *) (vals + regno)); } @@ -1028,7 +1028,7 @@ supply_fprs (double *vals) floating-point registers. */ gdb_assert (ppc_floating_point_p (current_gdbarch)); - for (regno = 0; regno < 32; regno++) + for (regno = 0; regno < ppc_num_fprs; regno++) supply_register (regno + tdep->ppc_fp0_regnum, (char *) (vals + regno)); } @@ -1116,7 +1116,7 @@ fetch_regs_user_thread (pthdb_pthread_t pdtid) if (arch64) supply_gprs64 (ctx.gpr); else - for (i = 0; i < 32; i++) + for (i = 0; i < ppc_num_gprs; i++) supply_reg32 (tdep->ppc_gp0_regnum + i, ctx.gpr[i]); /* Floating-point registers. */ @@ -1153,9 +1153,9 @@ static void fetch_regs_kernel_thread (int regno, pthdb_tid_t tid) { struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); - uint64_t gprs64[32]; - uint32_t gprs32[32]; - double fprs[32]; + uint64_t gprs64[ppc_num_gprs]; + uint32_t gprs32[ppc_num_gprs]; + double fprs[ppc_num_fprs]; struct ptxsprs sprs64; struct ptsprs sprs32; int i; @@ -1181,7 +1181,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++) + for (i = 0; i < ppc_num_gprs; i++) supply_reg32 (tdep->ppc_gp0_regnum + i, gprs32[i]); } } @@ -1391,7 +1391,7 @@ store_regs_user_thread (pthdb_pthread_t pdtid) /* Collect general-purpose register values from the regcache. */ - for (i = 0; i < 32; i++) + for (i = 0; i < ppc_num_gprs; i++) if (register_cached (tdep->ppc_gp0_regnum + i)) { if (arch64) @@ -1461,9 +1461,9 @@ static void store_regs_kernel_thread (int regno, pthdb_tid_t tid) { struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); - uint64_t gprs64[32]; - uint32_t gprs32[32]; - double fprs[32]; + uint64_t gprs64[ppc_num_gprs]; + uint32_t gprs32[ppc_num_gprs]; + double fprs[ppc_num_fprs]; struct ptxsprs sprs64; struct ptsprs sprs32; int i; diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c index 72912f2e4bb..efd686544d1 100644 --- a/gdb/ppc-linux-nat.c +++ b/gdb/ppc-linux-nat.c @@ -590,7 +590,7 @@ fill_gregset (gdb_gregset_t *gregsetp, int regno) /* Start with zeros. */ memset (regp, 0, elf_ngreg * sizeof (*regp)); - for (regi = 0; regi < 32; regi++) + for (regi = 0; regi < ppc_num_gprs; regi++) { if ((regno == -1) || regno == tdep->ppc_gp0_regnum + regi) right_fill_reg (tdep->ppc_gp0_regnum + regi, (regp + PT_R0 + regi)); diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c index a6e75644028..a7e58bcb5d7 100644 --- a/gdb/ppc-linux-tdep.c +++ b/gdb/ppc-linux-tdep.c @@ -860,7 +860,7 @@ ppc_linux_supply_gregset (struct regcache *regcache, struct gdbarch_tdep *regcache_tdep = gdbarch_tdep (regcache_arch); const bfd_byte *buf = gregs; - for (regi = 0; regi < 32; regi++) + for (regi = 0; regi < ppc_num_gprs; regi++) right_supply_register (regcache, wordsize, regcache_tdep->ppc_gp0_regnum + regi, buf + wordsize * regi); @@ -934,7 +934,7 @@ ppc_linux_sigtramp_cache (struct frame_info *next_frame, void **this_cache) fpregs = gpregs + 48 * tdep->wordsize; /* General purpose. */ - for (i = 0; i < 32; i++) + for (i = 0; i < ppc_num_gprs; i++) { int regnum = i + tdep->ppc_gp0_regnum; cache->saved_regs[regnum].addr = gpregs + i * tdep->wordsize; diff --git a/gdb/ppcnbsd-tdep.c b/gdb/ppcnbsd-tdep.c index a00d24abe0d..317cd85afb1 100644 --- a/gdb/ppcnbsd-tdep.c +++ b/gdb/ppcnbsd-tdep.c @@ -55,7 +55,7 @@ ppcnbsd_supply_reg (char *regs, int regno) struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); int i; - for (i = 0; i <= 31; i++) + for (i = 0; i < ppc_num_gprs; i++) { if (regno == tdep->ppc_gp0_regnum + i || regno == -1) supply_register (tdep->ppc_gp0_regnum + i, @@ -84,7 +84,7 @@ ppcnbsd_fill_reg (char *regs, int regno) struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); int i; - for (i = 0; i <= 31; i++) + for (i = 0; i < ppc_num_gprs; i++) { if (regno == tdep->ppc_gp0_regnum + i || regno == -1) regcache_collect (tdep->ppc_gp0_regnum + i, @@ -266,7 +266,7 @@ ppcnbsd_sigtramp_cache_init (const struct tramp_frame *self, base = frame_unwind_register_unsigned (next_frame, SP_REGNUM); offset = base + 0x18 + 2 * tdep->wordsize; - for (i = 0; i < 32; i++) + for (i = 0; i < ppc_num_gprs; i++) { int regnum = i + tdep->ppc_gp0_regnum; trad_frame_set_reg_addr (this_cache, regnum, offset); diff --git a/gdb/rs6000-nat.c b/gdb/rs6000-nat.c index 8e24bed0b06..bf08b946d09 100644 --- a/gdb/rs6000-nat.c +++ b/gdb/rs6000-nat.c @@ -586,12 +586,12 @@ fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, if (ARCH64 ()) { - for (regi = 0; regi < 32; regi++) + for (regi = 0; regi < ppc_num_gprs; regi++) supply_register (tdep->ppc_gp0_regnum + regi, (char *) ®s->r64.gpr[regi]); if (tdep->ppc_fp0_regnum >= 0) - for (regi = 0; regi < 32; regi++) + for (regi = 0; regi < ppc_num_fprs; regi++) supply_register (tdep->ppc_fp0_regnum + regi, (char *) ®s->r64.fpr[regi]); @@ -606,12 +606,12 @@ fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, } else { - for (regi = 0; regi < 32; regi++) + for (regi = 0; regi < ppc_num_gprs; regi++) supply_register (tdep->ppc_gp0_regnum + regi, (char *) ®s->r32.gpr[regi]); if (tdep->ppc_fp0_regnum >= 0) - for (regi = 0; regi < 32; regi++) + for (regi = 0; regi < ppc_num_fprs; regi++) supply_register (tdep->ppc_fp0_regnum + regi, (char *) ®s->r32.fpr[regi]); diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index 4f2190b77f3..d9807d333f7 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -186,7 +186,7 @@ ppc_supply_gregset (const struct regset *regset, struct regcache *regcache, int i; for (i = tdep->ppc_gp0_regnum, offset = offsets->r0_offset; - i < tdep->ppc_gp0_regnum + 32; + i < tdep->ppc_gp0_regnum + ppc_num_gprs; i++, offset += 4) { if (regnum == -1 || regnum == i) @@ -262,7 +262,7 @@ ppc_collect_gregset (const struct regset *regset, offset = offsets->r0_offset; for (i = tdep->ppc_gp0_regnum; - i < tdep->ppc_gp0_regnum + 32; + i < tdep->ppc_gp0_regnum + ppc_num_gprs; i++, offset += 4) { if (regnum == -1 || regnum == i) @@ -2477,7 +2477,7 @@ rs6000_frame_cache (struct frame_info *next_frame, void **this_cache) then that's strange. But we have no indices to even record the addresses under, so we just ignore it. */ if (ppc_floating_point_unit_p (gdbarch)) - for (i = fdata.saved_fpr; i < 32; i++) + for (i = fdata.saved_fpr; i < ppc_num_fprs; i++) { cache->saved_regs[tdep->ppc_fp0_regnum + i].addr = fpr_addr; fpr_addr += 8; @@ -2491,7 +2491,7 @@ rs6000_frame_cache (struct frame_info *next_frame, void **this_cache) { int i; CORE_ADDR gpr_addr = cache->base + fdata.gpr_offset; - for (i = fdata.saved_gpr; i < 32; i++) + for (i = fdata.saved_gpr; i < ppc_num_gprs; i++) { cache->saved_regs[tdep->ppc_gp0_regnum + i].addr = gpr_addr; gpr_addr += wordsize; @@ -2522,7 +2522,7 @@ rs6000_frame_cache (struct frame_info *next_frame, void **this_cache) { int i; CORE_ADDR ev_addr = cache->base + fdata.ev_offset; - for (i = fdata.saved_ev; i < 32; i++) + for (i = fdata.saved_ev; i < ppc_num_gprs; i++) { cache->saved_regs[tdep->ppc_ev0_regnum + i].addr = ev_addr; cache->saved_regs[tdep->ppc_gp0_regnum + i].addr = ev_addr + 4; -- 2.30.2