From 88c72b7d7171d9f162ed9ecca26cf1d45abc38ee Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Mon, 4 Dec 2000 04:01:16 +0000 Subject: [PATCH] Multiarch STAB_REG_TO_REGNUM, ECOFF_REG_TO_REGNUM, DWARF_REG_TO_REGNUM, SDB_REG_TO_REGNUM, DWARF2_REG_TO_REGNUM. --- gdb/ChangeLog | 20 +++++ gdb/arch-utils.c | 6 ++ gdb/arch-utils.h | 4 + gdb/coffread.c | 8 -- gdb/config/mips/tm-mips.h | 8 -- gdb/dwarfread.c | 5 -- gdb/gdbarch.c | 170 ++++++++++++++++++++++++++++++++++++++ gdb/gdbarch.h | 80 ++++++++++++++++++ gdb/gdbarch.sh | 11 +++ gdb/mdebugread.c | 5 -- gdb/mips-tdep.c | 27 ++++++ gdb/stabsread.h | 6 -- 12 files changed, 318 insertions(+), 32 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 6227e9e8b26..fee320724d2 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,23 @@ +Mon Dec 4 14:36:39 2000 Andrew Cagney + + * gdbarch.sh (STAB_REG_TO_REGNUM, ECOFF_REG_TO_REGNUM, + DWARF_REG_TO_REGNUM, SDB_REG_TO_REGNUM, DWARF2_REG_TO_REGNUM): + Add. + * gdbarch.h, gdbarch.c: Regenerate. + * arch-utils.c (no_op_reg_to_regnum): New function. + * arch-utils.h (no_op_reg_to_regnum): Declare. + + * dwarfread.c (DWARF_REG_TO_REGNUM), coffread.c + (SDB_REG_TO_REGNUM), stabsread.h (STAB_REG_TO_REGNUM), + mdebugread.c (ECOFF_REG_TO_REGNUM): Delete macro. + + * config/mips/tm-mips.h (ECOFF_REG_TO_REGNUM, STAB_REG_TO_REGNUM): + Delete. Moved to mips-tdep.c. + * mips-tdep.c (mips_ecoff_reg_to_regnum, mips_stab_reg_to_regnum): + New functions. + (mips_gdbarch_init): Add ``mips_ecoff_reg_to_regnum'' and + ``mips_stab_reg_to_regnum'' to multi-arch vector. + 2000-12-03 Stephane Carrez * m68hc11-tdep.c (m68hc11_gdbarch_init): Remove elf_flags, cleanup. diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c index 4c87676d834..6b3484d683b 100644 --- a/gdb/arch-utils.c +++ b/gdb/arch-utils.c @@ -233,6 +233,12 @@ default_convert_from_func_ptr_addr (CORE_ADDR addr) return addr; } +int +no_op_reg_to_regnum (int reg) +{ + return reg; +} + /* Functions to manipulate the endianness of the target. */ #ifdef TARGET_BYTE_ORDER_SELECTABLE diff --git a/gdb/arch-utils.h b/gdb/arch-utils.h index 2645a95e60a..523b58d2efb 100644 --- a/gdb/arch-utils.h +++ b/gdb/arch-utils.h @@ -97,4 +97,8 @@ extern int default_register_sim_regno (int reg_nr); extern CORE_ADDR default_convert_from_func_ptr_addr (CORE_ADDR addr); +/* No-op conversion of reg to regnum. */ + +extern int no_op_reg_to_regnum (int reg); + #endif diff --git a/gdb/coffread.c b/gdb/coffread.c index 91fd8a451d8..5c02c00ae10 100644 --- a/gdb/coffread.c +++ b/gdb/coffread.c @@ -68,14 +68,6 @@ struct coff_symfile_info #define SDB_TYPE(type) (BTYPE(type) | (type & N_TMASK)) -/* Convert from an sdb register number to an internal gdb register number. - This should be defined in tm.h, if REGISTER_NAMES is not set up - to map one to one onto the sdb register numbers. */ - -#ifndef SDB_REG_TO_REGNUM -#define SDB_REG_TO_REGNUM(value) (value) -#endif - /* Core address of start and end of text of current source file. This comes from a ".text" symbol where x_nlinno > 0. */ diff --git a/gdb/config/mips/tm-mips.h b/gdb/config/mips/tm-mips.h index f4dd60cc6c0..9de7fba4c12 100644 --- a/gdb/config/mips/tm-mips.h +++ b/gdb/config/mips/tm-mips.h @@ -437,14 +437,6 @@ extern void mips_print_extra_frame_info (struct frame_info *frame); #define SETUP_ARBITRARY_FRAME(argc, argv) setup_arbitrary_frame (argc, argv) extern struct frame_info *setup_arbitrary_frame (int, CORE_ADDR *); -/* Convert a dbx stab register number (from `r' declaration) to a gdb REGNUM */ - -#define STAB_REG_TO_REGNUM(num) ((num) < 32 ? (num) : (num)+FP0_REGNUM-38) - -/* Convert a ecoff register number to a gdb REGNUM */ - -#define ECOFF_REG_TO_REGNUM(num) ((num) < 32 ? (num) : (num)+FP0_REGNUM-32) - /* Select the default mips disassembler */ #define TM_PRINT_INSN_MACH 0 diff --git a/gdb/dwarfread.c b/gdb/dwarfread.c index 499c41e0897..c6a24fa94b2 100644 --- a/gdb/dwarfread.c +++ b/gdb/dwarfread.c @@ -189,11 +189,6 @@ typedef unsigned int DIE_REF; /* Reference to a DIE */ #define CHILL_PRODUCER "GNU Chill " #endif -/* Provide a default mapping from a DWARF register number to a gdb REGNUM. */ -#ifndef DWARF_REG_TO_REGNUM -#define DWARF_REG_TO_REGNUM(num) (num) -#endif - /* Flags to target_to_host() that tell whether or not the data object is expected to be signed. Used, for example, when fetching a signed integer in the target environment which is used as a signed integer diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index 25c1df1a019..b8368cabb61 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -153,6 +153,11 @@ struct gdbarch int fp0_regnum; int npc_regnum; int nnpc_regnum; + gdbarch_stab_reg_to_regnum_ftype *stab_reg_to_regnum; + gdbarch_ecoff_reg_to_regnum_ftype *ecoff_reg_to_regnum; + gdbarch_dwarf_reg_to_regnum_ftype *dwarf_reg_to_regnum; + gdbarch_sdb_reg_to_regnum_ftype *sdb_reg_to_regnum; + gdbarch_dwarf2_reg_to_regnum_ftype *dwarf2_reg_to_regnum; gdbarch_register_name_ftype *register_name; int register_size; int register_bytes; @@ -304,6 +309,11 @@ struct gdbarch startup_gdbarch = 0, 0, 0, + 0, + 0, + 0, + 0, + 0, generic_get_saved_register, 0, 0, @@ -400,6 +410,11 @@ gdbarch_alloc (const struct gdbarch_info *info, gdbarch->fp0_regnum = -1; gdbarch->npc_regnum = -1; gdbarch->nnpc_regnum = -1; + gdbarch->stab_reg_to_regnum = no_op_reg_to_regnum; + gdbarch->ecoff_reg_to_regnum = no_op_reg_to_regnum; + gdbarch->dwarf_reg_to_regnum = no_op_reg_to_regnum; + gdbarch->sdb_reg_to_regnum = no_op_reg_to_regnum; + gdbarch->dwarf2_reg_to_regnum = no_op_reg_to_regnum; gdbarch->register_name = legacy_register_name; gdbarch->register_size = -1; gdbarch->register_bytes = -1; @@ -500,6 +515,11 @@ verify_gdbarch (struct gdbarch *gdbarch) /* Skip verify of fp0_regnum, invalid_p == 0 */ /* Skip verify of npc_regnum, invalid_p == 0 */ /* Skip verify of nnpc_regnum, invalid_p == 0 */ + /* Skip verify of stab_reg_to_regnum, invalid_p == 0 */ + /* Skip verify of ecoff_reg_to_regnum, invalid_p == 0 */ + /* Skip verify of dwarf_reg_to_regnum, invalid_p == 0 */ + /* Skip verify of sdb_reg_to_regnum, invalid_p == 0 */ + /* Skip verify of dwarf2_reg_to_regnum, invalid_p == 0 */ /* Skip verify of register_name, invalid_p == 0 */ if ((GDB_MULTI_ARCH >= 2) && (gdbarch->register_size == -1)) @@ -830,6 +850,36 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) "gdbarch_dump: NNPC_REGNUM # %s\n", XSTRING (NNPC_REGNUM)); #endif +#ifdef STAB_REG_TO_REGNUM + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "STAB_REG_TO_REGNUM(stab_regnr)", + XSTRING (STAB_REG_TO_REGNUM (stab_regnr))); +#endif +#ifdef ECOFF_REG_TO_REGNUM + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "ECOFF_REG_TO_REGNUM(ecoff_regnr)", + XSTRING (ECOFF_REG_TO_REGNUM (ecoff_regnr))); +#endif +#ifdef DWARF_REG_TO_REGNUM + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DWARF_REG_TO_REGNUM(dwarf_regnr)", + XSTRING (DWARF_REG_TO_REGNUM (dwarf_regnr))); +#endif +#ifdef SDB_REG_TO_REGNUM + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "SDB_REG_TO_REGNUM(sdb_regnr)", + XSTRING (SDB_REG_TO_REGNUM (sdb_regnr))); +#endif +#ifdef DWARF2_REG_TO_REGNUM + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DWARF2_REG_TO_REGNUM(dwarf2_regnr)", + XSTRING (DWARF2_REG_TO_REGNUM (dwarf2_regnr))); +#endif #ifdef REGISTER_NAME fprintf_unfiltered (file, "gdbarch_dump: %s # %s\n", @@ -1451,6 +1501,41 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) "gdbarch_dump: NNPC_REGNUM = %ld\n", (long) NNPC_REGNUM); #endif +#ifdef STAB_REG_TO_REGNUM + if (GDB_MULTI_ARCH) + fprintf_unfiltered (file, + "gdbarch_dump: STAB_REG_TO_REGNUM = 0x%08lx\n", + (long) current_gdbarch->stab_reg_to_regnum + /*STAB_REG_TO_REGNUM ()*/); +#endif +#ifdef ECOFF_REG_TO_REGNUM + if (GDB_MULTI_ARCH) + fprintf_unfiltered (file, + "gdbarch_dump: ECOFF_REG_TO_REGNUM = 0x%08lx\n", + (long) current_gdbarch->ecoff_reg_to_regnum + /*ECOFF_REG_TO_REGNUM ()*/); +#endif +#ifdef DWARF_REG_TO_REGNUM + if (GDB_MULTI_ARCH) + fprintf_unfiltered (file, + "gdbarch_dump: DWARF_REG_TO_REGNUM = 0x%08lx\n", + (long) current_gdbarch->dwarf_reg_to_regnum + /*DWARF_REG_TO_REGNUM ()*/); +#endif +#ifdef SDB_REG_TO_REGNUM + if (GDB_MULTI_ARCH) + fprintf_unfiltered (file, + "gdbarch_dump: SDB_REG_TO_REGNUM = 0x%08lx\n", + (long) current_gdbarch->sdb_reg_to_regnum + /*SDB_REG_TO_REGNUM ()*/); +#endif +#ifdef DWARF2_REG_TO_REGNUM + if (GDB_MULTI_ARCH) + fprintf_unfiltered (file, + "gdbarch_dump: DWARF2_REG_TO_REGNUM = 0x%08lx\n", + (long) current_gdbarch->dwarf2_reg_to_regnum + /*DWARF2_REG_TO_REGNUM ()*/); +#endif #ifdef REGISTER_NAME if (GDB_MULTI_ARCH) fprintf_unfiltered (file, @@ -2406,6 +2491,91 @@ set_gdbarch_nnpc_regnum (struct gdbarch *gdbarch, gdbarch->nnpc_regnum = nnpc_regnum; } +int +gdbarch_stab_reg_to_regnum (struct gdbarch *gdbarch, int stab_regnr) +{ + if (gdbarch->stab_reg_to_regnum == 0) + internal_error ("gdbarch: gdbarch_stab_reg_to_regnum invalid"); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_stab_reg_to_regnum called\n"); + return gdbarch->stab_reg_to_regnum (stab_regnr); +} + +void +set_gdbarch_stab_reg_to_regnum (struct gdbarch *gdbarch, + gdbarch_stab_reg_to_regnum_ftype stab_reg_to_regnum) +{ + gdbarch->stab_reg_to_regnum = stab_reg_to_regnum; +} + +int +gdbarch_ecoff_reg_to_regnum (struct gdbarch *gdbarch, int ecoff_regnr) +{ + if (gdbarch->ecoff_reg_to_regnum == 0) + internal_error ("gdbarch: gdbarch_ecoff_reg_to_regnum invalid"); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_ecoff_reg_to_regnum called\n"); + return gdbarch->ecoff_reg_to_regnum (ecoff_regnr); +} + +void +set_gdbarch_ecoff_reg_to_regnum (struct gdbarch *gdbarch, + gdbarch_ecoff_reg_to_regnum_ftype ecoff_reg_to_regnum) +{ + gdbarch->ecoff_reg_to_regnum = ecoff_reg_to_regnum; +} + +int +gdbarch_dwarf_reg_to_regnum (struct gdbarch *gdbarch, int dwarf_regnr) +{ + if (gdbarch->dwarf_reg_to_regnum == 0) + internal_error ("gdbarch: gdbarch_dwarf_reg_to_regnum invalid"); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_dwarf_reg_to_regnum called\n"); + return gdbarch->dwarf_reg_to_regnum (dwarf_regnr); +} + +void +set_gdbarch_dwarf_reg_to_regnum (struct gdbarch *gdbarch, + gdbarch_dwarf_reg_to_regnum_ftype dwarf_reg_to_regnum) +{ + gdbarch->dwarf_reg_to_regnum = dwarf_reg_to_regnum; +} + +int +gdbarch_sdb_reg_to_regnum (struct gdbarch *gdbarch, int sdb_regnr) +{ + if (gdbarch->sdb_reg_to_regnum == 0) + internal_error ("gdbarch: gdbarch_sdb_reg_to_regnum invalid"); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_sdb_reg_to_regnum called\n"); + return gdbarch->sdb_reg_to_regnum (sdb_regnr); +} + +void +set_gdbarch_sdb_reg_to_regnum (struct gdbarch *gdbarch, + gdbarch_sdb_reg_to_regnum_ftype sdb_reg_to_regnum) +{ + gdbarch->sdb_reg_to_regnum = sdb_reg_to_regnum; +} + +int +gdbarch_dwarf2_reg_to_regnum (struct gdbarch *gdbarch, int dwarf2_regnr) +{ + if (gdbarch->dwarf2_reg_to_regnum == 0) + internal_error ("gdbarch: gdbarch_dwarf2_reg_to_regnum invalid"); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_dwarf2_reg_to_regnum called\n"); + return gdbarch->dwarf2_reg_to_regnum (dwarf2_regnr); +} + +void +set_gdbarch_dwarf2_reg_to_regnum (struct gdbarch *gdbarch, + gdbarch_dwarf2_reg_to_regnum_ftype dwarf2_reg_to_regnum) +{ + gdbarch->dwarf2_reg_to_regnum = dwarf2_reg_to_regnum; +} + char * gdbarch_register_name (struct gdbarch *gdbarch, int regnr) { diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index 198d80064aa..307bc5fe5a0 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -428,6 +428,86 @@ extern void set_gdbarch_nnpc_regnum (struct gdbarch *gdbarch, int nnpc_regnum); #endif #endif +/* Convert stab register number (from `r' declaration) to a gdb REGNUM. */ + +/* Default (function) for non- multi-arch platforms. */ +#if (!GDB_MULTI_ARCH) && !defined (STAB_REG_TO_REGNUM) +#define STAB_REG_TO_REGNUM(stab_regnr) (no_op_reg_to_regnum (stab_regnr)) +#endif + +typedef int (gdbarch_stab_reg_to_regnum_ftype) (int stab_regnr); +extern int gdbarch_stab_reg_to_regnum (struct gdbarch *gdbarch, int stab_regnr); +extern void set_gdbarch_stab_reg_to_regnum (struct gdbarch *gdbarch, gdbarch_stab_reg_to_regnum_ftype *stab_reg_to_regnum); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (STAB_REG_TO_REGNUM) +#define STAB_REG_TO_REGNUM(stab_regnr) (gdbarch_stab_reg_to_regnum (current_gdbarch, stab_regnr)) +#endif +#endif + +/* Provide a default mapping from a ecoff register number to a gdb REGNUM. */ + +/* Default (function) for non- multi-arch platforms. */ +#if (!GDB_MULTI_ARCH) && !defined (ECOFF_REG_TO_REGNUM) +#define ECOFF_REG_TO_REGNUM(ecoff_regnr) (no_op_reg_to_regnum (ecoff_regnr)) +#endif + +typedef int (gdbarch_ecoff_reg_to_regnum_ftype) (int ecoff_regnr); +extern int gdbarch_ecoff_reg_to_regnum (struct gdbarch *gdbarch, int ecoff_regnr); +extern void set_gdbarch_ecoff_reg_to_regnum (struct gdbarch *gdbarch, gdbarch_ecoff_reg_to_regnum_ftype *ecoff_reg_to_regnum); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (ECOFF_REG_TO_REGNUM) +#define ECOFF_REG_TO_REGNUM(ecoff_regnr) (gdbarch_ecoff_reg_to_regnum (current_gdbarch, ecoff_regnr)) +#endif +#endif + +/* Provide a default mapping from a DWARF register number to a gdb REGNUM. */ + +/* Default (function) for non- multi-arch platforms. */ +#if (!GDB_MULTI_ARCH) && !defined (DWARF_REG_TO_REGNUM) +#define DWARF_REG_TO_REGNUM(dwarf_regnr) (no_op_reg_to_regnum (dwarf_regnr)) +#endif + +typedef int (gdbarch_dwarf_reg_to_regnum_ftype) (int dwarf_regnr); +extern int gdbarch_dwarf_reg_to_regnum (struct gdbarch *gdbarch, int dwarf_regnr); +extern void set_gdbarch_dwarf_reg_to_regnum (struct gdbarch *gdbarch, gdbarch_dwarf_reg_to_regnum_ftype *dwarf_reg_to_regnum); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DWARF_REG_TO_REGNUM) +#define DWARF_REG_TO_REGNUM(dwarf_regnr) (gdbarch_dwarf_reg_to_regnum (current_gdbarch, dwarf_regnr)) +#endif +#endif + +/* Convert from an sdb register number to an internal gdb register number. + This should be defined in tm.h, if REGISTER_NAMES is not set up + to map one to one onto the sdb register numbers. */ + +/* Default (function) for non- multi-arch platforms. */ +#if (!GDB_MULTI_ARCH) && !defined (SDB_REG_TO_REGNUM) +#define SDB_REG_TO_REGNUM(sdb_regnr) (no_op_reg_to_regnum (sdb_regnr)) +#endif + +typedef int (gdbarch_sdb_reg_to_regnum_ftype) (int sdb_regnr); +extern int gdbarch_sdb_reg_to_regnum (struct gdbarch *gdbarch, int sdb_regnr); +extern void set_gdbarch_sdb_reg_to_regnum (struct gdbarch *gdbarch, gdbarch_sdb_reg_to_regnum_ftype *sdb_reg_to_regnum); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (SDB_REG_TO_REGNUM) +#define SDB_REG_TO_REGNUM(sdb_regnr) (gdbarch_sdb_reg_to_regnum (current_gdbarch, sdb_regnr)) +#endif +#endif + +/* Default (function) for non- multi-arch platforms. */ +#if (!GDB_MULTI_ARCH) && !defined (DWARF2_REG_TO_REGNUM) +#define DWARF2_REG_TO_REGNUM(dwarf2_regnr) (no_op_reg_to_regnum (dwarf2_regnr)) +#endif + +typedef int (gdbarch_dwarf2_reg_to_regnum_ftype) (int dwarf2_regnr); +extern int gdbarch_dwarf2_reg_to_regnum (struct gdbarch *gdbarch, int dwarf2_regnr); +extern void set_gdbarch_dwarf2_reg_to_regnum (struct gdbarch *gdbarch, gdbarch_dwarf2_reg_to_regnum_ftype *dwarf2_reg_to_regnum); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DWARF2_REG_TO_REGNUM) +#define DWARF2_REG_TO_REGNUM(dwarf2_regnr) (gdbarch_dwarf2_reg_to_regnum (current_gdbarch, dwarf2_regnr)) +#endif +#endif + /* Default (function) for non- multi-arch platforms. */ #if (!GDB_MULTI_ARCH) && !defined (REGISTER_NAME) #define REGISTER_NAME(regnr) (legacy_register_name (regnr)) diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index 8dfe5f882dc..216a47f852a 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -371,6 +371,17 @@ v:2:PC_REGNUM:int:pc_regnum::::0:-1 v:2:FP0_REGNUM:int:fp0_regnum::::0:-1::0 v:2:NPC_REGNUM:int:npc_regnum::::0:-1::0 v:2:NNPC_REGNUM:int:nnpc_regnum::::0:-1::0 +# Convert stab register number (from \`r\' declaration) to a gdb REGNUM. +f:2:STAB_REG_TO_REGNUM:int:stab_reg_to_regnum:int stab_regnr:stab_regnr:::no_op_reg_to_regnum::0 +# Provide a default mapping from a ecoff register number to a gdb REGNUM. +f:2:ECOFF_REG_TO_REGNUM:int:ecoff_reg_to_regnum:int ecoff_regnr:ecoff_regnr:::no_op_reg_to_regnum::0 +# Provide a default mapping from a DWARF register number to a gdb REGNUM. +f:2:DWARF_REG_TO_REGNUM:int:dwarf_reg_to_regnum:int dwarf_regnr:dwarf_regnr:::no_op_reg_to_regnum::0 +# Convert from an sdb register number to an internal gdb register number. +# This should be defined in tm.h, if REGISTER_NAMES is not set up +# to map one to one onto the sdb register numbers. +f:2:SDB_REG_TO_REGNUM:int:sdb_reg_to_regnum:int sdb_regnr:sdb_regnr:::no_op_reg_to_regnum::0 +f:2:DWARF2_REG_TO_REGNUM:int:dwarf2_reg_to_regnum:int dwarf2_regnr:dwarf2_regnr:::no_op_reg_to_regnum::0 f:2:REGISTER_NAME:char *:register_name:int regnr:regnr:::legacy_register_name::0 v:2:REGISTER_SIZE:int:register_size::::0:-1 v:2:REGISTER_BYTES:int:register_bytes::::0:-1 diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c index c1984054e0d..66828dd2f5d 100644 --- a/gdb/mdebugread.c +++ b/gdb/mdebugread.c @@ -93,11 +93,6 @@ typedef struct mips_extra_func_info extern void _initialize_mdebugread (void); -/* Provide a default mapping from a ecoff register number to a gdb REGNUM. */ -#ifndef ECOFF_REG_TO_REGNUM -#define ECOFF_REG_TO_REGNUM(num) (num) -#endif - /* Provide a way to test if we have both ECOFF and ELF symbol tables. We use this define in order to know whether we should override a symbol's ECOFF section with its ELF section. This is necessary in diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index 3d119c8aacc..61c9b95316d 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -3801,6 +3801,29 @@ mips_saved_pc_after_call (struct frame_info *frame) } +/* Convert a dbx stab register number (from `r' declaration) to a gdb + REGNUM */ + +static int +mips_stab_reg_to_regnum (int num) +{ + if (num < 32) + return num; + else + return num + FP0_REGNUM - 38; +} + +/* Convert a ecoff register number to a gdb REGNUM */ + +static int +mips_ecoff_reg_to_regnum (int num) +{ + if (num < 32) + return num; + else + return num + FP0_REGNUM - 32; +} + static struct gdbarch * mips_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) @@ -4042,6 +4065,10 @@ mips_gdbarch_init (struct gdbarch_info info, set_gdbarch_read_sp (gdbarch, generic_target_read_sp); set_gdbarch_write_sp (gdbarch, generic_target_write_sp); + /* Map debug register numbers onto internal register numbers. */ + set_gdbarch_stab_reg_to_regnum (gdbarch, mips_stab_reg_to_regnum); + set_gdbarch_ecoff_reg_to_regnum (gdbarch, mips_ecoff_reg_to_regnum); + /* Initialize a frame */ set_gdbarch_init_extra_frame_info (gdbarch, mips_init_extra_frame_info); diff --git a/gdb/stabsread.h b/gdb/stabsread.h index 6ae3d8bd4fe..8cbee75662a 100644 --- a/gdb/stabsread.h +++ b/gdb/stabsread.h @@ -30,12 +30,6 @@ #define EXTERN extern #endif -/* Convert stab register number (from `r' declaration) to a gdb REGNUM. */ - -#ifndef STAB_REG_TO_REGNUM -#define STAB_REG_TO_REGNUM(VALUE) (VALUE) -#endif - /* Hash table of global symbols whose values are not known yet. They are chained thru the SYMBOL_VALUE_CHAIN, since we don't have the correct data for that slot yet. -- 2.30.2