DWARF_REG_TO_REGNUM, SDB_REG_TO_REGNUM, DWARF2_REG_TO_REGNUM.
+Mon Dec 4 14:36:39 2000 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * 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 <Stephane.Carrez@worldnet.fr>
* m68hc11-tdep.c (m68hc11_gdbarch_init): Remove elf_flags, cleanup.
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
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
#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. */
#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
#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
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;
0,
0,
0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
generic_get_saved_register,
0,
0,
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;
/* 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))
"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",
"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,
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)
{
#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))
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
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
}
+/* 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)
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);
#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.