This is the mail archive of the gdb-patches@sourceware.cygnus.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] Cleanup (TARGET_BFD_VMA_BIT, IEEE_FLOAT, CALL_DUMMY_WORDS and SIZEOF_CALL_DUMMY_WORDS


Hello,

The attatched patch does to several multi-arch variables what my
previous patch did to functions.  It changes gdbarch.h so that it
provides the default for both the multi-arch and non- multi-arch cases.

(It isn't final as I need info from JimB)

I'll look to apply it in a few days once the last patch has settled
down.

	Andrew
Mon Apr 17 13:37:10 2000  Andrew Cagney  <cagney@b1.cygnus.com>

	* gdbarch.sh: Make multi-arch variable defaults, defaults for non-
 	multi-arch targets.
	(TARGET_BFD_VMA_BIT, IEEE_FLOAT, CALL_DUMMY_WORDS,
 	SIZEOF_CALL_DUMMY_WORDS): Update.

	* inferior.h (CALL_DUMMY_WORDS, SIZEOF_CALL_DUMMY_WORDS): Default
 	provided by gdbarch.
	(CALL_DUMMY_P): Add FIXME. gdbarch should provide default.

	* valprint.c (IEEE_FLOAT): Default provided by gdbarch.

Index: gdbarch.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.c,v
retrieving revision 1.11
diff -p -r1.11 gdbarch.c
*** gdbarch.c	2000/04/17 02:27:36	1.11
--- gdbarch.c	2000/04/17 03:57:08
*************** gdbarch_byte_order (struct gdbarch *gdba
*** 978,983 ****
--- 978,985 ----
  int
  gdbarch_bfd_vma_bit (struct gdbarch *gdbarch)
  {
+   if (GDB_MULTI_ARCH == 0)
+     return TARGET_ARCHITECTURE->bits_per_address;
    /* Skip verify of bfd_vma_bit, invalid_p == 0 */
    if (gdbarch_debug >= 2)
      fprintf_unfiltered (gdb_stdlog, "gdbarch_bfd_vma_bit called\n");
*************** set_gdbarch_long_double_bit (struct gdba
*** 1130,1135 ****
--- 1132,1139 ----
  int
  gdbarch_ieee_float (struct gdbarch *gdbarch)
  {
+   if (GDB_MULTI_ARCH == 0)
+     return 1;
    /* Skip verify of ieee_float, invalid_p == 0 */
    if (gdbarch_debug >= 2)
      fprintf_unfiltered (gdb_stdlog, "gdbarch_ieee_float called\n");
*************** set_gdbarch_call_dummy_p (struct gdbarch
*** 1624,1629 ****
--- 1628,1635 ----
  LONGEST *
  gdbarch_call_dummy_words (struct gdbarch *gdbarch)
  {
+   if (GDB_MULTI_ARCH == 0)
+     return legacy_call_dummy_words;
    /* Skip verify of call_dummy_words, invalid_p == 0 */
    if (gdbarch_debug >= 2)
      fprintf_unfiltered (gdb_stdlog, "gdbarch_call_dummy_words called\n");
*************** set_gdbarch_call_dummy_words (struct gdb
*** 1640,1645 ****
--- 1646,1653 ----
  int
  gdbarch_sizeof_call_dummy_words (struct gdbarch *gdbarch)
  {
+   if (GDB_MULTI_ARCH == 0)
+     return legacy_sizeof_call_dummy_words;
    /* Skip verify of sizeof_call_dummy_words, invalid_p == 0 */
    if (gdbarch_debug >= 2)
      fprintf_unfiltered (gdb_stdlog, "gdbarch_sizeof_call_dummy_words called\n");
*************** set_gdbarch_from_file (abfd)
*** 3219,3231 ****
    set_architecture_from_file (abfd);
    set_endian_from_file (abfd);
  }
- 
- 
- #if defined (CALL_DUMMY)
- /* FIXME - this should go away */
- LONGEST call_dummy_words[] = CALL_DUMMY;
- int sizeof_call_dummy_words = sizeof (call_dummy_words);
- #endif
  
  
  /* Initialize the current architecture.  */
--- 3227,3232 ----
Index: gdbarch.h
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.h,v
retrieving revision 1.8
diff -p -r1.8 gdbarch.h
*** gdbarch.h	2000/04/17 02:27:37	1.8
--- gdbarch.h	2000/04/17 03:57:10
*************** extern int gdbarch_byte_order (struct gd
*** 89,99 ****
  
  extern int gdbarch_bfd_vma_bit (struct gdbarch *gdbarch);
  extern void set_gdbarch_bfd_vma_bit (struct gdbarch *gdbarch, int bfd_vma_bit);
- #if GDB_MULTI_ARCH
  #if (GDB_MULTI_ARCH > 1) || !defined (TARGET_BFD_VMA_BIT)
  #define TARGET_BFD_VMA_BIT (gdbarch_bfd_vma_bit (current_gdbarch))
  #endif
- #endif
  
  extern int gdbarch_ptr_bit (struct gdbarch *gdbarch);
  extern void set_gdbarch_ptr_bit (struct gdbarch *gdbarch, int ptr_bit);
--- 89,97 ----
*************** extern void set_gdbarch_long_double_bit 
*** 161,171 ****
  
  extern int gdbarch_ieee_float (struct gdbarch *gdbarch);
  extern void set_gdbarch_ieee_float (struct gdbarch *gdbarch, int ieee_float);
- #if GDB_MULTI_ARCH
  #if (GDB_MULTI_ARCH > 1) || !defined (IEEE_FLOAT)
  #define IEEE_FLOAT (gdbarch_ieee_float (current_gdbarch))
  #endif
- #endif
  
  typedef CORE_ADDR (gdbarch_read_pc_ftype) (int pid);
  extern CORE_ADDR gdbarch_read_pc (struct gdbarch *gdbarch, int pid);
--- 159,167 ----
*************** extern void set_gdbarch_call_dummy_p (st
*** 404,421 ****
  
  extern LONGEST * gdbarch_call_dummy_words (struct gdbarch *gdbarch);
  extern void set_gdbarch_call_dummy_words (struct gdbarch *gdbarch, LONGEST * call_dummy_words);
- #if GDB_MULTI_ARCH
  #if (GDB_MULTI_ARCH > 1) || !defined (CALL_DUMMY_WORDS)
  #define CALL_DUMMY_WORDS (gdbarch_call_dummy_words (current_gdbarch))
  #endif
- #endif
  
  extern int gdbarch_sizeof_call_dummy_words (struct gdbarch *gdbarch);
  extern void set_gdbarch_sizeof_call_dummy_words (struct gdbarch *gdbarch, int sizeof_call_dummy_words);
- #if GDB_MULTI_ARCH
  #if (GDB_MULTI_ARCH > 1) || !defined (SIZEOF_CALL_DUMMY_WORDS)
  #define SIZEOF_CALL_DUMMY_WORDS (gdbarch_sizeof_call_dummy_words (current_gdbarch))
- #endif
  #endif
  
  extern int gdbarch_call_dummy_stack_adjust_p (struct gdbarch *gdbarch);
--- 400,413 ----
Index: gdbarch.sh
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.sh,v
retrieving revision 1.10
diff -p -r1.10 gdbarch.sh
*** gdbarch.sh	2000/04/17 02:27:37	1.10
--- gdbarch.sh	2000/04/17 03:57:12
*************** do
*** 422,432 ****
  	echo ""
  	echo "extern ${returntype} gdbarch_${function} (struct gdbarch *gdbarch);"
  	echo "extern void set_gdbarch_${function} (struct gdbarch *gdbarch, ${returntype} ${function});"
! 	echo "#if GDB_MULTI_ARCH"
  	echo "#if (GDB_MULTI_ARCH > 1) || !defined (${macro})"
  	echo "#define ${macro} (gdbarch_${function} (current_gdbarch))"
  	echo "#endif"
! 	echo "#endif"
  	;;
      "f" )
  	echo ""
--- 422,438 ----
  	echo ""
  	echo "extern ${returntype} gdbarch_${function} (struct gdbarch *gdbarch);"
  	echo "extern void set_gdbarch_${function} (struct gdbarch *gdbarch, ${returntype} ${function});"
! 	if ! default_is_fallback_p
! 	then
! 	    echo "#if GDB_MULTI_ARCH"
! 	fi
  	echo "#if (GDB_MULTI_ARCH > 1) || !defined (${macro})"
  	echo "#define ${macro} (gdbarch_${function} (current_gdbarch))"
  	echo "#endif"
! 	if ! default_is_fallback_p
! 	then
! 	    echo "#endif"
! 	fi
  	;;
      "f" )
  	echo ""
*************** do
*** 1133,1138 ****
--- 1139,1149 ----
  	echo "${returntype}"
  	echo "gdbarch_${function} (struct gdbarch *gdbarch)"
  	echo "{"
+ 	if default_is_fallback_p && [ "${default}" != "0" ]
+ 	then
+ 	    echo "  if (GDB_MULTI_ARCH == 0)"
+ 	    echo "    return ${default};"
+ 	fi
  	if [ "${invalid_p}" = "0" ]
  	then
  	    echo "  /* Skip verify of ${function}, invalid_p == 0 */"
*************** set_gdbarch_from_file (abfd)
*** 1937,1949 ****
    set_architecture_from_file (abfd);
    set_endian_from_file (abfd);
  }
- 
- 
- #if defined (CALL_DUMMY)
- /* FIXME - this should go away */
- LONGEST call_dummy_words[] = CALL_DUMMY;
- int sizeof_call_dummy_words = sizeof (call_dummy_words);
- #endif
  
  
  /* Initialize the current architecture.  */
--- 1948,1953 ----
Index: inferior.h
===================================================================
RCS file: /cvs/src/src/gdb/inferior.h,v
retrieving revision 1.3
diff -p -r1.3 inferior.h
*** inferior.h	2000/04/14 18:43:41	1.3
--- inferior.h	2000/04/17 03:57:15
*************** extern int attach_flag;
*** 426,454 ****
  #define CALL_DUMMY_STACK_ADJUST_P (0)
  #endif
  
  #if !defined (CALL_DUMMY_P)
  #if defined (CALL_DUMMY)
  #define CALL_DUMMY_P 1
  #else
  #define CALL_DUMMY_P 0
- #endif
- #endif
- 
- #if !defined (CALL_DUMMY_WORDS)
- #if defined (CALL_DUMMY)
- extern LONGEST call_dummy_words[];
- #define CALL_DUMMY_WORDS (call_dummy_words)
- #else
- #define CALL_DUMMY_WORDS (internal_error ("CALL_DUMMY_WORDS"), (void*) 0)
- #endif
- #endif
- 
- #if !defined (SIZEOF_CALL_DUMMY_WORDS)
- #if defined (CALL_DUMMY)
- extern int sizeof_call_dummy_words;
- #define SIZEOF_CALL_DUMMY_WORDS (sizeof_call_dummy_words)
- #else
- #define SIZEOF_CALL_DUMMY_WORDS (internal_error ("SIZEOF_CALL_DUMMY_WORDS"), 0)
  #endif
  #endif
  
--- 426,439 ----
  #define CALL_DUMMY_STACK_ADJUST_P (0)
  #endif
  
+ /* FIXME: cagney/2000-04-17: gdbarch should manage this.  The default
+    shouldn't be necessary. */
+ 
  #if !defined (CALL_DUMMY_P)
  #if defined (CALL_DUMMY)
  #define CALL_DUMMY_P 1
  #else
  #define CALL_DUMMY_P 0
  #endif
  #endif
  
Index: valprint.c
===================================================================
RCS file: /cvs/src/src/gdb/valprint.c,v
retrieving revision 1.3
diff -p -r1.3 valprint.c
*** valprint.c	2000/04/14 19:12:27	1.3
--- valprint.c	2000/04/17 03:57:17
*************** longest_to_int (arg)
*** 562,573 ****
  }
  
  
- /* Provide a default value for IEEE_FLOAT.  */
- #ifndef IEEE_FLOAT
- #define IEEE_FLOAT (0)
- #endif
- 
- 
  /* Print a floating point value of type TYPE, pointed to in GDB by VALADDR,
     on STREAM.  */
  
--- 562,567 ----

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