aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Blandy <jimb@codesourcery.com>2004-05-19 04:18:42 +0000
committerJim Blandy <jimb@codesourcery.com>2004-05-19 04:18:42 +0000
commitbaffbae05ecad434555561f528065428612962bf (patch)
treeb97f344574d4223f440a1b427b638ee72797b0ed
parent5859efe54e9c24b55dcb713af8bb0b178cbf052c (diff)
downloadgdb-baffbae05ecad434555561f528065428612962bf.zip
gdb-baffbae05ecad434555561f528065428612962bf.tar.gz
gdb-baffbae05ecad434555561f528065428612962bf.tar.bz2
* rs6000-tdep.c (rs6000_gdbarch_init): Initialize tdep fields
before the mach-specific switch, and then let the individual cases override the defaults, rather than leaving them uninitialized until the switch and then setting them in each case.
-rw-r--r--gdb/ChangeLog7
-rw-r--r--gdb/rs6000-tdep.c46
2 files changed, 27 insertions, 26 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 1b7b4c8..ec65462 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,10 @@
+2004-05-18 Jim Blandy <jimb@redhat.com>
+
+ * rs6000-tdep.c (rs6000_gdbarch_init): Initialize tdep fields
+ before the mach-specific switch, and then let the individual cases
+ override the defaults, rather than leaving them uninitialized
+ until the switch and then setting them in each case.
+
2004-05-18 Randolph Chung <tausq@debian.org>
* hppa-tdep.c (hppa_frame_cache): Check for validity of r31 for
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index c87f379..b6695b5 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -2821,6 +2821,10 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
tdep->ppc_mq_regnum = -1;
tdep->ppc_fp0_regnum = 32;
tdep->ppc_fpscr_regnum = power ? 71 : 70;
+ tdep->ppc_vr0_regnum = -1;
+ tdep->ppc_vrsave_regnum = -1;
+ tdep->ppc_ev0_regnum = -1;
+ tdep->ppc_ev31_regnum = -1;
set_gdbarch_pc_regnum (gdbarch, 64);
set_gdbarch_sp_regnum (gdbarch, 1);
@@ -2835,20 +2839,32 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_deprecated_store_return_value (gdbarch, rs6000_store_return_value);
}
+ /* Set lr_frame_offset. */
+ if (wordsize == 8)
+ tdep->lr_frame_offset = 16;
+ else if (sysv_abi)
+ tdep->lr_frame_offset = 4;
+ else
+ tdep->lr_frame_offset = 8;
+
+ /* Calculate byte offsets in raw register array. */
+ tdep->regoff = xmalloc (v->num_tot_regs * sizeof (int));
+ for (i = off = 0; i < v->num_tot_regs; i++)
+ {
+ tdep->regoff[i] = off;
+ off += regsize (v->regs + i, wordsize);
+ }
+
if (v->arch == bfd_arch_powerpc)
switch (v->mach)
{
case bfd_mach_ppc:
tdep->ppc_vr0_regnum = 71;
tdep->ppc_vrsave_regnum = 104;
- tdep->ppc_ev0_regnum = -1;
- tdep->ppc_ev31_regnum = -1;
break;
case bfd_mach_ppc_7400:
tdep->ppc_vr0_regnum = 119;
tdep->ppc_vrsave_regnum = 152;
- tdep->ppc_ev0_regnum = -1;
- tdep->ppc_ev31_regnum = -1;
break;
case bfd_mach_ppc_e500:
tdep->ppc_gp0_regnum = 41;
@@ -2868,33 +2884,11 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_pseudo_register_read (gdbarch, e500_pseudo_register_read);
set_gdbarch_pseudo_register_write (gdbarch, e500_pseudo_register_write);
break;
- default:
- tdep->ppc_vr0_regnum = -1;
- tdep->ppc_vrsave_regnum = -1;
- tdep->ppc_ev0_regnum = -1;
- tdep->ppc_ev31_regnum = -1;
- break;
}
/* Sanity check on registers. */
gdb_assert (strcmp (tdep->regs[tdep->ppc_gp0_regnum].name, "r0") == 0);
- /* Set lr_frame_offset. */
- if (wordsize == 8)
- tdep->lr_frame_offset = 16;
- else if (sysv_abi)
- tdep->lr_frame_offset = 4;
- else
- tdep->lr_frame_offset = 8;
-
- /* Calculate byte offsets in raw register array. */
- tdep->regoff = xmalloc (v->num_tot_regs * sizeof (int));
- for (i = off = 0; i < v->num_tot_regs; i++)
- {
- tdep->regoff[i] = off;
- off += regsize (v->regs + i, wordsize);
- }
-
/* Select instruction printer. */
if (arch == power)
set_gdbarch_print_insn (gdbarch, print_insn_rs6000);