This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[rfc/rfa] multi-arch *_REG_TO_REGNUM()


Hello,

The attatched multi-arches all the existing .*_REG_TO_REGNUM() macros. 
In addition it adds a new DWARF2_REG_TO_REGNUM() (I know the s390 port
needs this) and documents the ones that were missing from
gdbint.texinfo.

	Andrew
Thu Nov 30 16:33:36 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.

Index: doc/ChangeLog
Thu Nov 30 16:57:19 2000  Andrew Cagney  <cagney@b1.cygnus.com>

	* gdbint.texinfo (ECOFF_REG_TO_REGNUM, DWARF_REG_TO_REGNUM,
 	DWARF2_REG_TO_REGNUM): Document.

Index: arch-utils.c
===================================================================
RCS file: /cvs/src/src/gdb/arch-utils.c,v
retrieving revision 1.16
diff -p -r1.16 arch-utils.c
*** arch-utils.c	2000/10/27 19:17:56	1.16
--- arch-utils.c	2000/11/30 06:08:53
*************** default_convert_from_func_ptr_addr (CORE
*** 233,238 ****
--- 233,244 ----
    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
Index: arch-utils.h
===================================================================
RCS file: /cvs/src/src/gdb/arch-utils.h,v
retrieving revision 1.10
diff -p -r1.10 arch-utils.h
*** arch-utils.h	2000/10/26 07:41:25	1.10
--- arch-utils.h	2000/11/30 06:08:53
*************** extern int default_register_sim_regno (i
*** 97,100 ****
--- 97,104 ----
  
  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
Index: coffread.c
===================================================================
RCS file: /cvs/src/src/gdb/coffread.c,v
retrieving revision 1.12
diff -p -r1.12 coffread.c
*** coffread.c	2000/10/24 21:13:08	1.12
--- coffread.c	2000/11/30 06:09:04
*************** struct coff_symfile_info
*** 68,81 ****
  
  #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.  */
  
--- 68,73 ----
Index: dwarfread.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarfread.c,v
retrieving revision 1.3
diff -p -r1.3 dwarfread.c
*** dwarfread.c	2000/07/30 01:48:25	1.3
--- dwarfread.c	2000/11/30 06:09:09
*************** typedef unsigned int DIE_REF;	/* Referen
*** 189,199 ****
  #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
--- 189,194 ----
Index: gdbarch.sh
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.sh,v
retrieving revision 1.48
diff -p -r1.48 gdbarch.sh
*** gdbarch.sh	2000/11/08 23:58:46	1.48
--- gdbarch.sh	2000/11/30 06:09:23
*************** v:2:PC_REGNUM:int:pc_regnum::::0:-1
*** 371,376 ****
--- 371,387 ----
  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
Index: mdebugread.c
===================================================================
RCS file: /cvs/src/src/gdb/mdebugread.c,v
retrieving revision 1.7
diff -p -r1.7 mdebugread.c
*** mdebugread.c	2000/09/24 04:42:12	1.7
--- mdebugread.c	2000/11/30 06:09:37
*************** typedef struct mips_extra_func_info
*** 93,103 ****
  
  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 
--- 93,98 ----
Index: mips-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/mips-tdep.c,v
retrieving revision 1.34
diff -p -r1.34 mips-tdep.c
*** mips-tdep.c	2000/10/30 21:50:57	1.34
--- mips-tdep.c	2000/11/30 06:09:44
*************** mips_saved_pc_after_call (struct frame_i
*** 3812,3817 ****
--- 3812,3840 ----
  }
  
  
+ /* 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)
*************** mips_gdbarch_init (struct gdbarch_info i
*** 4052,4057 ****
--- 4075,4084 ----
    set_gdbarch_write_fp (gdbarch, generic_target_write_fp);
    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);
Index: stabsread.h
===================================================================
RCS file: /cvs/src/src/gdb/stabsread.h,v
retrieving revision 1.3
diff -p -r1.3 stabsread.h
*** stabsread.h	2000/06/04 00:41:09	1.3
--- stabsread.h	2000/11/30 06:09:46
***************
*** 30,41 ****
  #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.
--- 30,35 ----
Index: config/mips/tm-mips.h
===================================================================
RCS file: /cvs/src/src/gdb/config/mips/tm-mips.h,v
retrieving revision 1.15
diff -p -r1.15 tm-mips.h
*** tm-mips.h	2000/10/27 15:02:42	1.15
--- tm-mips.h	2000/11/30 06:09:49
*************** extern void mips_print_extra_frame_info 
*** 437,450 ****
  #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
--- 437,442 ----
Index: doc/gdbint.texinfo
===================================================================
RCS file: /cvs/src/src/gdb/doc/gdbint.texinfo,v
retrieving revision 1.16
diff -p -r1.16 gdbint.texinfo
*** gdbint.texinfo	2000/11/24 11:02:59	1.16
--- gdbint.texinfo	2000/11/30 06:10:08
*************** library in which breakpoints cannot be s
*** 1640,1645 ****
--- 1640,1657 ----
  @item DO_REGISTERS_INFO
  If defined, use this to print the value of a register or all registers.
  
+ @item DWARF_REG_TO_REGNUM
+ Convert DWARF register number into @value{GDBN} regnum.  If not defined,
+ no conversion will be performed.
+ 
+ @item DWARF2_REG_TO_REGNUM
+ Convert DWARF2 register number into @value{GDBN} regnum.  If not
+ defined, no conversion will be performed.
+ 
+ @item ECOFF_REG_TO_REGNUM
+ Convert ECOFF register number into @value{GDBN} regnum.  If not defined,
+ no conversion will be performed.
+ 
  @item END_OF_TEXT_DEFAULT
  This is an expression that should designate the end of the text section
  (? FIXME ?)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]