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]

[patch] Re-do gdbarch defaults


FYI,

The attatched re-does how the multi-arch code provides default values in
the non- multi-arch case.  It now directly #defines the value instead of
using the multi-arch framework (ulgh, macro's are bad... N'kay :-)

This lets me get the NPC_REGVAL multi-arched without breaking non-
multi-arch gdbserver.

	Andrew
Tue May  2 18:48:57 2000  Andrew Cagney  <cagney@b1.cygnus.com>

	* gdbarch.sh: Provide non- multi-arch defaults by direct
 	definition in "gdbarch.h" instead of going through "gdbarch.c".
	* gdbarch.h, gdbarch.c: Re-generate.
	* defs.h: When non- multi-arch, include "arch-utils.h" so that
 	legacy definitions are globally visible.
	
Index: defs.h
===================================================================
RCS file: /cvs/src/src/gdb/defs.h,v
retrieving revision 1.16
diff -p -r1.16 defs.h
*** defs.h	2000/05/01 05:45:36	1.16
--- defs.h	2000/05/02 08:54:24
*************** extern char *alloca ();
*** 984,989 ****
--- 984,995 ----
  
  /* Dynamic target-system-dependent parameters for GDB. */
  #include "gdbarch.h"
+ #if (GDB_MULTI_ARCH == 0)
+ /* Multi-arch targets _should_ be including "arch-utils.h" directly
+    into their *-tdep.c file.  This is a prop to help old non-
+    multi-arch targets to continue to compile. */
+ #include "arch-utils.h"
+ #endif
  
  /* Static target-system-dependent parameters for GDB. */
  
Index: gdbarch.sh
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.sh,v
retrieving revision 1.17
diff -p -r1.17 gdbarch.sh
*** gdbarch.sh	2000/04/29 08:55:45	1.17
--- gdbarch.sh	2000/05/02 08:54:26
*************** EOF
*** 351,356 ****
--- 351,357 ----
  	if class_is_predicate_p && default_is_fallback_p
  	then
  	    echo "Error: predicate function can not have a non- multi-arch default" 1>&2
+ 	    kill $$
  	    exit 1
  	fi
      done
*************** do
*** 468,476 ****
--- 469,483 ----
  	echo ""
  	echo "#if defined (${macro})"
  	echo "/* Legacy for systems yet to multi-arch ${macro} */"
+ #	echo "#if (GDB_MULTI_ARCH <= 2) && defined (${macro})"
  	echo "#define ${macro}_P() (1)"
  	echo "#endif"
  	echo ""
+ 	echo "/* Default predicate for non- multi-arch targets. */"
+ 	echo "#if (GDB_MULTI_ARCH == 0) && !defined (${macro}_P)"
+ 	echo "#define ${macro}_P() (0)"
+ 	echo "#endif"
+ 	echo ""
  	echo "extern int gdbarch_${function}_p (struct gdbarch *gdbarch);"
  	echo "#if (GDB_MULTI_ARCH > 1) || !defined (${macro}_P)"
  	echo "#define ${macro}_P() (gdbarch_${function}_p (current_gdbarch))"
*************** do
*** 478,500 ****
      fi
      if class_is_variable_p
      then
  	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 && ! class_is_predicate_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 && ! class_is_predicate_p
! 	then
! 	    echo "#endif"
! 	fi
      fi
      if class_is_function_p
      then
  	echo ""
  	echo "typedef ${returntype} (gdbarch_${function}_ftype) (${formal});"
  	if [ "${formal}" = "void" ]
--- 485,522 ----
      fi
      if class_is_variable_p
      then
+ 	if default_is_fallback_p || class_is_predicate_p
+ 	then
+ 	    echo ""
+ 	    echo "/* Default (value) for non- multi-arch platforms. */"
+ 	    echo "#if (GDB_MULTI_ARCH == 0) && !defined (${macro})"
+ 	    echo "#define ${macro} (${default})"
+ 	    echo "#endif"
+ 	fi
  	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"
      fi
      if class_is_function_p
      then
+ 	if default_is_fallback_p || class_is_predicate_p
+ 	then
+ 	    echo ""
+ 	    echo "/* Default (function) for non- multi-arch platforms. */"
+ 	    echo "#if (GDB_MULTI_ARCH == 0) && !defined (${macro})"
+ 	    if [ "${default}" = "0" ]
+ 	    then
+ 		echo "#define ${macro}(${actual}) (internal_error (\"${macro}\"), 0)"
+ 	    else
+ 		echo "#define ${macro}(${actual}) (${default} (${actual}))"
+ 	    fi
+ 	    echo "#endif"
+ 	fi
  	echo ""
  	echo "typedef ${returntype} (gdbarch_${function}_ftype) (${formal});"
  	if [ "${formal}" = "void" ]
*************** do
*** 504,513 ****
  	  echo "extern ${returntype} gdbarch_${function} (struct gdbarch *gdbarch, ${formal});"
  	fi
  	echo "extern void set_gdbarch_${function} (struct gdbarch *gdbarch, gdbarch_${function}_ftype *${function});"
! 	if ! default_is_fallback_p && ! class_is_predicate_p
! 	then
! 	    echo "#if GDB_MULTI_ARCH"
! 	fi
  	echo "#if (GDB_MULTI_ARCH > 1) || !defined (${macro})"
  	if [ "${actual}" = "" ]
  	then
--- 526,532 ----
  	  echo "extern ${returntype} gdbarch_${function} (struct gdbarch *gdbarch, ${formal});"
  	fi
  	echo "extern void set_gdbarch_${function} (struct gdbarch *gdbarch, gdbarch_${function}_ftype *${function});"
! 	echo "#if GDB_MULTI_ARCH"
  	echo "#if (GDB_MULTI_ARCH > 1) || !defined (${macro})"
  	if [ "${actual}" = "" ]
  	then
*************** do
*** 519,528 ****
  	  echo "#define ${macro}(${actual}) (gdbarch_${function} (current_gdbarch, ${actual}))"
  	fi
  	echo "#endif"
! 	if ! default_is_fallback_p && ! class_is_predicate_p
! 	then
! 	    echo "#endif"
! 	fi
      fi
  done
  
--- 538,544 ----
  	  echo "#define ${macro}(${actual}) (gdbarch_${function} (current_gdbarch, ${actual}))"
  	fi
  	echo "#endif"
! 	echo "#endif"
      fi
  done
  
*************** do
*** 1176,1194 ****
  	  echo "gdbarch_${function} (struct gdbarch *gdbarch, ${formal})"
  	fi
  	echo "{"
- 	if default_is_fallback_p && [ "${default}" != "0" ]
- 	then
- 	    echo "  if (GDB_MULTI_ARCH == 0)"
- 	    if [ "${returntype}" = "void" ]
- 	    then
- 		echo "    {"
- 		echo "      ${default} (${actual});"
- 		echo "      return;"
- 		echo "    }"
- 	    else
- 		echo "    return ${default} (${actual});"
- 	    fi
- 	fi
          echo "  if (gdbarch->${function} == 0)"
          echo "    internal_error (\"gdbarch: gdbarch_${function} invalid\");"
  	echo "  if (gdbarch_debug >= 2)"
--- 1192,1197 ----
*************** do
*** 1214,1224 ****
  	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 */"
--- 1217,1222 ----

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