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]
Other format: [Raw text]

GDB/ARM - Make REGISTER_NAME call a function



Although the ARM port already uses REGISTER_NAME() it was bound to a data 
table lookup.  Attached patch makes it use a function.

Committed as obvious for multi-arch support.

2002-01-21  Richard Earnshaw  <rearnsha@arm.com>

	* arm-tdep.c (arm_register_name): New function.
	(arm_registers_names): Make static.
	* config/arm/tm-arm.h (arm_register_names): Delete declaration.
	(arm_register_name): Declare.
	(REGISTER_NAME): Use it.


Index: arm-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/arm-tdep.c,v
retrieving revision 1.27
diff -p -r1.27 arm-tdep.c
*** arm-tdep.c	2002/01/21 16:27:42	1.27
--- arm-tdep.c	2002/01/21 17:35:25
*************** static char * arm_register_name_strings[
*** 83,89 ****
   "f0",  "f1",  "f2",  "f3",	/* 16 17 18 19 */
   "f4",  "f5",  "f6",  "f7",	/* 20 21 22 23 */
   "fps", "cpsr" }; 		/* 24 25       */
! char **arm_register_names = arm_register_name_strings;
  
  /* Valid register name flavors.  */
  static const char **valid_flavors;
--- 83,89 ----
   "f0",  "f1",  "f2",  "f3",	/* 16 17 18 19 */
   "f4",  "f5",  "f6",  "f7",	/* 20 21 22 23 */
   "fps", "cpsr" }; 		/* 24 25       */
! static char **arm_register_names = arm_register_name_strings;
  
  /* Valid register name flavors.  */
  static const char **valid_flavors;
*************** set_disassembly_flavor_sfunc (char *args
*** 2118,2123 ****
--- 2118,2130 ----
    set_disassembly_flavor ();
  }
  
+ /* Return the ARM register name corresponding to register I.  */
+ char *
+ arm_register_name(int i)
+ {
+   return arm_register_names[i];
+ }
+ 
  static void
  set_disassembly_flavor (void)
  {
Index: config/arm/tm-arm.h
===================================================================
RCS file: /cvs/src/src/gdb/config/arm/tm-arm.h,v
retrieving revision 1.16
diff -p -r1.16 tm-arm.h
*** tm-arm.h	2002/01/21 16:27:42	1.16
--- tm-arm.h	2002/01/21 17:35:25
*************** extern void arm_float_info (void);
*** 169,178 ****
  #define NUM_GREGS	16	/* Number of general purpose registers.  */
  #define NUM_REGS	(NUM_GREGS + NUM_FREGS + NUM_SREGS)
  
! /* An array of names of registers. */
! extern char **arm_register_names;
! 
! #define REGISTER_NAME(i) arm_register_names[i]
  
  /* Register numbers of various important registers.  Note that some of
     these values are "real" register numbers, and correspond to the
--- 169,176 ----
  #define NUM_GREGS	16	/* Number of general purpose registers.  */
  #define NUM_REGS	(NUM_GREGS + NUM_FREGS + NUM_SREGS)
  
! #define REGISTER_NAME(i) arm_register_name(i)
! char *arm_register_name (int);
  
  /* Register numbers of various important registers.  Note that some of
     these values are "real" register numbers, and correspond to the

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