From fe29b929e291714007911e2bf0b57b433aecf0db Mon Sep 17 00:00:00 2001 From: Kevin Buettner Date: Fri, 13 Dec 2002 18:09:30 +0000 Subject: [PATCH] Multiarch NUM_REGS for MIPS. --- gdb/ChangeLog | 10 ++++++++++ gdb/config/mips/tm-irix3.h | 5 ----- gdb/config/mips/tm-irix6.h | 5 ----- gdb/config/mips/tm-mips.h | 6 ------ gdb/mips-tdep.c | 15 ++++++++++++++- 5 files changed, 24 insertions(+), 17 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 374231b9db5..18e69721bb7 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,13 @@ +2002-12-13 Kevin Buettner + + * config/mips/tm-mips.h, config/mips/tm-irix3.h, + config/mips/tm-irix6.h (NUM_REGS): Delete. + * mips-tdep.c (mips_gdbarch_init): Call set_gdbarch_num_regs(). + (temp_saved_regs): Declare as a pointer rather than an array. + (mips32_heuristic_proc_desc, heuristic_proc_desc): Make sure + that ``temp_saved_regs'' has storage allocated to it and that + it's the correct size. + 2002-12-13 Jeff Johnston * defs.h (init_last_source_visited): New prototype. diff --git a/gdb/config/mips/tm-irix3.h b/gdb/config/mips/tm-irix3.h index c298a391f80..8875f79b0ad 100644 --- a/gdb/config/mips/tm-irix3.h +++ b/gdb/config/mips/tm-irix3.h @@ -23,7 +23,6 @@ /* Redefine register numbers for SGI. */ -#undef NUM_REGS #undef MIPS_REGISTER_NAMES #undef FP0_REGNUM #undef PC_REGNUM @@ -34,10 +33,6 @@ #undef FCRCS_REGNUM #undef FCRIR_REGNUM -/* Number of machine registers */ - -#define NUM_REGS 71 - /* Initializer for an array of names of registers. There should be NUM_REGS strings in this initializer. */ diff --git a/gdb/config/mips/tm-irix6.h b/gdb/config/mips/tm-irix6.h index ce9c2261854..26813ba4fb9 100644 --- a/gdb/config/mips/tm-irix6.h +++ b/gdb/config/mips/tm-irix6.h @@ -24,7 +24,6 @@ /* Redefine register numbers for SGI. */ -#undef NUM_REGS #undef MIPS_REGISTER_NAMES #undef FP0_REGNUM #undef PC_REGNUM @@ -35,10 +34,6 @@ #undef FCRCS_REGNUM #undef FCRIR_REGNUM -/* Number of machine registers */ - -#define NUM_REGS 71 - /* Initializer for an array of names of registers. There should be NUM_REGS strings in this initializer. */ diff --git a/gdb/config/mips/tm-mips.h b/gdb/config/mips/tm-mips.h index d5a9297f1c8..e092d4a92cb 100644 --- a/gdb/config/mips/tm-mips.h +++ b/gdb/config/mips/tm-mips.h @@ -59,12 +59,6 @@ extern int mips_step_skips_delay (CORE_ADDR); #define MIPS_REGSIZE 4 #endif -/* Number of machine registers */ - -#ifndef NUM_REGS -#define NUM_REGS 90 -#endif - /* Initializer for an array of names of registers. There should be NUM_REGS strings in this initializer. */ diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index 799415a390a..4fbaaf8e8a9 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -1714,7 +1714,13 @@ mips_frame_saved_pc (struct frame_info *frame) } static struct mips_extra_func_info temp_proc_desc; -static CORE_ADDR temp_saved_regs[NUM_REGS]; + +/* This hack will go away once the get_prev_frame() code has been + modified to set the frame's type first. That is BEFORE init extra + frame info et.al. is called. This is because it will become + possible to skip the init extra info call for sigtramp and dummy + frames. */ +static CORE_ADDR *temp_saved_regs; /* Set a register's saved stack address in temp_saved_regs. If an address has already been set for this register, do nothing; this way we will @@ -2026,6 +2032,7 @@ mips32_heuristic_proc_desc (CORE_ADDR start_pc, CORE_ADDR limit_pc, CORE_ADDR cur_pc; CORE_ADDR frame_addr = 0; /* Value of $r30. Used by gcc for frame-pointer */ restart: + temp_saved_regs = xrealloc (temp_saved_regs, SIZEOF_FRAME_SAVED_REGS); memset (temp_saved_regs, '\0', SIZEOF_FRAME_SAVED_REGS); PROC_FRAME_OFFSET (&temp_proc_desc) = 0; PROC_FRAME_ADJUST (&temp_proc_desc) = 0; /* offset of FP from SP */ @@ -2134,6 +2141,7 @@ heuristic_proc_desc (CORE_ADDR start_pc, CORE_ADDR limit_pc, if (start_pc == 0) return NULL; memset (&temp_proc_desc, '\0', sizeof (temp_proc_desc)); + temp_saved_regs = xrealloc (temp_saved_regs, SIZEOF_FRAME_SAVED_REGS); memset (&temp_saved_regs, '\0', SIZEOF_FRAME_SAVED_REGS); PROC_LOW_ADDR (&temp_proc_desc) = start_pc; PROC_FRAME_REG (&temp_proc_desc) = SP_REGNUM; @@ -5757,6 +5765,11 @@ mips_gdbarch_init (struct gdbarch_info info, set_gdbarch_elf_make_msymbol_special (gdbarch, mips_elf_make_msymbol_special); + if (osabi == GDB_OSABI_IRIX) + set_gdbarch_num_regs (gdbarch, 71); + else + set_gdbarch_num_regs (gdbarch, 90); + switch (mips_abi) { case MIPS_ABI_O32: -- 2.30.2