This is the mail archive of the gdb-patches@sourceware.org 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]

[rfc] Add gdbarch to *_reg_to_regnum


Hi,

this patch adds gdbarch as parameter to the reg_to_regnum routines in gdbarch.c and the various
tdep-files and its callers.


This patch also consists of a mechanical change as preparation to get rid of current_gdbarch. In routines
with a lot of current_gdbarchs it introduces a new variable "struct gdbarch *gdbarch = current_gdbarch" and replaces
all the current_gdbarch's. In later patches gdbarch will be set properly (for example via objfile, macro replacement, ... ).
This patch replaces > 250 current_gdbarch's.

Tested on x86 and by gdb_mbuild. Ok to commit?

ChangeLog:

	* gdbarch.sh (stab_reg_to_regnum, dwarf_reg_to_regnum)
	( dwarf2_reg_to_regnum, sdb_reg_to_regnum, ecoff_reg_to_regnum): Add
	gdbarch as parameter.
	* gdbarch.{c,h}: Regenerate.

* stabsread.c (define_symbol): Introduce new gdbarch variable and replace current_gdbarch by gdbarch.
* somread.c (som_symtab_read): Likewise.
* coffread.c (coff_symtab_read, process_coff_symbol): Likewise.
* c-lang.c (c_create_fundamental_type): Likewise.
* f-lang.c (f_create_fundamental_type): Likewise.
* plang.c (pascal_create_fundamental_type): Likewise.
* m2-lang.c (m2_create_fundamental_type): Likewise.
* ada-lang.c (ensure_lval, ada_create_fundamental_type): Likewise.
* objc-lang.c (objc_create_fundamental_type): Likewise.
* dbxread.c (read_dbx_symtab, end_psymtab)
(process_one_symbol): Likewise.
* mdebugread.c (parse_symbol, parse_partial_symbols)
(_initialize_mdebugread): Likewise.
* hppa-tdep.c (internalize_unwinds)
(skip_prologue_hard_way): Likewise.
* remote-mips.c (mips_map_regno, mips_open): Likewise.
* remote-m32r-sdi.c (m32r_resume, m32r_wait): Likewise.
* printcmd.c (decode_format, address_info): Likewise.
* nto-tdep.c (nto_find_and_open_solib)
(nto_init_solib_absolute_prefix): Likewise.
* memattr.c (mem_info_command): Likewise.
* infrun.c (resume, handle_inferior_event)
(step_into_function): Likewise.
* amd64-nat.c (amd64_native_gregset_reg_offset): Likewise.
* doublest.c (floatformat_from_length): Likewise.
* dwarf2expr.c (execute_stack_op, dwarf2_read_address): Likewise.


	* xtensa-tdep.c (xtensa_reg_to_regnum): Add gdbarch as parameter.
	Replace current_gdbarch by gdbarch.
	* s390-tdep.c (s390_dwarf_reg_to_regnum): Likewise.
	* rs6000-tdep.c (rs6000_stab_reg_to_regnum)
	(rs6000_dwarf2_reg_to_regnum): Likewise.
	* mips-tdep.c (mips_stab_reg_to_regnum)
	(mips_dwarf_dwarf2_ecoff_reg_to_regnum): Likewise.
	* mep-tdep.c (mep_debug_reg_to_regnum): Likewise.
	* m32c-tdep.c (m32c_debug_info_reg_to_regnum): Likewise.
	* i386-tdep.c (i386_dbx_reg_to_regnum)
	(i386_svr4_reg_to_regnum): Likewise
	* h8300-tdep.c (h8300s_dbg_reg_to_regnum)
	(h8300_dbg_reg_to_regnum): Likewise.
	* amd64-tdep.c (amd64_dwarf_reg_to_regnum): Likewise.
	* arch-utils.c (no_op_reg_to_regnum): Likewise.
	* arch-utils.h (no_op_reg_to_regnum): Likewise.
	* arm-tdep.c (arm_dwarf_reg_to_regnum): Likewise.
	* cris-tdep.c (cris_dwarf2_reg_to_regnum): Likewise.
	* hppa-tdep.c (hppa64_dwarf_reg_to_regnum): Likewise.
	* ia64-tdep.c (ia64_dwarf_reg_to_regnum): Likewise.
	* m68k-tdep.c (m68k_dwarf_reg_to_regnum): Likewise.


-- Markus Deuling GNU Toolchain for Linux on Cell BE deuling@de.ibm.com

diff -urpN src/gdb/ada-lang.c dev/gdb/ada-lang.c
--- src/gdb/ada-lang.c	2007-11-02 20:34:11.000000000 +0100
+++ dev/gdb/ada-lang.c	2007-11-21 09:09:20.000000000 +0100
@@ -3624,6 +3624,7 @@ ada_simple_renamed_entity (struct symbol
 static struct value *
 ensure_lval (struct value *val, CORE_ADDR *sp)
 {
+  struct gdbarch *gdbarch = current_gdbarch;
   if (! VALUE_LVAL (val))
     {
       int len = TYPE_LENGTH (ada_check_typedef (value_type (val)));
@@ -3631,25 +3632,25 @@ ensure_lval (struct value *val, CORE_ADD
       /* The following is taken from the structure-return code in
 	 call_function_by_hand. FIXME: Therefore, some refactoring seems 
 	 indicated. */
-      if (gdbarch_inner_than (current_gdbarch, 1, 2))
+      if (gdbarch_inner_than (gdbarch, 1, 2))
 	{
 	  /* Stack grows downward.  Align SP and VALUE_ADDRESS (val) after
 	     reserving sufficient space. */
 	  *sp -= len;
-	  if (gdbarch_frame_align_p (current_gdbarch))
-	    *sp = gdbarch_frame_align (current_gdbarch, *sp);
+	  if (gdbarch_frame_align_p (gdbarch))
+	    *sp = gdbarch_frame_align (gdbarch, *sp);
 	  VALUE_ADDRESS (val) = *sp;
 	}
       else
 	{
 	  /* Stack grows upward.  Align the frame, allocate space, and
 	     then again, re-align the frame. */
-	  if (gdbarch_frame_align_p (current_gdbarch))
-	    *sp = gdbarch_frame_align (current_gdbarch, *sp);
+	  if (gdbarch_frame_align_p (gdbarch))
+	    *sp = gdbarch_frame_align (gdbarch, *sp);
 	  VALUE_ADDRESS (val) = *sp;
 	  *sp += len;
-	  if (gdbarch_frame_align_p (current_gdbarch))
-	    *sp = gdbarch_frame_align (current_gdbarch, *sp);
+	  if (gdbarch_frame_align_p (gdbarch))
+	    *sp = gdbarch_frame_align (gdbarch, *sp);
 	}
 
       write_memory (VALUE_ADDRESS (val), value_contents_raw (val), len);
@@ -10194,6 +10195,7 @@ static struct type *
 ada_create_fundamental_type (struct objfile *objfile, int typeid)
 {
   struct type *type = NULL;
+  struct gdbarch *gdbarch = current_gdbarch;
 
   switch (typeid)
     {
@@ -10203,7 +10205,7 @@ ada_create_fundamental_type (struct objf
          name "<?type?>".  When all the dust settles from the type
          reconstruction work, this should probably become an error.  */
       type = init_type (TYPE_CODE_INT,
-                        gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT,
+                        gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT,
                         0, "<?type?>", objfile);
       warning (_("internal error: no Ada fundamental type %d"), typeid);
       break;
@@ -10229,81 +10231,77 @@ ada_create_fundamental_type (struct objf
       break;
     case FT_SHORT:
       type = init_type (TYPE_CODE_INT,
-                        gdbarch_short_bit (current_gdbarch) / TARGET_CHAR_BIT,
+                        gdbarch_short_bit (gdbarch) / TARGET_CHAR_BIT,
                         0, "short_integer", objfile);
       break;
     case FT_SIGNED_SHORT:
       type = init_type (TYPE_CODE_INT,
-                        gdbarch_short_bit (current_gdbarch) / TARGET_CHAR_BIT,
+                        gdbarch_short_bit (gdbarch) / TARGET_CHAR_BIT,
                         0, "short_integer", objfile);
       break;
     case FT_UNSIGNED_SHORT:
       type = init_type (TYPE_CODE_INT,
-                        gdbarch_short_bit (current_gdbarch) / TARGET_CHAR_BIT,
+                        gdbarch_short_bit (gdbarch) / TARGET_CHAR_BIT,
                         TYPE_FLAG_UNSIGNED, "unsigned short", objfile);
       break;
     case FT_INTEGER:
       type = init_type (TYPE_CODE_INT,
-                        gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT,
+                        gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT,
                         0, "integer", objfile);
       break;
     case FT_SIGNED_INTEGER:
       type = init_type (TYPE_CODE_INT,
-			gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT,
+			gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT,
 			0, "integer", objfile);        /* FIXME -fnf */
       break;
     case FT_UNSIGNED_INTEGER:
       type = init_type (TYPE_CODE_INT,
-                        gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT,
+                        gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT,
                         TYPE_FLAG_UNSIGNED, "unsigned int", objfile);
       break;
     case FT_LONG:
       type = init_type (TYPE_CODE_INT,
-                        gdbarch_long_bit (current_gdbarch) / TARGET_CHAR_BIT,
+                        gdbarch_long_bit (gdbarch) / TARGET_CHAR_BIT,
                         0, "long_integer", objfile);
       break;
     case FT_SIGNED_LONG:
       type = init_type (TYPE_CODE_INT,
-                        gdbarch_long_bit (current_gdbarch) / TARGET_CHAR_BIT,
+                        gdbarch_long_bit (gdbarch) / TARGET_CHAR_BIT,
                         0, "long_integer", objfile);
       break;
     case FT_UNSIGNED_LONG:
       type = init_type (TYPE_CODE_INT,
-                        gdbarch_long_bit (current_gdbarch) / TARGET_CHAR_BIT,
+                        gdbarch_long_bit (gdbarch) / TARGET_CHAR_BIT,
                         TYPE_FLAG_UNSIGNED, "unsigned long", objfile);
       break;
     case FT_LONG_LONG:
       type = init_type (TYPE_CODE_INT,
-			gdbarch_long_long_bit (current_gdbarch)
-			  / TARGET_CHAR_BIT,
+			gdbarch_long_long_bit (gdbarch) / TARGET_CHAR_BIT,
 			0, "long_long_integer", objfile);
       break;
     case FT_SIGNED_LONG_LONG:
       type = init_type (TYPE_CODE_INT,
-			gdbarch_long_long_bit (current_gdbarch)
-			  / TARGET_CHAR_BIT,
+			gdbarch_long_long_bit (gdbarch) / TARGET_CHAR_BIT,
 			0, "long_long_integer", objfile);
       break;
     case FT_UNSIGNED_LONG_LONG:
       type = init_type (TYPE_CODE_INT,
-			gdbarch_long_long_bit (current_gdbarch)
-			  / TARGET_CHAR_BIT,
+			gdbarch_long_long_bit (gdbarch) / TARGET_CHAR_BIT,
 			TYPE_FLAG_UNSIGNED, "unsigned long long", objfile);
       break;
     case FT_FLOAT:
       type = init_type (TYPE_CODE_FLT,
-                        gdbarch_float_bit (current_gdbarch) / TARGET_CHAR_BIT,
+                        gdbarch_float_bit (gdbarch) / TARGET_CHAR_BIT,
                         0, "float", objfile);
       break;
     case FT_DBL_PREC_FLOAT:
       type = init_type (TYPE_CODE_FLT,
-                        gdbarch_double_bit (current_gdbarch) / TARGET_CHAR_BIT,
+                        gdbarch_double_bit (gdbarch) / TARGET_CHAR_BIT,
                         0, "long_float", objfile);
       break;
     case FT_EXT_PREC_FLOAT:
       type = init_type (TYPE_CODE_FLT,
-                        gdbarch_long_double_bit (current_gdbarch)
-			  / TARGET_CHAR_BIT,
+                        gdbarch_long_double_bit (gdbarch) / TARGET_CHAR_BIT,
                         0, "long_long_float", objfile);
       break;
     }
diff -urpN src/gdb/amd64-nat.c dev/gdb/amd64-nat.c
--- src/gdb/amd64-nat.c	2007-10-08 14:48:05.000000000 +0200
+++ dev/gdb/amd64-nat.c	2007-11-21 10:06:36.000000000 +0100
@@ -55,19 +55,20 @@ amd64_native_gregset_reg_offset (int reg
 {
   int *reg_offset = amd64_native_gregset64_reg_offset;
   int num_regs = amd64_native_gregset64_num_regs;
+  struct gdbarch *gdbarch = current_gdbarch;
 
   gdb_assert (regnum >= 0);
 
-  if (gdbarch_ptr_bit (current_gdbarch) == 32)
+  if (gdbarch_ptr_bit (gdbarch) == 32)
     {
       reg_offset = amd64_native_gregset32_reg_offset;
       num_regs = amd64_native_gregset32_num_regs;
     }
 
-  if (num_regs > gdbarch_num_regs (current_gdbarch))
-    num_regs = gdbarch_num_regs (current_gdbarch);
+  if (num_regs > gdbarch_num_regs (gdbarch))
+    num_regs = gdbarch_num_regs (gdbarch);
 
-  if (regnum < num_regs && regnum < gdbarch_num_regs (current_gdbarch))
+  if (regnum < num_regs && regnum < gdbarch_num_regs (gdbarch))
     return reg_offset[regnum];
 
   return -1;
diff -urpN src/gdb/amd64-tdep.c dev/gdb/amd64-tdep.c
--- src/gdb/amd64-tdep.c	2007-11-02 15:27:13.000000000 +0100
+++ dev/gdb/amd64-tdep.c	2007-11-21 08:57:31.000000000 +0100
@@ -187,7 +187,7 @@ static const int amd64_dwarf_regmap_len 
    number used by GDB.  */
 
 static int
-amd64_dwarf_reg_to_regnum (int reg)
+amd64_dwarf_reg_to_regnum (struct gdbarch *gdbarch, int reg)
 {
   int regnum = -1;
 
diff -urpN src/gdb/arch-utils.c dev/gdb/arch-utils.c
--- src/gdb/arch-utils.c	2007-11-19 06:05:28.000000000 +0100
+++ dev/gdb/arch-utils.c	2007-11-21 10:21:40.000000000 +0100
@@ -107,7 +107,7 @@ convert_from_func_ptr_addr_identity (str
 }
 
 int
-no_op_reg_to_regnum (int reg)
+no_op_reg_to_regnum (struct gdbarch *gdbarch, int reg)
 {
   return reg;
 }
diff -urpN src/gdb/arch-utils.h dev/gdb/arch-utils.h
--- src/gdb/arch-utils.h	2007-11-19 06:05:28.000000000 +0100
+++ dev/gdb/arch-utils.h	2007-11-21 10:22:25.000000000 +0100
@@ -41,7 +41,7 @@ extern gdbarch_convert_from_func_ptr_add
 
 /* No-op conversion of reg to regnum. */
 
-extern int no_op_reg_to_regnum (int reg);
+extern int no_op_reg_to_regnum (struct gdbarch *gdbarch, int reg);
 
 /* Do nothing version of elf_make_msymbol_special. */
 
diff -urpN src/gdb/c-lang.c dev/gdb/c-lang.c
--- src/gdb/c-lang.c	2007-11-02 20:34:11.000000000 +0100
+++ dev/gdb/c-lang.c	2007-11-21 09:03:59.000000000 +0100
@@ -208,6 +208,7 @@ struct type *
 c_create_fundamental_type (struct objfile *objfile, int typeid)
 {
   struct type *type = NULL;
+  struct gdbarch *gdbarch = current_gdbarch;
 
   switch (typeid)
     {
@@ -217,7 +218,7 @@ c_create_fundamental_type (struct objfil
          name "<?type?>".  When all the dust settles from the type
          reconstruction work, this should probably become an error. */
       type = init_type (TYPE_CODE_INT,
-			gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT,
+			gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT,
 			0, "<?type?>", objfile);
       warning (_("internal error: no C/C++ fundamental type %d"), typeid);
       break;
@@ -248,81 +249,78 @@ c_create_fundamental_type (struct objfil
       break;
     case FT_SHORT:
       type = init_type (TYPE_CODE_INT,
-			gdbarch_short_bit (current_gdbarch) / TARGET_CHAR_BIT,
+			gdbarch_short_bit (gdbarch) / TARGET_CHAR_BIT,
 			0, "short", objfile);
       break;
     case FT_SIGNED_SHORT:
       type = init_type (TYPE_CODE_INT,
-			gdbarch_short_bit (current_gdbarch) / TARGET_CHAR_BIT,
+			gdbarch_short_bit (gdbarch) / TARGET_CHAR_BIT,
 			0, "short", objfile);	/* FIXME-fnf */
       break;
     case FT_UNSIGNED_SHORT:
       type = init_type (TYPE_CODE_INT,
-			gdbarch_short_bit (current_gdbarch) / TARGET_CHAR_BIT,
+			gdbarch_short_bit (gdbarch) / TARGET_CHAR_BIT,
 			TYPE_FLAG_UNSIGNED, "unsigned short", objfile);
       break;
     case FT_INTEGER:
       type = init_type (TYPE_CODE_INT,
-			gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT,
+			gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT,
 			0, "int", objfile);
       break;
     case FT_SIGNED_INTEGER:
       type = init_type (TYPE_CODE_INT,
-			gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT,
+			gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT,
 			0, "int", objfile);	/* FIXME -fnf */
       break;
     case FT_UNSIGNED_INTEGER:
       type = init_type (TYPE_CODE_INT,
-			gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT,
+			gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT,
 			TYPE_FLAG_UNSIGNED, "unsigned int", objfile);
       break;
     case FT_LONG:
       type = init_type (TYPE_CODE_INT,
-			gdbarch_long_bit (current_gdbarch) / TARGET_CHAR_BIT,
+			gdbarch_long_bit (gdbarch) / TARGET_CHAR_BIT,
 			0, "long", objfile);
       break;
     case FT_SIGNED_LONG:
       type = init_type (TYPE_CODE_INT,
-			gdbarch_long_bit (current_gdbarch) / TARGET_CHAR_BIT,
+			gdbarch_long_bit (gdbarch) / TARGET_CHAR_BIT,
 			0, "long", objfile);	/* FIXME -fnf */
       break;
     case FT_UNSIGNED_LONG:
       type = init_type (TYPE_CODE_INT,
-			gdbarch_long_bit (current_gdbarch) / TARGET_CHAR_BIT,
+			gdbarch_long_bit (gdbarch) / TARGET_CHAR_BIT,
 			TYPE_FLAG_UNSIGNED, "unsigned long", objfile);
       break;
     case FT_LONG_LONG:
       type = init_type (TYPE_CODE_INT,
-			gdbarch_long_long_bit (current_gdbarch) 
+			gdbarch_long_long_bit (gdbarch) 
 			  / TARGET_CHAR_BIT,
 			0, "long long", objfile);
       break;
     case FT_SIGNED_LONG_LONG:
       type = init_type (TYPE_CODE_INT,
-			gdbarch_long_long_bit (current_gdbarch) 
-			  / TARGET_CHAR_BIT,
+			gdbarch_long_long_bit (gdbarch) / TARGET_CHAR_BIT,
 			0, "signed long long", objfile);
       break;
     case FT_UNSIGNED_LONG_LONG:
       type = init_type (TYPE_CODE_INT,
-			gdbarch_long_long_bit (current_gdbarch) 
-			  / TARGET_CHAR_BIT,
+			gdbarch_long_long_bit (gdbarch) / TARGET_CHAR_BIT,
 			TYPE_FLAG_UNSIGNED, "unsigned long long", objfile);
       break;
     case FT_FLOAT:
       type = init_type (TYPE_CODE_FLT,
-			gdbarch_float_bit (current_gdbarch) / TARGET_CHAR_BIT,
+			gdbarch_float_bit (gdbarch) / TARGET_CHAR_BIT,
 			0, "float", objfile);
       break;
     case FT_DBL_PREC_FLOAT:
       type = init_type (TYPE_CODE_FLT,
-			gdbarch_double_bit (current_gdbarch) / TARGET_CHAR_BIT,
+			gdbarch_double_bit (gdbarch) / TARGET_CHAR_BIT,
 			0, "double", objfile);
       break;
     case FT_EXT_PREC_FLOAT:
       type = init_type (TYPE_CODE_FLT,
-			gdbarch_long_double_bit (current_gdbarch)
-			  / TARGET_CHAR_BIT,
+			gdbarch_long_double_bit (gdbarch) / TARGET_CHAR_BIT,
 			0, "long double", objfile);
       break;
     case FT_DECFLOAT:
@@ -342,33 +340,30 @@ c_create_fundamental_type (struct objfil
       break;
     case FT_COMPLEX:
       type = init_type (TYPE_CODE_FLT,
-			2 * gdbarch_float_bit (current_gdbarch)
-			  / TARGET_CHAR_BIT,
+			2 * gdbarch_float_bit (gdbarch) / TARGET_CHAR_BIT,
 			0, "complex float", objfile);
       TYPE_TARGET_TYPE (type)
 	= init_type (TYPE_CODE_FLT,
-		     gdbarch_float_bit (current_gdbarch) / TARGET_CHAR_BIT,
+		     gdbarch_float_bit (gdbarch) / TARGET_CHAR_BIT,
 		     0, "float", objfile);
       break;
     case FT_DBL_PREC_COMPLEX:
       type = init_type (TYPE_CODE_FLT,
-			2 * gdbarch_double_bit (current_gdbarch)
-			  / TARGET_CHAR_BIT,
+			2 * gdbarch_double_bit (gdbarch) / TARGET_CHAR_BIT,
 			0, "complex double", objfile);
       TYPE_TARGET_TYPE (type)
 	= init_type (TYPE_CODE_FLT,
-		     gdbarch_double_bit (current_gdbarch) / TARGET_CHAR_BIT,
+		     gdbarch_double_bit (gdbarch) / TARGET_CHAR_BIT,
 		     0, "double", objfile);
       break;
     case FT_EXT_PREC_COMPLEX:
       type = init_type (TYPE_CODE_FLT,
-			2 * gdbarch_long_double_bit (current_gdbarch)
+			2 * gdbarch_long_double_bit (gdbarch)
 			  / TARGET_CHAR_BIT,
 			0, "complex long double", objfile);
       TYPE_TARGET_TYPE (type)
 	= init_type (TYPE_CODE_FLT,
-		     gdbarch_long_double_bit (current_gdbarch)
-		       / TARGET_CHAR_BIT,
+		     gdbarch_long_double_bit (gdbarch) / TARGET_CHAR_BIT,
 		     0, "long double", objfile);
       break;
     case FT_TEMPLATE_ARG:
diff -urpN src/gdb/coffread.c dev/gdb/coffread.c
--- src/gdb/coffread.c	2007-10-22 03:16:34.000000000 +0200
+++ dev/gdb/coffread.c	2007-11-21 09:01:23.000000000 +0100
@@ -702,6 +702,7 @@ coff_symtab_read (long symtab_offset, un
   int val;
   CORE_ADDR tmpaddr;
   struct minimal_symbol *msym;
+  struct gdbarch *gdbarch = current_gdbarch;
 
   /* Work around a stdio bug in SunOS4.1.1 (this makes me nervous....
      it's hard to know I've really worked around it.  The fix should be
@@ -911,7 +912,7 @@ coff_symtab_read (long symtab_offset, un
 		      || cs->c_sclass == C_THUMBEXT ?
 		      mst_text : mst_file_text;
 		    tmpaddr = gdbarch_smash_text_address
-				(current_gdbarch, tmpaddr);
+				(gdbarch, tmpaddr);
 		  }
 		else if (bfd_section->flags & SEC_ALLOC
 			 && bfd_section->flags & SEC_LOAD)
@@ -933,7 +934,7 @@ coff_symtab_read (long symtab_offset, un
 	    msym = record_minimal_symbol (cs, tmpaddr, ms_type, sec, objfile);
 	    if (msym)
 	      gdbarch_coff_make_msymbol_special
-	      (current_gdbarch, cs->c_sclass, msym);
+	      (gdbarch, cs->c_sclass, msym);
 
 	    if (SDB_TYPE (cs->c_type))
 	      {
@@ -1487,6 +1488,7 @@ process_coff_symbol (struct coff_symbol 
   = (struct symbol *) obstack_alloc (&objfile->objfile_obstack,
 				     sizeof (struct symbol));
   char *name;
+  struct gdbarch *gdbarch = current_gdbarch;
 
   memset (sym, 0, sizeof (struct symbol));
   name = cs->c_name;
@@ -1559,7 +1561,7 @@ process_coff_symbol (struct coff_symbol 
 	case C_REG:
 	  SYMBOL_CLASS (sym) = LOC_REGISTER;
 	  SYMBOL_VALUE (sym) = gdbarch_sdb_reg_to_regnum
-				 (current_gdbarch, cs->c_value);
+				 (gdbarch, cs->c_value);
 	  add_symbol_to_list (sym, &local_symbols);
 	  break;
 
@@ -1575,7 +1577,7 @@ process_coff_symbol (struct coff_symbol 
 	case C_REGPARM:
 	  SYMBOL_CLASS (sym) = LOC_REGPARM;
 	  SYMBOL_VALUE (sym) = gdbarch_sdb_reg_to_regnum
-				 (current_gdbarch, cs->c_value);
+				 (gdbarch, cs->c_value);
 	  add_symbol_to_list (sym, &local_symbols);
 	  break;
 
diff -urpN src/gdb/dbxread.c dev/gdb/dbxread.c
--- src/gdb/dbxread.c	2007-10-19 14:26:31.000000000 +0200
+++ dev/gdb/dbxread.c	2007-11-21 09:18:27.000000000 +0100
@@ -1174,6 +1174,7 @@ function_outside_compilation_unit_compla
 static void
 read_dbx_symtab (struct objfile *objfile)
 {
+  struct gdbarch *gdbarch = current_gdbarch;
   struct external_nlist *bufp = 0;	/* =0 avoids gcc -Wall glitch */
   struct internal_nlist nlist;
   CORE_ADDR text_addr;
@@ -1466,7 +1467,7 @@ read_dbx_symtab (struct objfile *objfile
 	       don't relocate it.  */
 
 	    if (nlist.n_value == 0
-		&& gdbarch_sofun_address_maybe_missing (current_gdbarch))
+		&& gdbarch_sofun_address_maybe_missing (gdbarch))
 	      {
 		textlow_not_set = 1;
 		valu = 0;
@@ -1677,9 +1678,9 @@ read_dbx_symtab (struct objfile *objfile
 	  case 'S':
 	    nlist.n_value += ANOFFSET (objfile->section_offsets, data_sect_index);
 
-	    if (gdbarch_static_transform_name_p (current_gdbarch))
+	    if (gdbarch_static_transform_name_p (gdbarch))
 	      namestring = gdbarch_static_transform_name
-			     (current_gdbarch, namestring);
+			     (gdbarch, namestring);
 
 	    add_psymbol_to_list (namestring, p - namestring,
 				 VAR_DOMAIN, LOC_STATIC,
@@ -1832,7 +1833,7 @@ read_dbx_symtab (struct objfile *objfile
 	       value for the bottom of the text seg in those cases. */
 	    if (nlist.n_value == ANOFFSET (objfile->section_offsets, 
 					   SECT_OFF_TEXT (objfile))
-		&& gdbarch_sofun_address_maybe_missing (current_gdbarch))
+		&& gdbarch_sofun_address_maybe_missing (gdbarch))
 	      {
 		CORE_ADDR minsym_valu = 
 		  find_stab_function_addr (namestring, 
@@ -1847,7 +1848,7 @@ read_dbx_symtab (struct objfile *objfile
 		  nlist.n_value = minsym_valu;
 	      }
 	    if (pst && textlow_not_set
-		&& gdbarch_sofun_address_maybe_missing (current_gdbarch))
+		&& gdbarch_sofun_address_maybe_missing (gdbarch))
 	      {
 		pst->textlow = nlist.n_value;
 		textlow_not_set = 0;
@@ -1900,7 +1901,7 @@ read_dbx_symtab (struct objfile *objfile
 	       value for the bottom of the text seg in those cases. */
 	    if (nlist.n_value == ANOFFSET (objfile->section_offsets, 
 					   SECT_OFF_TEXT (objfile))
-		&& gdbarch_sofun_address_maybe_missing (current_gdbarch))
+		&& gdbarch_sofun_address_maybe_missing (gdbarch))
 	      {
 		CORE_ADDR minsym_valu = 
 		  find_stab_function_addr (namestring, 
@@ -1915,7 +1916,7 @@ read_dbx_symtab (struct objfile *objfile
 		  nlist.n_value = minsym_valu;
 	      }
 	    if (pst && textlow_not_set
-		&& gdbarch_sofun_address_maybe_missing (current_gdbarch))
+		&& gdbarch_sofun_address_maybe_missing (gdbarch))
 	      {
 		pst->textlow = nlist.n_value;
 		textlow_not_set = 0;
@@ -2049,7 +2050,7 @@ read_dbx_symtab (struct objfile *objfile
 	     end_psymtab will set pst->texthigh to the proper value, which
 	     is necessary if a module compiled without debugging info
 	     follows this module.  */
-	  if (pst && gdbarch_sofun_address_maybe_missing (current_gdbarch))
+	  if (pst && gdbarch_sofun_address_maybe_missing (gdbarch))
 	  {
 	    end_psymtab (pst, psymtab_include_list, includes_used,
 			 symnum * symbol_size,
@@ -2175,6 +2176,7 @@ end_psymtab (struct partial_symtab *pst,
 {
   int i;
   struct objfile *objfile = pst->objfile;
+  struct gdbarch *gdbarch = current_gdbarch;
 
   if (capping_symbol_offset != -1)
     LDSYMLEN (pst) = capping_symbol_offset - LDSYMOFF (pst);
@@ -2196,7 +2198,7 @@ end_psymtab (struct partial_symtab *pst,
      last function in the file.  */
 
   if (pst->texthigh == 0 && last_function_name
-      && gdbarch_sofun_address_maybe_missing (current_gdbarch))
+      && gdbarch_sofun_address_maybe_missing (gdbarch))
     {
       char *p;
       int n;
@@ -2227,7 +2229,7 @@ end_psymtab (struct partial_symtab *pst,
       last_function_name = NULL;
     }
 
-  if (!gdbarch_sofun_address_maybe_missing (current_gdbarch))
+  if (!gdbarch_sofun_address_maybe_missing (gdbarch))
     ;
   /* this test will be true if the last .o file is only data */
   else if (textlow_not_set)
@@ -2651,6 +2653,7 @@ process_one_symbol (int type, int desc, 
 		    struct section_offsets *section_offsets,
 		    struct objfile *objfile)
 {
+  struct gdbarch *gdbarch = current_gdbarch;
   struct context_stack *new;
   /* This remembers the address of the start of a function.  It is
      used because in Solaris 2, N_LBRAC, N_RBRAC, and N_SLINE entries
@@ -2741,7 +2744,7 @@ process_one_symbol (int type, int desc, 
 
       /* Relocate for dynamic loading.  */
       valu += ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile));
-      valu = gdbarch_smash_text_address (current_gdbarch, valu);
+      valu = gdbarch_smash_text_address (gdbarch, valu);
       last_function_start = valu;
 
       goto define_a_symbol;
@@ -3081,7 +3084,7 @@ no enclosing block"));
 	      if (type == N_FUN
 		  && valu == ANOFFSET (section_offsets,
 				       SECT_OFF_TEXT (objfile))
-		  && gdbarch_sofun_address_maybe_missing (current_gdbarch))
+		  && gdbarch_sofun_address_maybe_missing (gdbarch))
 		{
 		  CORE_ADDR minsym_valu = 
 		    find_stab_function_addr (name, last_source_file, objfile);
diff -urpN src/gdb/doublest.c dev/gdb/doublest.c
--- src/gdb/doublest.c	2007-11-08 01:08:46.000000000 +0100
+++ dev/gdb/doublest.c	2007-11-21 10:12:02.000000000 +0100
@@ -764,24 +764,24 @@ static const struct floatformat *
 floatformat_from_length (int len)
 {
   const struct floatformat *format;
-  if (len * TARGET_CHAR_BIT == gdbarch_float_bit (current_gdbarch))
-    format = gdbarch_float_format (current_gdbarch)
-	       [gdbarch_byte_order (current_gdbarch)];
-  else if (len * TARGET_CHAR_BIT == gdbarch_double_bit (current_gdbarch))
-    format = gdbarch_double_format (current_gdbarch)
-	       [gdbarch_byte_order (current_gdbarch)];
-  else if (len * TARGET_CHAR_BIT == gdbarch_long_double_bit (current_gdbarch))
-    format = gdbarch_long_double_format (current_gdbarch)
-	       [gdbarch_byte_order (current_gdbarch)];
+  struct gdbarch *gdbarch = current_gdbarch;
+
+  if (len * TARGET_CHAR_BIT == gdbarch_float_bit (gdbarch))
+    format = gdbarch_float_format (gdbarch) [gdbarch_byte_order (gdbarch)];
+  else if (len * TARGET_CHAR_BIT == gdbarch_double_bit (gdbarch))
+    format = gdbarch_double_format (gdbarch) [gdbarch_byte_order (gdbarch)];
+  else if (len * TARGET_CHAR_BIT == gdbarch_long_double_bit (gdbarch))
+    format = gdbarch_long_double_format (gdbarch)
+	       [gdbarch_byte_order (gdbarch)];
   /* On i386 the 'long double' type takes 96 bits,
      while the real number of used bits is only 80,
      both in processor and in memory.  
      The code below accepts the real bit size.  */ 
-  else if ((gdbarch_long_double_format (current_gdbarch) != NULL) 
+  else if ((gdbarch_long_double_format (gdbarch) != NULL) 
 	   && (len * TARGET_CHAR_BIT ==
-               gdbarch_long_double_format (current_gdbarch)[0]->totalsize))
-    format = gdbarch_long_double_format (current_gdbarch)
-	       [gdbarch_byte_order (current_gdbarch)];
+               gdbarch_long_double_format (gdbarch)[0]->totalsize))
+    format = gdbarch_long_double_format (gdbarch)
+	       [gdbarch_byte_order (gdbarch)];
   else
     format = NULL;
   if (format == NULL)
diff -urpN src/gdb/dwarf2expr.c dev/gdb/dwarf2expr.c
--- src/gdb/dwarf2expr.c	2007-08-23 20:08:28.000000000 +0200
+++ dev/gdb/dwarf2expr.c	2007-11-21 10:11:08.000000000 +0100
@@ -198,12 +198,13 @@ read_sleb128 (gdb_byte *buf, gdb_byte *b
 CORE_ADDR
 dwarf2_read_address (gdb_byte *buf, gdb_byte *buf_end, int *bytes_read)
 {
+  struct gdbarch *gdbarch = current_gdbarch;
   CORE_ADDR result;
 
-  if (buf_end - buf < gdbarch_addr_bit (current_gdbarch) / TARGET_CHAR_BIT)
+  if (buf_end - buf < gdbarch_addr_bit (gdbarch) / TARGET_CHAR_BIT)
     error (_("dwarf2_read_address: Corrupted DWARF expression."));
 
-  *bytes_read = gdbarch_addr_bit (current_gdbarch) / TARGET_CHAR_BIT;
+  *bytes_read = gdbarch_addr_bit (gdbarch) / TARGET_CHAR_BIT;
 
   /* For most architectures, calling extract_unsigned_integer() alone
      is sufficient for extracting an address.  However, some
@@ -231,7 +232,7 @@ dwarf2_read_address (gdb_byte *buf, gdb_
 			      (unsigned_address_type (),
 			       extract_unsigned_integer 
 				 (buf,
-				  gdbarch_addr_bit (current_gdbarch)
+				  gdbarch_addr_bit (gdbarch)
 				    / TARGET_CHAR_BIT)));
 
   return result;
@@ -282,6 +283,8 @@ static void
 execute_stack_op (struct dwarf_expr_context *ctx,
 		  gdb_byte *op_ptr, gdb_byte *op_end)
 {
+  struct gdbarch *gdbarch = current_gdbarch;
+
   ctx->in_reg = 0;
   ctx->initialized = 1;  /* Default is initialized.  */
 
@@ -549,16 +552,15 @@ execute_stack_op (struct dwarf_expr_cont
 	    {
 	    case DW_OP_deref:
 	      {
-		gdb_byte *buf = alloca (gdbarch_addr_bit (current_gdbarch)
+		gdb_byte *buf = alloca (gdbarch_addr_bit (gdbarch)
 					  / TARGET_CHAR_BIT);
 		int bytes_read;
 
 		(ctx->read_mem) (ctx->baton, buf, result,
-				 gdbarch_addr_bit (current_gdbarch)
-				   / TARGET_CHAR_BIT);
+				 gdbarch_addr_bit (gdbarch) / TARGET_CHAR_BIT);
 		result = dwarf2_read_address (buf,
 					      buf + (gdbarch_addr_bit
-						       (current_gdbarch)
+						       (gdbarch)
 						     / TARGET_CHAR_BIT),
 					      &bytes_read);
 	      }
@@ -567,14 +569,13 @@ execute_stack_op (struct dwarf_expr_cont
 	    case DW_OP_deref_size:
 	      {
 		gdb_byte *buf
-		   = alloca (gdbarch_addr_bit (current_gdbarch)
-			      / TARGET_CHAR_BIT);
+		   = alloca (gdbarch_addr_bit (gdbarch) / TARGET_CHAR_BIT);
 		int bytes_read;
 
 		(ctx->read_mem) (ctx->baton, buf, result, *op_ptr++);
 		result = dwarf2_read_address (buf,
 					      buf + (gdbarch_addr_bit
-						      (current_gdbarch)
+						      (gdbarch)
 						     / TARGET_CHAR_BIT),
 					      &bytes_read);
 	      }
diff -urpN src/gdb/f-lang.c dev/gdb/f-lang.c
--- src/gdb/f-lang.c	2007-11-02 20:34:11.000000000 +0100
+++ dev/gdb/f-lang.c	2007-11-21 09:05:28.000000000 +0100
@@ -232,6 +232,7 @@ static struct type *
 f_create_fundamental_type (struct objfile *objfile, int typeid)
 {
   struct type *type = NULL;
+  struct gdbarch *gdbarch = current_gdbarch;
 
   switch (typeid)
     {
@@ -267,109 +268,105 @@ f_create_fundamental_type (struct objfil
       break;
     case FT_SHORT:
       type = init_type (TYPE_CODE_INT,
-			gdbarch_short_bit (current_gdbarch) / TARGET_CHAR_BIT,
+			gdbarch_short_bit (gdbarch) / TARGET_CHAR_BIT,
 			0, "integer*2", objfile);
       break;
     case FT_SIGNED_SHORT:
       type = init_type (TYPE_CODE_INT,
-			gdbarch_short_bit (current_gdbarch) / TARGET_CHAR_BIT,
+			gdbarch_short_bit (gdbarch) / TARGET_CHAR_BIT,
 			0, "short", objfile);	/* FIXME-fnf */
       break;
     case FT_UNSIGNED_SHORT:
       type = init_type (TYPE_CODE_BOOL,
-			gdbarch_short_bit (current_gdbarch) / TARGET_CHAR_BIT,
+			gdbarch_short_bit (gdbarch) / TARGET_CHAR_BIT,
 			TYPE_FLAG_UNSIGNED, "logical*2", objfile);
       break;
     case FT_INTEGER:
       type = init_type (TYPE_CODE_INT,
-			gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT,
+			gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT,
 			0, "integer*4", objfile);
       break;
     case FT_SIGNED_INTEGER:
       type = init_type (TYPE_CODE_INT,
-			gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT,
+			gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT,
 			0, "integer", objfile);		/* FIXME -fnf */
       break;
     case FT_UNSIGNED_INTEGER:
       type = init_type (TYPE_CODE_BOOL,
-			gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT,
+			gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT,
 			TYPE_FLAG_UNSIGNED, "logical*4", objfile);
       break;
     case FT_FIXED_DECIMAL:
       type = init_type (TYPE_CODE_INT,
-			gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT,
+			gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT,
 			0, "fixed decimal", objfile);
       break;
     case FT_LONG:
       type = init_type (TYPE_CODE_INT,
-			gdbarch_long_bit (current_gdbarch) / TARGET_CHAR_BIT,
+			gdbarch_long_bit (gdbarch) / TARGET_CHAR_BIT,
 			0, "long", objfile);
       break;
     case FT_SIGNED_LONG:
       type = init_type (TYPE_CODE_INT,
-			gdbarch_long_bit (current_gdbarch) / TARGET_CHAR_BIT,
+			gdbarch_long_bit (gdbarch) / TARGET_CHAR_BIT,
 			0, "long", objfile);	/* FIXME -fnf */
       break;
     case FT_UNSIGNED_LONG:
       type = init_type (TYPE_CODE_INT,
-			gdbarch_long_bit (current_gdbarch) / TARGET_CHAR_BIT,
+			gdbarch_long_bit (gdbarch) / TARGET_CHAR_BIT,
 			TYPE_FLAG_UNSIGNED, "unsigned long", objfile);
       break;
     case FT_LONG_LONG:
       type = init_type (TYPE_CODE_INT,
-			gdbarch_long_long_bit (current_gdbarch) 
+			gdbarch_long_long_bit (gdbarch) 
 			 / TARGET_CHAR_BIT,
 			0, "long long", objfile);
       break;
     case FT_SIGNED_LONG_LONG:
       type = init_type (TYPE_CODE_INT,
-			gdbarch_long_long_bit (current_gdbarch) 
-			 / TARGET_CHAR_BIT,
+			gdbarch_long_long_bit (gdbarch) / TARGET_CHAR_BIT,
 			0, "signed long long", objfile);
       break;
     case FT_UNSIGNED_LONG_LONG:
       type = init_type (TYPE_CODE_INT,
-			gdbarch_long_long_bit (current_gdbarch) 
-			 / TARGET_CHAR_BIT,
+			gdbarch_long_long_bit (gdbarch) / TARGET_CHAR_BIT,
 			TYPE_FLAG_UNSIGNED, "unsigned long long", objfile);
       break;
     case FT_FLOAT:
       type = init_type (TYPE_CODE_FLT,
-			gdbarch_float_bit (current_gdbarch) / TARGET_CHAR_BIT,
+			gdbarch_float_bit (gdbarch) / TARGET_CHAR_BIT,
 			0, "real", objfile);
       break;
     case FT_DBL_PREC_FLOAT:
       type = init_type (TYPE_CODE_FLT,
-			gdbarch_double_bit (current_gdbarch) / TARGET_CHAR_BIT,
+			gdbarch_double_bit (gdbarch) / TARGET_CHAR_BIT,
 			0, "real*8", objfile);
       break;
     case FT_FLOAT_DECIMAL:
       type = init_type (TYPE_CODE_FLT,
-			gdbarch_double_bit (current_gdbarch) / TARGET_CHAR_BIT,
+			gdbarch_double_bit (gdbarch) / TARGET_CHAR_BIT,
 			0, "floating decimal", objfile);
       break;
     case FT_EXT_PREC_FLOAT:
       type = init_type (TYPE_CODE_FLT,
-			gdbarch_long_double_bit (current_gdbarch)
-			  / TARGET_CHAR_BIT,
+			gdbarch_long_double_bit (gdbarch) / TARGET_CHAR_BIT,
 			0, "real*16", objfile);
       break;
     case FT_COMPLEX:
       type = init_type (TYPE_CODE_COMPLEX,
-			2 * gdbarch_float_bit (current_gdbarch) / TARGET_CHAR_BIT,
+			2 * gdbarch_float_bit (gdbarch) / TARGET_CHAR_BIT,
 			0, "complex*8", objfile);
       TYPE_TARGET_TYPE (type) = builtin_type_f_real;
       break;
     case FT_DBL_PREC_COMPLEX:
       type = init_type (TYPE_CODE_COMPLEX,
-			2 * gdbarch_double_bit (current_gdbarch)
-			  / TARGET_CHAR_BIT,
+			2 * gdbarch_double_bit (gdbarch) / TARGET_CHAR_BIT,
 			0, "complex*16", objfile);
       TYPE_TARGET_TYPE (type) = builtin_type_f_real_s8;
       break;
     case FT_EXT_PREC_COMPLEX:
       type = init_type (TYPE_CODE_COMPLEX,
-			2 * gdbarch_long_double_bit (current_gdbarch)
+			2 * gdbarch_long_double_bit (gdbarch)
 			  / TARGET_CHAR_BIT,
 			0, "complex*32", objfile);
       TYPE_TARGET_TYPE (type) = builtin_type_f_real_s16;
@@ -380,7 +377,7 @@ f_create_fundamental_type (struct objfil
          name "<?type?>".  When all the dust settles from the type
          reconstruction work, this should probably become an error. */
       type = init_type (TYPE_CODE_INT,
-			gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT,
+			gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT,
 			0, "<?type?>", objfile);
       warning (_("internal error: no F77 fundamental type %d"), typeid);
       break;
diff -urpN src/gdb/gdbarch.c dev/gdb/gdbarch.c
--- src/gdb/gdbarch.c	2007-11-19 06:05:28.000000000 +0100
+++ dev/gdb/gdbarch.c	2007-11-21 08:32:55.000000000 +0100
@@ -275,11 +275,11 @@ struct gdbarch startup_gdbarch =
   -1,  /* pc_regnum */
   -1,  /* ps_regnum */
   0,  /* fp0_regnum */
-  0,  /* stab_reg_to_regnum */
-  0,  /* ecoff_reg_to_regnum */
-  0,  /* dwarf_reg_to_regnum */
-  0,  /* sdb_reg_to_regnum */
-  0,  /* dwarf2_reg_to_regnum */
+  no_op_reg_to_regnum,  /* stab_reg_to_regnum */
+  no_op_reg_to_regnum,  /* ecoff_reg_to_regnum */
+  no_op_reg_to_regnum,  /* dwarf_reg_to_regnum */
+  no_op_reg_to_regnum,  /* sdb_reg_to_regnum */
+  no_op_reg_to_regnum,  /* dwarf2_reg_to_regnum */
   0,  /* register_name */
   0,  /* register_type */
   0,  /* unwind_dummy_id */
@@ -1502,7 +1502,7 @@ gdbarch_stab_reg_to_regnum (struct gdbar
   gdb_assert (gdbarch->stab_reg_to_regnum != NULL);
   if (gdbarch_debug >= 2)
     fprintf_unfiltered (gdb_stdlog, "gdbarch_stab_reg_to_regnum called\n");
-  return gdbarch->stab_reg_to_regnum (stab_regnr);
+  return gdbarch->stab_reg_to_regnum (gdbarch, stab_regnr);
 }
 
 void
@@ -1519,7 +1519,7 @@ gdbarch_ecoff_reg_to_regnum (struct gdba
   gdb_assert (gdbarch->ecoff_reg_to_regnum != NULL);
   if (gdbarch_debug >= 2)
     fprintf_unfiltered (gdb_stdlog, "gdbarch_ecoff_reg_to_regnum called\n");
-  return gdbarch->ecoff_reg_to_regnum (ecoff_regnr);
+  return gdbarch->ecoff_reg_to_regnum (gdbarch, ecoff_regnr);
 }
 
 void
@@ -1536,7 +1536,7 @@ gdbarch_dwarf_reg_to_regnum (struct gdba
   gdb_assert (gdbarch->dwarf_reg_to_regnum != NULL);
   if (gdbarch_debug >= 2)
     fprintf_unfiltered (gdb_stdlog, "gdbarch_dwarf_reg_to_regnum called\n");
-  return gdbarch->dwarf_reg_to_regnum (dwarf_regnr);
+  return gdbarch->dwarf_reg_to_regnum (gdbarch, dwarf_regnr);
 }
 
 void
@@ -1553,7 +1553,7 @@ gdbarch_sdb_reg_to_regnum (struct gdbarc
   gdb_assert (gdbarch->sdb_reg_to_regnum != NULL);
   if (gdbarch_debug >= 2)
     fprintf_unfiltered (gdb_stdlog, "gdbarch_sdb_reg_to_regnum called\n");
-  return gdbarch->sdb_reg_to_regnum (sdb_regnr);
+  return gdbarch->sdb_reg_to_regnum (gdbarch, sdb_regnr);
 }
 
 void
@@ -1570,7 +1570,7 @@ gdbarch_dwarf2_reg_to_regnum (struct gdb
   gdb_assert (gdbarch->dwarf2_reg_to_regnum != NULL);
   if (gdbarch_debug >= 2)
     fprintf_unfiltered (gdb_stdlog, "gdbarch_dwarf2_reg_to_regnum called\n");
-  return gdbarch->dwarf2_reg_to_regnum (dwarf2_regnr);
+  return gdbarch->dwarf2_reg_to_regnum (gdbarch, dwarf2_regnr);
 }
 
 void
diff -urpN src/gdb/gdbarch.h dev/gdb/gdbarch.h
--- src/gdb/gdbarch.h	2007-11-19 06:05:28.000000000 +0100
+++ dev/gdb/gdbarch.h	2007-11-21 08:32:46.000000000 +0100
@@ -206,29 +206,29 @@ extern void set_gdbarch_fp0_regnum (stru
 
 /* Convert stab register number (from `r' declaration) to a gdb REGNUM. */
 
-typedef int (gdbarch_stab_reg_to_regnum_ftype) (int stab_regnr);
+typedef int (gdbarch_stab_reg_to_regnum_ftype) (struct gdbarch *gdbarch, 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);
 
 /* Provide a default mapping from a ecoff register number to a gdb REGNUM. */
 
-typedef int (gdbarch_ecoff_reg_to_regnum_ftype) (int ecoff_regnr);
+typedef int (gdbarch_ecoff_reg_to_regnum_ftype) (struct gdbarch *gdbarch, 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);
 
 /* Provide a default mapping from a DWARF register number to a gdb REGNUM. */
 
-typedef int (gdbarch_dwarf_reg_to_regnum_ftype) (int dwarf_regnr);
+typedef int (gdbarch_dwarf_reg_to_regnum_ftype) (struct gdbarch *gdbarch, 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);
 
 /* Convert from an sdb register number to an internal gdb register number. */
 
-typedef int (gdbarch_sdb_reg_to_regnum_ftype) (int sdb_regnr);
+typedef int (gdbarch_sdb_reg_to_regnum_ftype) (struct gdbarch *gdbarch, 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);
 
-typedef int (gdbarch_dwarf2_reg_to_regnum_ftype) (int dwarf2_regnr);
+typedef int (gdbarch_dwarf2_reg_to_regnum_ftype) (struct gdbarch *gdbarch, 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);
 
diff -urpN src/gdb/gdbarch.sh dev/gdb/gdbarch.sh
--- src/gdb/gdbarch.sh	2007-11-19 06:05:28.000000000 +0100
+++ dev/gdb/gdbarch.sh	2007-11-21 08:32:39.000000000 +0100
@@ -413,14 +413,14 @@ v:int:pc_regnum:::-1:-1::0
 v:int:ps_regnum:::-1:-1::0
 v:int:fp0_regnum:::0:-1::0
 # Convert stab register number (from \`r\' declaration) to a gdb REGNUM.
-f:int:stab_reg_to_regnum:int stab_regnr:stab_regnr::no_op_reg_to_regnum::0
+m: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:int:ecoff_reg_to_regnum:int ecoff_regnr:ecoff_regnr::no_op_reg_to_regnum::0
+m: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:int:dwarf_reg_to_regnum:int dwarf_regnr:dwarf_regnr::no_op_reg_to_regnum::0
+m: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.
-f:int:sdb_reg_to_regnum:int sdb_regnr:sdb_regnr::no_op_reg_to_regnum::0
-f:int:dwarf2_reg_to_regnum:int dwarf2_regnr:dwarf2_regnr::no_op_reg_to_regnum::0
+m:int:sdb_reg_to_regnum:int sdb_regnr:sdb_regnr::no_op_reg_to_regnum::0
+m:int:dwarf2_reg_to_regnum:int dwarf2_regnr:dwarf2_regnr::no_op_reg_to_regnum::0
 m:const char *:register_name:int regnr:regnr::0
 
 # Return the type of a register specified by the architecture.  Only
diff -urpN src/gdb/h8300-tdep.c dev/gdb/h8300-tdep.c
--- src/gdb/h8300-tdep.c	2007-11-07 07:32:59.000000000 +0100
+++ dev/gdb/h8300-tdep.c	2007-11-21 08:56:33.000000000 +0100
@@ -1183,7 +1183,7 @@ h8300_dbg_reg_to_regnum (int regno)
 }
 
 static int
-h8300s_dbg_reg_to_regnum (int regno)
+h8300s_dbg_reg_to_regnum (struct gdbarch *gdbarch, int regno)
 {
   if (regno == E_CCR_REGNUM)
     return E_PSEUDO_CCR_REGNUM;
diff -urpN src/gdb/hppa-tdep.c dev/gdb/hppa-tdep.c
--- src/gdb/hppa-tdep.c	2007-11-16 05:56:58.000000000 +0100
+++ dev/gdb/hppa-tdep.c	2007-11-21 09:24:19.000000000 +0100
@@ -226,6 +226,7 @@ internalize_unwinds (struct objfile *obj
 		     asection *section, unsigned int entries, unsigned int size,
 		     CORE_ADDR text_offset)
 {
+  struct gdbarch *gdbarch = current_gdbarch;
   /* We will read the unwind entries into temporary memory, then
      fill in the actual unwind table.  */
 
@@ -242,7 +243,7 @@ internalize_unwinds (struct objfile *obj
 	 Note that when loading a shared library (text_offset != 0) the
 	 unwinds are already relative to the text_offset that will be
 	 passed in.  */
-      if (gdbarch_tdep (current_gdbarch)->is_elf && text_offset == 0)
+      if (gdbarch_tdep (gdbarch)->is_elf && text_offset == 0)
 	{
           low_text_segment_address = -1;
 
@@ -252,9 +253,9 @@ internalize_unwinds (struct objfile *obj
 
 	  text_offset = low_text_segment_address;
 	}
-      else if (gdbarch_tdep (current_gdbarch)->solib_get_text_base)
+      else if (gdbarch_tdep (gdbarch)->solib_get_text_base)
         {
-	  text_offset = gdbarch_tdep (current_gdbarch)->solib_get_text_base (objfile);
+	  text_offset = gdbarch_tdep (gdbarch)->solib_get_text_base (objfile);
 	}
 
       bfd_get_section_contents (objfile->obfd, section, buf, 0, size);
diff -urpN src/gdb/i386-tdep.c dev/gdb/i386-tdep.c
--- src/gdb/i386-tdep.c	2007-11-09 06:32:19.000000000 +0100
+++ dev/gdb/i386-tdep.c	2007-11-21 09:26:07.000000000 +0100
@@ -167,7 +167,7 @@ i386_register_name (struct gdbarch *gdba
    number used by GDB.  */
 
 static int
-i386_dbx_reg_to_regnum (int reg)
+i386_dbx_reg_to_regnum (struct gdbarch *gdbarch, int reg)
 {
   /* This implements what GCC calls the "default" register map
      (dbx_register_map[]).  */
@@ -199,15 +199,14 @@ i386_dbx_reg_to_regnum (int reg)
     }
 
   /* This will hopefully provoke a warning.  */
-  return gdbarch_num_regs (current_gdbarch)
-	 + gdbarch_num_pseudo_regs (current_gdbarch);
+  return gdbarch_num_regs (gdbarch) + gdbarch_num_pseudo_regs (gdbarch);
 }
 
 /* Convert SVR4 register number REG to the appropriate register number
    used by GDB.  */
 
 static int
-i386_svr4_reg_to_regnum (int reg)
+i386_svr4_reg_to_regnum (struct gdbarch *gdbarch, int reg)
 {
   /* This implements the GCC register map that tries to be compatible
      with the SVR4 C compiler for DWARF (svr4_dbx_register_map[]).  */
@@ -227,7 +226,7 @@ i386_svr4_reg_to_regnum (int reg)
   else if (reg >= 21 && reg <= 36)
     {
       /* The SSE and MMX registers have the same numbers as with dbx.  */
-      return i386_dbx_reg_to_regnum (reg);
+      return i386_dbx_reg_to_regnum (gdbarch, reg);
     }
 
   switch (reg)
@@ -244,8 +243,7 @@ i386_svr4_reg_to_regnum (int reg)
     }
 
   /* This will hopefully provoke a warning.  */
-  return gdbarch_num_regs (current_gdbarch)
-	 + gdbarch_num_pseudo_regs (current_gdbarch);
+  return gdbarch_num_regs (gdbarch) + gdbarch_num_pseudo_regs (gdbarch);
 }
 
 #undef I387_ST0_REGNUM
diff -urpN src/gdb/infrun.c dev/gdb/infrun.c
--- src/gdb/infrun.c	2007-11-20 13:43:50.000000000 +0100
+++ dev/gdb/infrun.c	2007-11-21 10:04:43.000000000 +0100
@@ -500,6 +500,7 @@ set_schedlock_func (char *args, int from
 void
 resume (int step, enum target_signal sig)
 {
+  struct gdbarch *gdbarch = current_gdbarch;
   int should_resume = 1;
   struct cleanup *old_cleanups = make_cleanup (resume_cleanups, 0);
   QUIT;
@@ -529,9 +530,8 @@ resume (int step, enum target_signal sig
      breakpoints can't be removed.  So we have to test for it here.  */
   if (breakpoint_here_p (read_pc ()) == permanent_breakpoint_here)
     {
-      if (gdbarch_skip_permanent_breakpoint_p (current_gdbarch))
-	gdbarch_skip_permanent_breakpoint (current_gdbarch,
-					   get_current_regcache ());
+      if (gdbarch_skip_permanent_breakpoint_p (gdbarch))
+	gdbarch_skip_permanent_breakpoint (gdbarch, get_current_regcache ());
       else
 	error (_("\
 The program is stopped at a permanent breakpoint, but GDB does not know\n\
@@ -539,10 +539,10 @@ how to step past a permanent breakpoint 
 a command like `return' or `jump' to continue execution."));
     }
 
-  if (step && gdbarch_software_single_step_p (current_gdbarch))
+  if (step && gdbarch_software_single_step_p (gdbarch))
     {
       /* Do it the hard way, w/temp breakpoints */
-      if (gdbarch_software_single_step (current_gdbarch, get_current_frame ()))
+      if (gdbarch_software_single_step (gdbarch, get_current_frame ()))
         {
           /* ...and don't ask hardware to do it.  */
           step = 0;
@@ -629,7 +629,7 @@ a command like `return' or `jump' to con
 	  resume_ptid = inferior_ptid;
 	}
 
-      if (gdbarch_cannot_step_breakpoint (current_gdbarch))
+      if (gdbarch_cannot_step_breakpoint (gdbarch))
 	{
 	  /* Most targets can step a breakpoint instruction, thus
 	     executing it normally.  But if this one cannot, just
@@ -1250,6 +1250,7 @@ adjust_pc_after_break (struct execution_
 void
 handle_inferior_event (struct execution_control_state *ecs)
 {
+  struct gdbarch *gdbarch = current_gdbarch;
   int sw_single_step_trap_p = 0;
   int stopped_by_watchpoint;
   int stepped_after_stopped_by_watchpoint = 0;
@@ -1834,7 +1835,7 @@ handle_inferior_event (struct execution_
      it in a moment.  */
   if (stopped_by_watchpoint
       && (HAVE_STEPPABLE_WATCHPOINT
-	  || gdbarch_have_nonsteppable_watchpoint (current_gdbarch)))
+	  || gdbarch_have_nonsteppable_watchpoint (gdbarch)))
     {
       if (debug_infrun)
 	fprintf_unfiltered (gdb_stdlog, "infrun: STOPPED_BY_WATCHPOINT\n");
@@ -1880,8 +1881,7 @@ handle_inferior_event (struct execution_
      will both be 0 if it doesn't work.  */
   find_pc_partial_function (stop_pc, &ecs->stop_func_name,
 			    &ecs->stop_func_start, &ecs->stop_func_end);
-  ecs->stop_func_start
-    += gdbarch_deprecated_function_start_offset (current_gdbarch);
+  ecs->stop_func_start += gdbarch_deprecated_function_start_offset (gdbarch);
   ecs->another_trap = 0;
   bpstat_clear (&stop_bpstat);
   stop_step = 0;
@@ -1892,7 +1892,7 @@ handle_inferior_event (struct execution_
 
   if (stop_signal == TARGET_SIGNAL_TRAP
       && trap_expected
-      && gdbarch_single_step_through_delay_p (current_gdbarch)
+      && gdbarch_single_step_through_delay_p (gdbarch)
       && currently_stepping (ecs))
     {
       /* We're trying to step of a breakpoint.  Turns out that we're
@@ -1901,8 +1901,7 @@ handle_inferior_event (struct execution_
 	 with a delay slot.  It needs to be stepped twice, once for
 	 the instruction and once for the delay slot.  */
       int step_through_delay
-	= gdbarch_single_step_through_delay (current_gdbarch,
-					     get_current_frame ());
+	= gdbarch_single_step_through_delay (gdbarch, get_current_frame ());
       if (debug_infrun && step_through_delay)
 	fprintf_unfiltered (gdb_stdlog, "infrun: step through delay\n");
       if (step_range_end == 0 && step_through_delay)
@@ -2151,8 +2150,8 @@ process_event_stop_test:
 	disable_longjmp_breakpoint ();
 	remove_breakpoints ();
 	breakpoints_inserted = 0;
-	if (!gdbarch_get_longjmp_target_p (current_gdbarch)
-	    || !gdbarch_get_longjmp_target (current_gdbarch,
+	if (!gdbarch_get_longjmp_target_p (gdbarch)
+	    || !gdbarch_get_longjmp_target (gdbarch,
 					    get_current_frame (), &jmp_buf_pc))
 	  {
 	    keep_going (ecs);
@@ -2445,7 +2444,7 @@ process_event_stop_test:
       )
     {
       CORE_ADDR pc_after_resolver =
-	gdbarch_skip_solib_resolver (current_gdbarch, stop_pc);
+	gdbarch_skip_solib_resolver (gdbarch, stop_pc);
 
       if (debug_infrun)
 	 fprintf_unfiltered (gdb_stdlog, "infrun: stepped into dynsym resolve code\n");
@@ -2531,7 +2530,7 @@ process_event_stop_test:
       real_stop_pc = skip_language_trampoline (get_current_frame (), stop_pc);
       if (real_stop_pc == 0)
 	real_stop_pc = gdbarch_skip_trampoline_code
-			 (current_gdbarch, get_current_frame (), stop_pc);
+			 (gdbarch, get_current_frame (), stop_pc);
       if (real_stop_pc != 0)
 	ecs->stop_func_start = real_stop_pc;
 
@@ -2589,13 +2588,13 @@ process_event_stop_test:
 
   /* If we're in the return path from a shared library trampoline,
      we want to proceed through the trampoline when stepping.  */
-  if (gdbarch_in_solib_return_trampoline (current_gdbarch,
+  if (gdbarch_in_solib_return_trampoline (gdbarch,
 					  stop_pc, ecs->stop_func_name))
     {
       /* Determine where this trampoline returns.  */
       CORE_ADDR real_stop_pc;
       real_stop_pc = gdbarch_skip_trampoline_code
-		       (current_gdbarch, get_current_frame (), stop_pc);
+		       (gdbarch, get_current_frame (), stop_pc);
 
       if (debug_infrun)
 	 fprintf_unfiltered (gdb_stdlog, "infrun: stepped into solib return tramp\n");
@@ -2784,11 +2783,12 @@ step_into_function (struct execution_con
 {
   struct symtab *s;
   struct symtab_and_line sr_sal;
+  struct gdbarch *gdbarch = current_gdbarch;
 
   s = find_pc_symtab (stop_pc);
   if (s && s->language != language_asm)
     ecs->stop_func_start = gdbarch_skip_prologue
-			     (current_gdbarch, ecs->stop_func_start);
+			     (gdbarch, ecs->stop_func_start);
 
   ecs->sal = find_pc_line (ecs->stop_func_start, 0);
   /* Use the step_resume_break to step until the end of the prologue,
@@ -2818,11 +2818,10 @@ step_into_function (struct execution_con
      the VLIW instruction.  Thus, we need to make the corresponding
      adjustment here when computing the stop address.  */
 
-  if (gdbarch_adjust_breakpoint_address_p (current_gdbarch))
+  if (gdbarch_adjust_breakpoint_address_p (gdbarch))
     {
       ecs->stop_func_start
-	= gdbarch_adjust_breakpoint_address (current_gdbarch,
-					     ecs->stop_func_start);
+	= gdbarch_adjust_breakpoint_address (gdbarch, ecs->stop_func_start);
     }
 
   if (ecs->stop_func_start == stop_pc)
diff -urpN src/gdb/m2-lang.c dev/gdb/m2-lang.c
--- src/gdb/m2-lang.c	2007-11-16 05:56:58.000000000 +0100
+++ dev/gdb/m2-lang.c	2007-11-21 09:07:23.000000000 +0100
@@ -285,6 +285,7 @@ static struct type *
 m2_create_fundamental_type (struct objfile *objfile, int typeid)
 {
   struct type *type = NULL;
+  struct gdbarch *gdbarch = current_gdbarch;
 
   switch (typeid)
     {
@@ -294,7 +295,7 @@ m2_create_fundamental_type (struct objfi
          name "<?type?>".  When all the dust settles from the type
          reconstruction work, this should probably become an error.  */
       type = init_type (TYPE_CODE_INT,
-			gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT,
+			gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT,
 			0, "<?type?>", objfile);
       warning (_("internal error: no Modula fundamental type %d"), typeid);
       break;
@@ -330,113 +331,106 @@ m2_create_fundamental_type (struct objfi
       break;
     case FT_SHORT:
       type = init_type (TYPE_CODE_INT,
-			gdbarch_short_bit (current_gdbarch) / TARGET_CHAR_BIT,
+			gdbarch_short_bit (gdbarch) / TARGET_CHAR_BIT,
 			0, "short", objfile);
       break;
     case FT_SIGNED_SHORT:
       type = init_type (TYPE_CODE_INT,
-			gdbarch_short_bit (current_gdbarch) / TARGET_CHAR_BIT,
+			gdbarch_short_bit (gdbarch) / TARGET_CHAR_BIT,
 			0, "short", objfile);	/* FIXME-fnf */
       break;
     case FT_UNSIGNED_SHORT:
       type = init_type (TYPE_CODE_INT,
-			gdbarch_short_bit (current_gdbarch) / TARGET_CHAR_BIT,
+			gdbarch_short_bit (gdbarch) / TARGET_CHAR_BIT,
 			TYPE_FLAG_UNSIGNED, "unsigned short", objfile);
       break;
     case FT_INTEGER:
       type = init_type (TYPE_CODE_INT,
-			gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT,
+			gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT,
 			0, "int", objfile);
       break;
     case FT_SIGNED_INTEGER:
       type = init_type (TYPE_CODE_INT,
-			gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT,
+			gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT,
 			0, "int", objfile);	/* FIXME -fnf */
       break;
     case FT_UNSIGNED_INTEGER:
       type = init_type (TYPE_CODE_INT,
-			gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT,
+			gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT,
 			TYPE_FLAG_UNSIGNED, "unsigned int", objfile);
       break;
     case FT_FIXED_DECIMAL:
       type = init_type (TYPE_CODE_INT,
-			gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT,
+			gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT,
 			0, "fixed decimal", objfile);
       break;
     case FT_LONG:
       type = init_type (TYPE_CODE_INT,
-			gdbarch_long_bit (current_gdbarch) / TARGET_CHAR_BIT,
+			gdbarch_long_bit (gdbarch) / TARGET_CHAR_BIT,
 			0, "long", objfile);
       break;
     case FT_SIGNED_LONG:
       type = init_type (TYPE_CODE_INT,
-			gdbarch_long_bit (current_gdbarch) / TARGET_CHAR_BIT,
+			gdbarch_long_bit (gdbarch) / TARGET_CHAR_BIT,
 			0, "long", objfile);	/* FIXME -fnf */
       break;
     case FT_UNSIGNED_LONG:
       type = init_type (TYPE_CODE_INT,
-			gdbarch_long_bit (current_gdbarch) / TARGET_CHAR_BIT,
+			gdbarch_long_bit (gdbarch) / TARGET_CHAR_BIT,
 			TYPE_FLAG_UNSIGNED, "unsigned long", objfile);
       break;
     case FT_LONG_LONG:
       type = init_type (TYPE_CODE_INT,
-			gdbarch_long_long_bit (current_gdbarch)
-			  / TARGET_CHAR_BIT,
+			gdbarch_long_long_bit (gdbarch) / TARGET_CHAR_BIT,
 			0, "long long", objfile);
       break;
     case FT_SIGNED_LONG_LONG:
       type = init_type (TYPE_CODE_INT,
-			gdbarch_long_long_bit (current_gdbarch)
-			  / TARGET_CHAR_BIT,
+			gdbarch_long_long_bit (gdbarch) / TARGET_CHAR_BIT,
 			0, "signed long long", objfile);
       break;
     case FT_UNSIGNED_LONG_LONG:
       type = init_type (TYPE_CODE_INT,
-			gdbarch_long_long_bit (current_gdbarch)
-			  / TARGET_CHAR_BIT,
+			gdbarch_long_long_bit (gdbarch) / TARGET_CHAR_BIT,
 			TYPE_FLAG_UNSIGNED, "unsigned long long", objfile);
       break;
     case FT_FLOAT:
       type = init_type (TYPE_CODE_FLT,
-			gdbarch_float_bit (current_gdbarch) / TARGET_CHAR_BIT,
+			gdbarch_float_bit (gdbarch) / TARGET_CHAR_BIT,
 			0, "float", objfile);
       break;
     case FT_DBL_PREC_FLOAT:
       type = init_type (TYPE_CODE_FLT,
-			gdbarch_double_bit (current_gdbarch) / TARGET_CHAR_BIT,
+			gdbarch_double_bit (gdbarch) / TARGET_CHAR_BIT,
 			0, "double", objfile);
       break;
     case FT_FLOAT_DECIMAL:
       type = init_type (TYPE_CODE_FLT,
-			gdbarch_double_bit (current_gdbarch) / TARGET_CHAR_BIT,
+			gdbarch_double_bit (gdbarch) / TARGET_CHAR_BIT,
 			0, "floating decimal", objfile);
       break;
     case FT_EXT_PREC_FLOAT:
       type = init_type (TYPE_CODE_FLT,
-			gdbarch_long_double_bit (current_gdbarch)
-			  / TARGET_CHAR_BIT,
+			gdbarch_long_double_bit (gdbarch) / TARGET_CHAR_BIT,
 			0, "long double", objfile);
       break;
     case FT_COMPLEX:
       type = init_type (TYPE_CODE_COMPLEX,
-			2 * gdbarch_float_bit (current_gdbarch)
-			  / TARGET_CHAR_BIT,
+			2 * gdbarch_float_bit (gdbarch) / TARGET_CHAR_BIT,
 			0, "complex", objfile);
       TYPE_TARGET_TYPE (type)
 	= m2_create_fundamental_type (objfile, FT_FLOAT);
       break;
     case FT_DBL_PREC_COMPLEX:
       type = init_type (TYPE_CODE_COMPLEX,
-			2 * gdbarch_double_bit (current_gdbarch)
-			  / TARGET_CHAR_BIT,
+			2 * gdbarch_double_bit (gdbarch) / TARGET_CHAR_BIT,
 			0, "double complex", objfile);
       TYPE_TARGET_TYPE (type)
 	= m2_create_fundamental_type (objfile, FT_DBL_PREC_FLOAT);
       break;
     case FT_EXT_PREC_COMPLEX:
       type = init_type (TYPE_CODE_COMPLEX,
-			2 * gdbarch_long_double_bit (current_gdbarch)
-			  / TARGET_CHAR_BIT,
+			2 * gdbarch_long_double_bit (gdbarch) / TARGET_CHAR_BIT,
 			0, "long double complex", objfile);
       TYPE_TARGET_TYPE (type)
 	= m2_create_fundamental_type (objfile, FT_EXT_PREC_FLOAT);
diff -urpN src/gdb/m32c-tdep.c dev/gdb/m32c-tdep.c
--- src/gdb/m32c-tdep.c	2007-11-19 06:05:28.000000000 +0100
+++ dev/gdb/m32c-tdep.c	2007-11-21 08:53:32.000000000 +0100
@@ -248,9 +248,9 @@ m32c_register_sim_regno (struct gdbarch 
 
 
 static int
-m32c_debug_info_reg_to_regnum (int reg_nr)
+m32c_debug_info_reg_to_regnum (struct gdbarch *gdbarch, int reg_nr)
 {
-  struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   if (0 <= reg_nr && reg_nr <= M32C_MAX_DWARF_REGNUM
       && tdep->dwarf_regs[reg_nr])
     return tdep->dwarf_regs[reg_nr]->num;
diff -urpN src/gdb/mdebugread.c dev/gdb/mdebugread.c
--- src/gdb/mdebugread.c	2007-10-19 14:26:34.000000000 +0200
+++ dev/gdb/mdebugread.c	2007-11-21 09:23:25.000000000 +0100
@@ -559,6 +559,7 @@ static int
 parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
 	      struct section_offsets *section_offsets, struct objfile *objfile)
 {
+  struct gdbarch *gdbarch = current_gdbarch;
   const bfd_size_type external_sym_size = debug_swap->external_sym_size;
   void (*const swap_sym_in) (bfd *, void *, SYMR *) = debug_swap->swap_sym_in;
   char *name;
@@ -637,7 +638,7 @@ parse_symbol (SYMR *sh, union aux_ext *a
       if (sh->sc == scRegister)
 	{
 	  class = LOC_REGISTER;
-	  svalue = gdbarch_ecoff_reg_to_regnum (current_gdbarch, svalue);
+	  svalue = gdbarch_ecoff_reg_to_regnum (gdbarch, svalue);
 	}
       else
 	class = LOC_LOCAL;
@@ -653,7 +654,7 @@ parse_symbol (SYMR *sh, union aux_ext *a
       /* Type could be missing if file is compiled without debugging info.  */
       if (SC_IS_UNDEF (sh->sc)
 	  || sh->sc == scNil || sh->index == indexNil)
-	SYMBOL_TYPE (s) = builtin_type (current_gdbarch)->nodebug_data_symbol;
+	SYMBOL_TYPE (s) = builtin_type (gdbarch)->nodebug_data_symbol;
       else
 	SYMBOL_TYPE (s) = parse_type (cur_fd, ax, sh->index, 0, bigend, name);
       /* Value of a data symbol is its memory address */
@@ -675,7 +676,7 @@ parse_symbol (SYMR *sh, union aux_ext *a
 	case scRegister:
 	  /* Pass by value in register.  */
 	  SYMBOL_CLASS (s) = LOC_REGPARM;
-	  svalue = gdbarch_ecoff_reg_to_regnum (current_gdbarch, svalue);
+	  svalue = gdbarch_ecoff_reg_to_regnum (gdbarch, svalue);
 	  break;
 	case scVar:
 	  /* Pass by reference on stack.  */
@@ -684,7 +685,7 @@ parse_symbol (SYMR *sh, union aux_ext *a
 	case scVarRegister:
 	  /* Pass by reference in register.  */
 	  SYMBOL_CLASS (s) = LOC_REGPARM_ADDR;
-	  svalue = gdbarch_ecoff_reg_to_regnum (current_gdbarch, svalue);
+	  svalue = gdbarch_ecoff_reg_to_regnum (gdbarch, svalue);
 	  break;
 	default:
 	  /* Pass by value on stack.  */
@@ -1039,8 +1040,7 @@ parse_symbol (SYMR *sh, union aux_ext *a
 	       that too.  */
 	    if (TYPE_LENGTH (t) == TYPE_NFIELDS (t)
 		|| TYPE_LENGTH (t) == 0)
-	      TYPE_LENGTH (t) = 
-		gdbarch_int_bit (current_gdbarch) / HOST_CHAR_BIT;
+	      TYPE_LENGTH (t) = gdbarch_int_bit (gdbarch) / HOST_CHAR_BIT;
 	    for (ext_tsym = ext_sh + external_sym_size;
 		 ;
 		 ext_tsym += external_sym_size)
@@ -2226,6 +2226,7 @@ record_minimal_symbol (const char *name,
 static void
 parse_partial_symbols (struct objfile *objfile)
 {
+  struct gdbarch *gdbarch = current_gdbarch;
   const bfd_size_type external_sym_size = debug_swap->external_sym_size;
   const bfd_size_type external_rfd_size = debug_swap->external_rfd_size;
   const bfd_size_type external_ext_size = debug_swap->external_ext_size;
@@ -2849,8 +2850,7 @@ parse_partial_symbols (struct objfile *o
 			 don't relocate it.  */
 
 		      if (sh.value == 0
-			  && gdbarch_sofun_address_maybe_missing
-			      (current_gdbarch))
+			  && gdbarch_sofun_address_maybe_missing (gdbarch))
 			{
 			  textlow_not_set = 1;
 			  valu = 0;
@@ -2999,9 +2999,9 @@ parse_partial_symbols (struct objfile *o
 		      case 'S':
 			sh.value += ANOFFSET (objfile->section_offsets, SECT_OFF_DATA (objfile));
 
-			if (gdbarch_static_transform_name_p (current_gdbarch))
+			if (gdbarch_static_transform_name_p (gdbarch))
 			  namestring = gdbarch_static_transform_name
-					 (current_gdbarch, namestring);
+					 (gdbarch, namestring);
 
 			add_psymbol_to_list (namestring, p - namestring,
 					     VAR_DOMAIN, LOC_STATIC,
@@ -3230,8 +3230,7 @@ parse_partial_symbols (struct objfile *o
 		       necessary if a module compiled without
 		       debugging info follows this module.  */
 		    if (pst
-			&& gdbarch_sofun_address_maybe_missing
-			     (current_gdbarch))
+			&& gdbarch_sofun_address_maybe_missing (gdbarch))
 		      {
 			pst = (struct partial_symtab *) 0;
 			includes_used = 0;
@@ -4749,6 +4748,8 @@ elfmdebug_build_psymtabs (struct objfile
 void
 _initialize_mdebugread (void)
 {
+  struct gdbarch *gdbarch = current_gdbarch;
+
   mdebug_type_void =
     init_type (TYPE_CODE_VOID, 1,
 	       0,
@@ -4821,20 +4822,20 @@ _initialize_mdebugread (void)
   TYPE_TARGET_TYPE (mdebug_type_adr_64) = mdebug_type_void;
   mdebug_type_float =
     init_type (TYPE_CODE_FLT,
-	       gdbarch_float_bit (current_gdbarch) / TARGET_CHAR_BIT,
+	       gdbarch_float_bit (gdbarch) / TARGET_CHAR_BIT,
 	       0, "float", (struct objfile *) NULL);
   mdebug_type_double =
     init_type (TYPE_CODE_FLT,
-	       gdbarch_double_bit (current_gdbarch) / TARGET_CHAR_BIT,
+	       gdbarch_double_bit (gdbarch) / TARGET_CHAR_BIT,
 	       0, "double", (struct objfile *) NULL);
   mdebug_type_complex =
     init_type (TYPE_CODE_COMPLEX,
-	       2 * gdbarch_float_bit (current_gdbarch) / TARGET_CHAR_BIT,
+	       2 * gdbarch_float_bit (gdbarch) / TARGET_CHAR_BIT,
 	       0, "complex", (struct objfile *) NULL);
   TYPE_TARGET_TYPE (mdebug_type_complex) = mdebug_type_float;
   mdebug_type_double_complex =
     init_type (TYPE_CODE_COMPLEX,
-	       2 * gdbarch_double_bit (current_gdbarch) / TARGET_CHAR_BIT,
+	       2 * gdbarch_double_bit (gdbarch) / TARGET_CHAR_BIT,
 	       0, "double complex", (struct objfile *) NULL);
   TYPE_TARGET_TYPE (mdebug_type_double_complex) = mdebug_type_double;
 
@@ -4851,13 +4852,13 @@ _initialize_mdebugread (void)
      TYPE_CODE_ERROR print things in hex if it knows the size?  */
   mdebug_type_fixed_dec =
     init_type (TYPE_CODE_INT,
-	       gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT,
+	       gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT,
 	       0, "fixed decimal",
 	       (struct objfile *) NULL);
 
   mdebug_type_float_dec =
     init_type (TYPE_CODE_ERROR,
-	       gdbarch_double_bit (current_gdbarch) / TARGET_CHAR_BIT,
+	       gdbarch_double_bit (gdbarch) / TARGET_CHAR_BIT,
 	       0, "floating decimal",
 	       (struct objfile *) NULL);
 }
diff -urpN src/gdb/memattr.c dev/gdb/memattr.c
--- src/gdb/memattr.c	2007-10-11 22:12:04.000000000 +0200
+++ dev/gdb/memattr.c	2007-11-21 10:00:21.000000000 +0100
@@ -412,6 +412,7 @@ mem_command (char *args, int from_tty)
 static void
 mem_info_command (char *args, int from_tty)
 {
+  struct gdbarch *gdbarch = current_gdbarch;
   struct mem_region *m;
   struct mem_attrib *attrib;
   int ix;
@@ -432,10 +433,10 @@ mem_info_command (char *args, int from_t
   printf_filtered ("Num ");
   printf_filtered ("Enb ");
   printf_filtered ("Low Addr   ");
-  if (gdbarch_addr_bit (current_gdbarch) > 32)
+  if (gdbarch_addr_bit (gdbarch) > 32)
     printf_filtered ("        ");
   printf_filtered ("High Addr  ");
-  if (gdbarch_addr_bit (current_gdbarch) > 32)
+  if (gdbarch_addr_bit (gdbarch) > 32)
     printf_filtered ("        ");
   printf_filtered ("Attrs ");
   printf_filtered ("\n");
@@ -446,14 +447,14 @@ mem_info_command (char *args, int from_t
       printf_filtered ("%-3d %-3c\t",
 		       m->number,
 		       m->enabled_p ? 'y' : 'n');
-      if (gdbarch_addr_bit (current_gdbarch) <= 32)
+      if (gdbarch_addr_bit (gdbarch) <= 32)
 	tmp = hex_string_custom ((unsigned long) m->lo, 8);
       else
 	tmp = hex_string_custom ((unsigned long) m->lo, 16);
       
       printf_filtered ("%s ", tmp);
 
-      if (gdbarch_addr_bit (current_gdbarch) <= 32)
+      if (gdbarch_addr_bit (gdbarch) <= 32)
 	{
 	if (m->hi == 0)
 	  tmp = "0x100000000";
diff -urpN src/gdb/mep-tdep.c dev/gdb/mep-tdep.c
--- src/gdb/mep-tdep.c	2007-11-07 07:33:00.000000000 +0100
+++ dev/gdb/mep-tdep.c	2007-11-21 08:52:15.000000000 +0100
@@ -785,7 +785,7 @@ mep_init_pseudoregister_maps (void)
 
 
 static int
-mep_debug_reg_to_regnum (int debug_reg)
+mep_debug_reg_to_regnum (struct gdbarch *gdbarch, int debug_reg)
 {
   /* The debug info uses the raw register numbers.  */
   return mep_raw_to_pseudo[debug_reg];
diff -urpN src/gdb/mips-tdep.c dev/gdb/mips-tdep.c
--- src/gdb/mips-tdep.c	2007-11-21 06:55:54.000000000 +0100
+++ dev/gdb/mips-tdep.c	2007-11-21 08:51:28.000000000 +0100
@@ -5040,23 +5040,22 @@ mips_skip_trampoline_code (struct frame_
    [1 * gdbarch_num_regs .. 2 * gdbarch_num_regs) REGNUM.  */
 
 static int
-mips_stab_reg_to_regnum (int num)
+mips_stab_reg_to_regnum (struct gdbarch *gdbarch, int num)
 {
   int regnum;
   if (num >= 0 && num < 32)
     regnum = num;
   else if (num >= 38 && num < 70)
-    regnum = num + mips_regnum (current_gdbarch)->fp0 - 38;
+    regnum = num + mips_regnum (gdbarch)->fp0 - 38;
   else if (num == 70)
-    regnum = mips_regnum (current_gdbarch)->hi;
+    regnum = mips_regnum (gdbarch)->hi;
   else if (num == 71)
-    regnum = mips_regnum (current_gdbarch)->lo;
+    regnum = mips_regnum (gdbarch)->lo;
   else
     /* This will hopefully (eventually) provoke a warning.  Should
        we be calling complaint() here?  */
-    return gdbarch_num_regs (current_gdbarch)
-	   + gdbarch_num_pseudo_regs (current_gdbarch);
-  return gdbarch_num_regs (current_gdbarch) + regnum;
+    return gdbarch_num_regs (gdbarch) + gdbarch_num_pseudo_regs (gdbarch);
+  return gdbarch_num_regs (gdbarch) + regnum;
 }
 
 
@@ -5064,23 +5063,22 @@ mips_stab_reg_to_regnum (int num)
    gdbarch_num_regs .. 2 * gdbarch_num_regs) REGNUM.  */
 
 static int
-mips_dwarf_dwarf2_ecoff_reg_to_regnum (int num)
+mips_dwarf_dwarf2_ecoff_reg_to_regnum (struct gdbarch *gdbarch, int num)
 {
   int regnum;
   if (num >= 0 && num < 32)
     regnum = num;
   else if (num >= 32 && num < 64)
-    regnum = num + mips_regnum (current_gdbarch)->fp0 - 32;
+    regnum = num + mips_regnum (gdbarch)->fp0 - 32;
   else if (num == 64)
-    regnum = mips_regnum (current_gdbarch)->hi;
+    regnum = mips_regnum (gdbarch)->hi;
   else if (num == 65)
-    regnum = mips_regnum (current_gdbarch)->lo;
+    regnum = mips_regnum (gdbarch)->lo;
   else
     /* This will hopefully (eventually) provoke a warning.  Should we
        be calling complaint() here?  */
-    return gdbarch_num_regs (current_gdbarch)
-	   + gdbarch_num_pseudo_regs (current_gdbarch);
-  return gdbarch_num_regs (current_gdbarch) + regnum;
+    return gdbarch_num_regs (gdbarch) + gdbarch_num_pseudo_regs (gdbarch);
+  return gdbarch_num_regs (gdbarch) + regnum;
 }
 
 static int
diff -urpN src/gdb/nto-tdep.c dev/gdb/nto-tdep.c
--- src/gdb/nto-tdep.c	2007-11-17 12:49:19.000000000 +0100
+++ dev/gdb/nto-tdep.c	2007-11-21 09:59:03.000000000 +0100
@@ -100,20 +100,21 @@ nto_map_arch_to_cputype (const char *arc
 int
 nto_find_and_open_solib (char *solib, unsigned o_flags, char **temp_pathname)
 {
+  struct gdbarch *gdbarch = current_gdbarch;
   char *buf, *arch_path, *nto_root, *endian, *base;
   const char *arch;
   int ret;
 #define PATH_FMT "%s/lib:%s/usr/lib:%s/usr/photon/lib:%s/usr/photon/dll:%s/lib/dll"
 
   nto_root = nto_target ();
-  if (strcmp (gdbarch_bfd_arch_info (current_gdbarch)->arch_name, "i386") == 0)
+  if (strcmp (gdbarch_bfd_arch_info (gdbarch)->arch_name, "i386") == 0)
     {
       arch = "x86";
       endian = "";
     }
-  else if (strcmp (gdbarch_bfd_arch_info (current_gdbarch)->arch_name,
+  else if (strcmp (gdbarch_bfd_arch_info (gdbarch)->arch_name,
 		   "rs6000") == 0
-	   || strcmp (gdbarch_bfd_arch_info (current_gdbarch)->arch_name,
+	   || strcmp (gdbarch_bfd_arch_info (gdbarch)->arch_name,
 		   "powerpc") == 0)
     {
       arch = "ppc";
@@ -121,9 +122,8 @@ nto_find_and_open_solib (char *solib, un
     }
   else
     {
-      arch = gdbarch_bfd_arch_info (current_gdbarch)->arch_name;
-      endian = gdbarch_byte_order (current_gdbarch)
-	       == BFD_ENDIAN_BIG ? "be" : "le";
+      arch = gdbarch_bfd_arch_info (gdbarch)->arch_name;
+      endian = gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG ? "be" : "le";
     }
 
   /* In case nto_root is short, add strlen(solib)
@@ -163,19 +163,20 @@ nto_find_and_open_solib (char *solib, un
 void
 nto_init_solib_absolute_prefix (void)
 {
+  struct gdbarch *gdbarch = current_gdbarch;
   char buf[PATH_MAX * 2], arch_path[PATH_MAX];
   char *nto_root, *endian;
   const char *arch;
 
   nto_root = nto_target ();
-  if (strcmp (gdbarch_bfd_arch_info (current_gdbarch)->arch_name, "i386") == 0)
+  if (strcmp (gdbarch_bfd_arch_info (gdbarch)->arch_name, "i386") == 0)
     {
       arch = "x86";
       endian = "";
     }
-  else if (strcmp (gdbarch_bfd_arch_info (current_gdbarch)->arch_name,
+  else if (strcmp (gdbarch_bfd_arch_info (gdbarch)->arch_name,
 		   "rs6000") == 0
-	   || strcmp (gdbarch_bfd_arch_info (current_gdbarch)->arch_name,
+	   || strcmp (gdbarch_bfd_arch_info (gdbarch)->arch_name,
 		   "powerpc") == 0)
     {
       arch = "ppc";
@@ -183,9 +184,8 @@ nto_init_solib_absolute_prefix (void)
     }
   else
     {
-      arch = gdbarch_bfd_arch_info (current_gdbarch)->arch_name;
-      endian = gdbarch_byte_order (current_gdbarch)
-	       == BFD_ENDIAN_BIG ? "be" : "le";
+      arch = gdbarch_bfd_arch_info (gdbarch)->arch_name;
+      endian = gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG ? "be" : "le";
     }
 
   sprintf (arch_path, "%s/%s%s", nto_root, arch, endian);
diff -urpN src/gdb/objc-lang.c dev/gdb/objc-lang.c
--- src/gdb/objc-lang.c	2007-11-02 20:34:11.000000000 +0100
+++ dev/gdb/objc-lang.c	2007-11-21 09:28:13.000000000 +0100
@@ -449,6 +449,7 @@ static struct type *
 objc_create_fundamental_type (struct objfile *objfile, int typeid)
 {
   struct type *type = NULL;
+  struct gdbarch *gdbarch = current_gdbarch;
 
   switch (typeid)
     {
@@ -459,7 +460,7 @@ objc_create_fundamental_type (struct obj
 	   the type reconstruction work, this should probably become
 	   an error.  */
 	type = init_type (TYPE_CODE_INT,
-			  gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT,
+			  gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT,
 			  0, "<?type?>", objfile);
         warning (_("internal error: no C/C++ fundamental type %d"), typeid);
 	break;
@@ -485,82 +486,77 @@ objc_create_fundamental_type (struct obj
 	break;
       case FT_SHORT:
 	type = init_type (TYPE_CODE_INT,
-			  gdbarch_short_bit (current_gdbarch) / TARGET_CHAR_BIT,
+			  gdbarch_short_bit (gdbarch) / TARGET_CHAR_BIT,
 			  0, "short", objfile);
 	break;
       case FT_SIGNED_SHORT:
 	type = init_type (TYPE_CODE_INT,
-			  gdbarch_short_bit (current_gdbarch) / TARGET_CHAR_BIT,
+			  gdbarch_short_bit (gdbarch) / TARGET_CHAR_BIT,
 			  0, "short", objfile);	/* FIXME-fnf */
 	break;
       case FT_UNSIGNED_SHORT:
 	type = init_type (TYPE_CODE_INT,
-			  gdbarch_short_bit (current_gdbarch) / TARGET_CHAR_BIT,
+			  gdbarch_short_bit (gdbarch) / TARGET_CHAR_BIT,
 			  TYPE_FLAG_UNSIGNED, "unsigned short", objfile);
 	break;
       case FT_INTEGER:
 	type = init_type (TYPE_CODE_INT,
-			  gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT,
+			  gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT,
 			  0, "int", objfile);
 	break;
       case FT_SIGNED_INTEGER:
 	type = init_type (TYPE_CODE_INT,
-			  gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT,
+			  gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT,
 			  0, "int", objfile); /* FIXME -fnf */
 	break;
       case FT_UNSIGNED_INTEGER:
 	type = init_type (TYPE_CODE_INT,
-			  gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT,
+			  gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT,
 			  TYPE_FLAG_UNSIGNED, "unsigned int", objfile);
 	break;
       case FT_LONG:
 	type = init_type (TYPE_CODE_INT,
-			  gdbarch_long_bit (current_gdbarch) / TARGET_CHAR_BIT,
+			  gdbarch_long_bit (gdbarch) / TARGET_CHAR_BIT,
 			  0, "long", objfile);
 	break;
       case FT_SIGNED_LONG:
 	type = init_type (TYPE_CODE_INT,
-			  gdbarch_long_bit (current_gdbarch) / TARGET_CHAR_BIT,
+			  gdbarch_long_bit (gdbarch) / TARGET_CHAR_BIT,
 			  0, "long", objfile); /* FIXME -fnf */
 	break;
       case FT_UNSIGNED_LONG:
 	type = init_type (TYPE_CODE_INT,
-			  gdbarch_long_bit (current_gdbarch) / TARGET_CHAR_BIT,
+			  gdbarch_long_bit (gdbarch) / TARGET_CHAR_BIT,
 			  TYPE_FLAG_UNSIGNED, "unsigned long", objfile);
 	break;
       case FT_LONG_LONG:
 	type = init_type (TYPE_CODE_INT,
-			  gdbarch_long_long_bit (current_gdbarch)
-			    / TARGET_CHAR_BIT,
+			  gdbarch_long_long_bit (gdbarch) / TARGET_CHAR_BIT,
 			  0, "long long", objfile);
 	break;
       case FT_SIGNED_LONG_LONG:
 	type = init_type (TYPE_CODE_INT,
-			  gdbarch_long_long_bit (current_gdbarch)
-			    / TARGET_CHAR_BIT,
+			  gdbarch_long_long_bit (gdbarch) / TARGET_CHAR_BIT,
 			  0, "signed long long", objfile);
 	break;
       case FT_UNSIGNED_LONG_LONG:
 	type = init_type (TYPE_CODE_INT,
-			  gdbarch_long_long_bit (current_gdbarch)
-			    / TARGET_CHAR_BIT,
+			  gdbarch_long_long_bit (gdbarch) / TARGET_CHAR_BIT,
 			  TYPE_FLAG_UNSIGNED, "unsigned long long", objfile);
 	break;
       case FT_FLOAT:
 	type = init_type (TYPE_CODE_FLT,
-			  gdbarch_float_bit (current_gdbarch) / TARGET_CHAR_BIT,
+			  gdbarch_float_bit (gdbarch) / TARGET_CHAR_BIT,
 			  0, "float", objfile);
 	break;
       case FT_DBL_PREC_FLOAT:
 	type = init_type (TYPE_CODE_FLT,
-			  gdbarch_double_bit (current_gdbarch)
-			    / TARGET_CHAR_BIT,
+			  gdbarch_double_bit (gdbarch) / TARGET_CHAR_BIT,
 			  0, "double", objfile);
 	break;
       case FT_EXT_PREC_FLOAT:
 	type = init_type (TYPE_CODE_FLT,
-			  gdbarch_long_double_bit (current_gdbarch)
-			    / TARGET_CHAR_BIT,
+			  gdbarch_long_double_bit (gdbarch) / TARGET_CHAR_BIT,
 			  0, "long double", objfile);
 	break;
       }
diff -urpN src/gdb/p-lang.c dev/gdb/p-lang.c
--- src/gdb/p-lang.c	2007-11-02 20:34:11.000000000 +0100
+++ dev/gdb/p-lang.c	2007-11-21 09:57:01.000000000 +0100
@@ -325,6 +325,7 @@ pascal_printstr (struct ui_file *stream,
 struct type *
 pascal_create_fundamental_type (struct objfile *objfile, int typeid)
 {
+  struct gdbarch *gdbarch = current_gdbarch;
   struct type *type = NULL;
 
   switch (typeid)
@@ -335,7 +336,7 @@ pascal_create_fundamental_type (struct o
          name "<?type?>".  When all the dust settles from the type
          reconstruction work, this should probably become an error. */
       type = init_type (TYPE_CODE_INT,
-			gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT,
+			gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT,
 			0, "<?type?>", objfile);
       warning (_("internal error: no Pascal fundamental type %d"), typeid);
       break;
@@ -361,81 +362,77 @@ pascal_create_fundamental_type (struct o
       break;
     case FT_SHORT:
       type = init_type (TYPE_CODE_INT,
-			gdbarch_short_bit (current_gdbarch) / TARGET_CHAR_BIT,
+			gdbarch_short_bit (gdbarch) / TARGET_CHAR_BIT,
 			0, "integer", objfile);
       break;
     case FT_SIGNED_SHORT:
       type = init_type (TYPE_CODE_INT,
-			gdbarch_short_bit (current_gdbarch) / TARGET_CHAR_BIT,
+			gdbarch_short_bit (gdbarch) / TARGET_CHAR_BIT,
 			0, "integer", objfile);		/* FIXME-fnf */
       break;
     case FT_UNSIGNED_SHORT:
       type = init_type (TYPE_CODE_INT,
-			gdbarch_short_bit (current_gdbarch) / TARGET_CHAR_BIT,
+			gdbarch_short_bit (gdbarch) / TARGET_CHAR_BIT,
 			TYPE_FLAG_UNSIGNED, "word", objfile);
       break;
     case FT_INTEGER:
       type = init_type (TYPE_CODE_INT,
-			gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT,
+			gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT,
 			0, "longint", objfile);
       break;
     case FT_SIGNED_INTEGER:
       type = init_type (TYPE_CODE_INT,
-			gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT,
+			gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT,
 			0, "longint", objfile);		/* FIXME -fnf */
       break;
     case FT_UNSIGNED_INTEGER:
       type = init_type (TYPE_CODE_INT,
-			gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT,
+			gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT,
 			TYPE_FLAG_UNSIGNED, "cardinal", objfile);
       break;
     case FT_LONG:
       type = init_type (TYPE_CODE_INT,
-			gdbarch_long_bit (current_gdbarch) / TARGET_CHAR_BIT,
+			gdbarch_long_bit (gdbarch) / TARGET_CHAR_BIT,
 			0, "long", objfile);
       break;
     case FT_SIGNED_LONG:
       type = init_type (TYPE_CODE_INT,
-			gdbarch_long_bit (current_gdbarch) / TARGET_CHAR_BIT,
+			gdbarch_long_bit (gdbarch) / TARGET_CHAR_BIT,
 			0, "long", objfile);	/* FIXME -fnf */
       break;
     case FT_UNSIGNED_LONG:
       type = init_type (TYPE_CODE_INT,
-			gdbarch_long_bit (current_gdbarch) / TARGET_CHAR_BIT,
+			gdbarch_long_bit (gdbarch) / TARGET_CHAR_BIT,
 			TYPE_FLAG_UNSIGNED, "unsigned long", objfile);
       break;
     case FT_LONG_LONG:
       type = init_type (TYPE_CODE_INT,
-			gdbarch_long_long_bit
-			  (current_gdbarch) / TARGET_CHAR_BIT,
+			gdbarch_long_long_bit (gdbarch) / TARGET_CHAR_BIT,
 			0, "long long", objfile);
       break;
     case FT_SIGNED_LONG_LONG:
       type = init_type (TYPE_CODE_INT,
-			gdbarch_long_long_bit
-			  (current_gdbarch) / TARGET_CHAR_BIT,
+			gdbarch_long_long_bit (gdbarch) / TARGET_CHAR_BIT,
 			0, "signed long long", objfile);
       break;
     case FT_UNSIGNED_LONG_LONG:
       type = init_type (TYPE_CODE_INT,
-			gdbarch_long_long_bit
-			  (current_gdbarch) / TARGET_CHAR_BIT,
+			gdbarch_long_long_bit (gdbarch) / TARGET_CHAR_BIT,
 			TYPE_FLAG_UNSIGNED, "unsigned long long", objfile);
       break;
     case FT_FLOAT:
       type = init_type (TYPE_CODE_FLT,
-			gdbarch_float_bit (current_gdbarch) / TARGET_CHAR_BIT,
+			gdbarch_float_bit (gdbarch) / TARGET_CHAR_BIT,
 			0, "float", objfile);
       break;
     case FT_DBL_PREC_FLOAT:
       type = init_type (TYPE_CODE_FLT,
-			gdbarch_double_bit (current_gdbarch) / TARGET_CHAR_BIT,
+			gdbarch_double_bit (gdbarch) / TARGET_CHAR_BIT,
 			0, "double", objfile);
       break;
     case FT_EXT_PREC_FLOAT:
       type = init_type (TYPE_CODE_FLT,
-			gdbarch_long_double_bit (current_gdbarch)
-			  / TARGET_CHAR_BIT,
+			gdbarch_long_double_bit (gdbarch) / TARGET_CHAR_BIT,
 			0, "extended", objfile);
       break;
     }
diff -urpN src/gdb/printcmd.c dev/gdb/printcmd.c
--- src/gdb/printcmd.c	2007-11-05 12:32:31.000000000 +0100
+++ dev/gdb/printcmd.c	2007-11-21 09:36:31.000000000 +0100
@@ -167,6 +167,7 @@ static void do_one_display (struct displ
 static struct format_data
 decode_format (char **string_ptr, int oformat, int osize)
 {
+  struct gdbarch *gdbarch = current_gdbarch;
   struct format_data val;
   char *p = *string_ptr;
 
@@ -215,11 +216,11 @@ decode_format (char **string_ptr, int of
       case 'a':
       case 's':
 	/* Pick the appropriate size for an address.  */
-	if (gdbarch_ptr_bit (current_gdbarch) == 64)
+	if (gdbarch_ptr_bit (gdbarch) == 64)
 	  val.size = osize ? 'g' : osize;
-	else if (gdbarch_ptr_bit (current_gdbarch) == 32)
+	else if (gdbarch_ptr_bit (gdbarch) == 32)
 	  val.size = osize ? 'w' : osize;
-	else if (gdbarch_ptr_bit (current_gdbarch) == 16)
+	else if (gdbarch_ptr_bit (gdbarch) == 16)
 	  val.size = osize ? 'h' : osize;
 	else
 	  /* Bad value for gdbarch_ptr_bit.  */
@@ -1029,6 +1030,7 @@ sym_info (char *arg, int from_tty)
 static void
 address_info (char *exp, int from_tty)
 {
+  struct gdbarch *gdbarch = current_gdbarch;
   struct symbol *sym;
   struct minimal_symbol *msymbol;
   long val;
@@ -1125,7 +1127,7 @@ address_info (char *exp, int from_tty)
 
     case LOC_REGISTER:
       printf_filtered (_("a variable in register %s"),
-			 gdbarch_register_name (current_gdbarch, val));
+			 gdbarch_register_name (gdbarch, val));
       break;
 
     case LOC_STATIC:
@@ -1157,12 +1159,12 @@ address_info (char *exp, int from_tty)
 
     case LOC_REGPARM:
       printf_filtered (_("an argument in register %s"),
-			 gdbarch_register_name (current_gdbarch, val));
+			 gdbarch_register_name (gdbarch, val));
       break;
 
     case LOC_REGPARM_ADDR:
       printf_filtered (_("address of an argument in register %s"),
-		       gdbarch_register_name (current_gdbarch, val));
+		       gdbarch_register_name (gdbarch, val));
       break;
 
     case LOC_ARG:
@@ -1183,12 +1185,12 @@ address_info (char *exp, int from_tty)
 
     case LOC_BASEREG:
       printf_filtered (_("a variable at offset %ld from register %s"),
-		       val, gdbarch_register_name (current_gdbarch, basereg));
+		       val, gdbarch_register_name (gdbarch, basereg));
       break;
 
     case LOC_BASEREG_ARG:
       printf_filtered (_("an argument at offset %ld from register %s"),
-		       val, gdbarch_register_name (current_gdbarch, basereg));
+		       val, gdbarch_register_name (gdbarch, basereg));
       break;
 
     case LOC_TYPEDEF:
@@ -1235,7 +1237,7 @@ address_info (char *exp, int from_tty)
     case LOC_HP_THREAD_LOCAL_STATIC:
       printf_filtered (_("\
 a thread-local variable at offset %ld from the thread base register %s"),
-		       val, gdbarch_register_name (current_gdbarch, basereg));
+		       val, gdbarch_register_name (gdbarch, basereg));
       break;
 
     case LOC_OPTIMIZED_OUT:
diff -urpN src/gdb/remote-m32r-sdi.c dev/gdb/remote-m32r-sdi.c
--- src/gdb/remote-m32r-sdi.c	2007-11-17 12:49:19.000000000 +0100
+++ dev/gdb/remote-m32r-sdi.c	2007-11-21 09:33:54.000000000 +0100
@@ -439,6 +439,7 @@ m32r_close (int quitting)
 static void
 m32r_resume (ptid_t ptid, int step, enum target_signal sig)
 {
+  struct gdbarch *gdbarch = current_gdbarch;
   unsigned long pc_addr, bp_addr, ab_addr;
   int ib_breakpoints;
   unsigned char buf[13];
@@ -473,7 +474,7 @@ m32r_resume (ptid_t ptid, int step, enum
       else
 	{
 	  buf[0] = SDI_WRITE_MEMORY;
-	  if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG)
+	  if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
 	    store_long_parameter (buf + 1, pc_addr);
 	  else
 	    store_long_parameter (buf + 1, pc_addr - 1);
@@ -513,7 +514,7 @@ m32r_resume (ptid_t ptid, int step, enum
 	continue;
 
       /* Set PBP. */
-      if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG)
+      if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
 	send_three_arg_cmd (SDI_WRITE_MEMORY, 0xffff8000 + 4 * i, 4,
 			    0x00000006);
       else
@@ -540,7 +541,7 @@ m32r_resume (ptid_t ptid, int step, enum
       store_long_parameter (buf + 5, 4);
       if ((bp_addr & 2) == 0 && bp_addr != (pc_addr & 0xfffffffc))
 	{
-	  if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG)
+	  if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
 	    {
 	      buf[9] = dbt_bp_entry[0];
 	      buf[10] = dbt_bp_entry[1];
@@ -557,7 +558,7 @@ m32r_resume (ptid_t ptid, int step, enum
 	}
       else
 	{
-	  if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG)
+	  if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
 	    {
 	      if ((bp_addr & 2) == 0)
 		{
@@ -604,7 +605,7 @@ m32r_resume (ptid_t ptid, int step, enum
 	continue;
 
       /* DBC register */
-      if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG)
+      if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
 	{
 	  switch (ab_type[i])
 	    {
@@ -685,6 +686,7 @@ gdb_cntrl_c (int signo)
 static ptid_t
 m32r_wait (ptid_t ptid, struct target_waitstatus *status)
 {
+  struct gdbarch *gdbarch = current_gdbarch;
   static RETSIGTYPE (*prev_sigint) ();
   unsigned long bp_addr, pc_addr;
   int ib_breakpoints;
@@ -745,7 +747,7 @@ m32r_wait (ptid_t ptid, struct target_wa
   if (last_pc_addr != 0xffffffff)
     {
       buf[0] = SDI_WRITE_MEMORY;
-      if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG)
+      if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
 	store_long_parameter (buf + 1, last_pc_addr);
       else
 	store_long_parameter (buf + 1, last_pc_addr - 1);
@@ -774,7 +776,7 @@ m32r_wait (ptid_t ptid, struct target_wa
 	     address, we have to take care of it later. */
 	  if ((pc_addr & 0x2) != 0)
 	    {
-	      if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG)
+	      if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
 		{
 		  if ((bp_data[i][2] & 0x80) != 0)
 		    {
@@ -836,7 +838,7 @@ m32r_wait (ptid_t ptid, struct target_wa
 	  c = serial_readchar (sdi_desc, SDI_TIMEOUT);
 	  if (c != '-' && recv_data (buf, 4) != -1)
 	    {
-	      if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG)
+	      if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
 		{
 		  if ((buf[3] & 0x1) == 0x1)
 		    hit_watchpoint_addr = ab_address[i];
diff -urpN src/gdb/remote-mips.c dev/gdb/remote-mips.c
--- src/gdb/remote-mips.c	2007-10-10 19:04:38.000000000 +0200
+++ dev/gdb/remote-mips.c	2007-11-21 09:32:20.000000000 +0100
@@ -1592,10 +1592,12 @@ static void
 mips_open (char *name, int from_tty)
 {
   const char *monitor_prompt = NULL;
-  if (gdbarch_bfd_arch_info (current_gdbarch) != NULL
-      && gdbarch_bfd_arch_info (current_gdbarch)->arch == bfd_arch_mips)
+  struct gdbarch *gdbarch = current_gdbarch;
+
+  if (gdbarch_bfd_arch_info (gdbarch) != NULL
+      && gdbarch_bfd_arch_info (gdbarch)->arch == bfd_arch_mips)
     {
-    switch (gdbarch_bfd_arch_info (current_gdbarch)->mach)
+    switch (gdbarch_bfd_arch_info (gdbarch)->mach)
       {
       case bfd_mach_mips4100:
       case bfd_mach_mips4300:
@@ -1876,22 +1878,24 @@ mips_wait (ptid_t ptid, struct target_wa
 static int
 mips_map_regno (int regno)
 {
+  struct gdbarch *gdbarch = current_gdbarch;
+
   if (regno < 32)
     return regno;
-  if (regno >= mips_regnum (current_gdbarch)->fp0
-      && regno < mips_regnum (current_gdbarch)->fp0 + 32)
-    return regno - mips_regnum (current_gdbarch)->fp0 + 32;
-  else if (regno == mips_regnum (current_gdbarch)->pc)
+  if (regno >= mips_regnum (gdbarch)->fp0
+      && regno < mips_regnum (gdbarch)->fp0 + 32)
+    return regno - mips_regnum (gdbarch)->fp0 + 32;
+  else if (regno == mips_regnum (gdbarch)->pc)
     return REGNO_OFFSET + 0;
-  else if (regno == mips_regnum (current_gdbarch)->cause)
+  else if (regno == mips_regnum (gdbarch)->cause)
     return REGNO_OFFSET + 1;
-  else if (regno == mips_regnum (current_gdbarch)->hi)
+  else if (regno == mips_regnum (gdbarch)->hi)
     return REGNO_OFFSET + 2;
-  else if (regno == mips_regnum (current_gdbarch)->lo)
+  else if (regno == mips_regnum (gdbarch)->lo)
     return REGNO_OFFSET + 3;
-  else if (regno == mips_regnum (current_gdbarch)->fp_control_status)
+  else if (regno == mips_regnum (gdbarch)->fp_control_status)
     return REGNO_OFFSET + 4;
-  else if (regno == mips_regnum (current_gdbarch)->fp_implementation_revision)
+  else if (regno == mips_regnum (gdbarch)->fp_implementation_revision)
     return REGNO_OFFSET + 5;
   else
     /* FIXME: Is there a way to get the status register?  */
diff -urpN src/gdb/rs6000-tdep.c dev/gdb/rs6000-tdep.c
--- src/gdb/rs6000-tdep.c	2007-11-19 06:05:28.000000000 +0100
+++ dev/gdb/rs6000-tdep.c	2007-11-21 08:48:25.000000000 +0100
@@ -2557,9 +2557,9 @@ e500_pseudo_register_write (struct gdbar
 
 /* Convert a DBX STABS register number to a GDB register number.  */
 static int
-rs6000_stab_reg_to_regnum (int num)
+rs6000_stab_reg_to_regnum (struct gdbarch *gdbarch, int num)
 {
-  struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
 
   if (0 <= num && num <= 31)
     return tdep->ppc_gp0_regnum + num;
@@ -2599,9 +2599,9 @@ rs6000_stab_reg_to_regnum (int num)
 
 /* Convert a Dwarf 2 register number to a GDB register number.  */
 static int
-rs6000_dwarf2_reg_to_regnum (int num)
+rs6000_dwarf2_reg_to_regnum (struct gdbarch *gdbarch, int num)
 {
-  struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
 
   if (0 <= num && num <= 31)
     return tdep->ppc_gp0_regnum + num;
diff -urpN src/gdb/s390-tdep.c dev/gdb/s390-tdep.c
--- src/gdb/s390-tdep.c	2007-11-07 07:33:01.000000000 +0100
+++ dev/gdb/s390-tdep.c	2007-11-21 08:46:44.000000000 +0100
@@ -147,7 +147,7 @@ static int s390_dwarf_regmap[] =
 /* Convert DWARF register number REG to the appropriate register
    number used by GDB.  */
 static int
-s390_dwarf_reg_to_regnum (int reg)
+s390_dwarf_reg_to_regnum (struct gdbarch *gdbarch, int reg)
 {
   int regnum = -1;
 
diff -urpN src/gdb/somread.c dev/gdb/somread.c
--- src/gdb/somread.c	2007-09-21 20:01:23.000000000 +0200
+++ dev/gdb/somread.c	2007-11-21 08:59:19.000000000 +0100
@@ -66,6 +66,7 @@ som_symtab_read (bfd *abfd, struct objfi
   char *symname;
   CONST int symsize = sizeof (struct symbol_dictionary_record);
   CORE_ADDR text_offset, data_offset;
+  struct gdbarch *gdbarch = current_gdbarch;
 
 
   text_offset = ANOFFSET (section_offsets, 0);
@@ -132,7 +133,7 @@ som_symtab_read (bfd *abfd, struct objfi
 	      ms_type = mst_text;
 	      bufp->symbol_value += text_offset;
 	      bufp->symbol_value = gdbarch_smash_text_address
-				     (current_gdbarch, bufp->symbol_value);
+				     (gdbarch, bufp->symbol_value);
 	      break;
 
 	    case ST_ENTRY:
@@ -146,7 +147,7 @@ som_symtab_read (bfd *abfd, struct objfi
 		ms_type = mst_text;
 	      bufp->symbol_value += text_offset;
 	      bufp->symbol_value = gdbarch_smash_text_address
-				     (current_gdbarch, bufp->symbol_value);
+				     (gdbarch, bufp->symbol_value);
 	      break;
 
 	    case ST_STUB:
@@ -154,7 +155,7 @@ som_symtab_read (bfd *abfd, struct objfi
 	      ms_type = mst_solib_trampoline;
 	      bufp->symbol_value += text_offset;
 	      bufp->symbol_value = gdbarch_smash_text_address
-				     (current_gdbarch, bufp->symbol_value);
+				     (gdbarch, bufp->symbol_value);
 	      break;
 
 	    case ST_DATA:
@@ -183,7 +184,7 @@ som_symtab_read (bfd *abfd, struct objfi
 	      ms_type = mst_file_text;
 	      bufp->symbol_value += text_offset;
 	      bufp->symbol_value = gdbarch_smash_text_address
-				     (current_gdbarch, bufp->symbol_value);
+				     (gdbarch, bufp->symbol_value);
 
 	    check_strange_names:
 	      /* Utah GCC 2.5, FSF GCC 2.6 and later generate correct local
@@ -215,7 +216,7 @@ som_symtab_read (bfd *abfd, struct objfi
 	      ms_type = mst_file_text;
 	      bufp->symbol_value += text_offset;
 	      bufp->symbol_value = gdbarch_smash_text_address
-				     (current_gdbarch, bufp->symbol_value);
+				     (gdbarch, bufp->symbol_value);
 	      break;
 
 	    case ST_ENTRY:
@@ -227,7 +228,7 @@ som_symtab_read (bfd *abfd, struct objfi
 	      ms_type = mst_file_text;
 	      bufp->symbol_value += text_offset;
 	      bufp->symbol_value = gdbarch_smash_text_address
-				     (current_gdbarch, bufp->symbol_value);
+				     (gdbarch, bufp->symbol_value);
 	      break;
 
 	    case ST_STUB:
@@ -235,7 +236,7 @@ som_symtab_read (bfd *abfd, struct objfi
 	      ms_type = mst_solib_trampoline;
 	      bufp->symbol_value += text_offset;
 	      bufp->symbol_value = gdbarch_smash_text_address
-				     (current_gdbarch, bufp->symbol_value);
+				     (gdbarch, bufp->symbol_value);
 	      break;
 
 
diff -urpN src/gdb/stabsread.c dev/gdb/stabsread.c
--- src/gdb/stabsread.c	2007-10-19 14:23:20.000000000 +0200
+++ dev/gdb/stabsread.c	2007-11-21 08:45:28.000000000 +0100
@@ -582,6 +582,7 @@ struct symbol *
 define_symbol (CORE_ADDR valu, char *string, int desc, int type,
 	       struct objfile *objfile)
 {
+  struct gdbarch *gdbarch = current_gdbarch;
   struct symbol *sym;
   char *p = (char *) find_name_end (string);
   int deftype;
@@ -666,7 +667,7 @@ define_symbol (CORE_ADDR valu, char *str
 
 	case 'X':
 	  /* SunPRO (3.0 at least) static variable encoding.  */
-	  if (gdbarch_static_transform_name_p (current_gdbarch))
+	  if (gdbarch_static_transform_name_p (gdbarch))
 	    goto normal;
 	  /* ... fall through ... */
 
@@ -951,7 +952,7 @@ define_symbol (CORE_ADDR valu, char *str
       SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
       add_symbol_to_list (sym, &local_symbols);
 
-      if (gdbarch_byte_order (current_gdbarch) != BFD_ENDIAN_BIG)
+      if (gdbarch_byte_order (gdbarch) != BFD_ENDIAN_BIG)
 	{
 	  /* On little-endian machines, this crud is never necessary,
 	     and, if the extra bytes contain garbage, is harmful.  */
@@ -960,10 +961,10 @@ define_symbol (CORE_ADDR valu, char *str
 
       /* If it's gcc-compiled, if it says `short', believe it.  */
       if (processing_gcc_compilation
-	  || gdbarch_believe_pcc_promotion (current_gdbarch))
+	  || gdbarch_believe_pcc_promotion (gdbarch))
 	break;
 
-      if (!gdbarch_believe_pcc_promotion (current_gdbarch))
+      if (!gdbarch_believe_pcc_promotion (gdbarch))
 	{
 	  /* This is the signed type which arguments get promoted to.  */
 	  static struct type *pcc_promotion_type;
@@ -973,14 +974,14 @@ define_symbol (CORE_ADDR valu, char *str
 	  /* Call it "int" because this is mainly C lossage.  */
 	  if (pcc_promotion_type == NULL)
 	    pcc_promotion_type =
-	      init_type (TYPE_CODE_INT, 
-			 gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT,
+	      init_type (TYPE_CODE_INT,
+			 gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT,
 			 0, "int", NULL);
 
 	  if (pcc_unsigned_promotion_type == NULL)
 	    pcc_unsigned_promotion_type =
-	      init_type (TYPE_CODE_INT, 
-			 gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT,
+	      init_type (TYPE_CODE_INT,
+			 gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT,
 			 TYPE_FLAG_UNSIGNED, "unsigned int", NULL);
 
 	  /* If PCC says a parameter is a short or a char, it is
@@ -1011,15 +1012,15 @@ define_symbol (CORE_ADDR valu, char *str
       /* Parameter which is in a register.  */
       SYMBOL_TYPE (sym) = read_type (&p, objfile);
       SYMBOL_CLASS (sym) = LOC_REGPARM;
-      SYMBOL_VALUE (sym) = gdbarch_stab_reg_to_regnum (current_gdbarch, valu);
-      if (SYMBOL_VALUE (sym) >= gdbarch_num_regs (current_gdbarch)
-				  + gdbarch_num_pseudo_regs (current_gdbarch))
+      SYMBOL_VALUE (sym) = gdbarch_stab_reg_to_regnum (gdbarch, valu);
+      if (SYMBOL_VALUE (sym) >= gdbarch_num_regs (gdbarch)
+				  + gdbarch_num_pseudo_regs (gdbarch))
 	{
 	  reg_value_complaint (SYMBOL_VALUE (sym),
-			       gdbarch_num_regs (current_gdbarch)
-				 + gdbarch_num_pseudo_regs (current_gdbarch),
+			       gdbarch_num_regs (gdbarch)
+				 + gdbarch_num_pseudo_regs (gdbarch),
 			       SYMBOL_PRINT_NAME (sym));
-	  SYMBOL_VALUE (sym) = gdbarch_sp_regnum (current_gdbarch);
+	  SYMBOL_VALUE (sym) = gdbarch_sp_regnum (gdbarch);
 	  /* Known safe, though useless */
 	}
       SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
@@ -1030,15 +1031,15 @@ define_symbol (CORE_ADDR valu, char *str
       /* Register variable (either global or local).  */
       SYMBOL_TYPE (sym) = read_type (&p, objfile);
       SYMBOL_CLASS (sym) = LOC_REGISTER;
-      SYMBOL_VALUE (sym) = gdbarch_stab_reg_to_regnum (current_gdbarch, valu);
-      if (SYMBOL_VALUE (sym) >= gdbarch_num_regs (current_gdbarch)
-				+ gdbarch_num_pseudo_regs (current_gdbarch))
+      SYMBOL_VALUE (sym) = gdbarch_stab_reg_to_regnum (gdbarch, valu);
+      if (SYMBOL_VALUE (sym) >= gdbarch_num_regs (gdbarch)
+				+ gdbarch_num_pseudo_regs (gdbarch))
 	{
 	  reg_value_complaint (SYMBOL_VALUE (sym),
-			       gdbarch_num_regs (current_gdbarch)
-				 + gdbarch_num_pseudo_regs (current_gdbarch),
+			       gdbarch_num_regs (gdbarch)
+				 + gdbarch_num_pseudo_regs (gdbarch),
 			       SYMBOL_PRINT_NAME (sym));
-	  SYMBOL_VALUE (sym) = gdbarch_sp_regnum (current_gdbarch);
+	  SYMBOL_VALUE (sym) = gdbarch_sp_regnum (gdbarch);
 	  /* Known safe, though useless */
 	}
       SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
@@ -1066,8 +1067,7 @@ define_symbol (CORE_ADDR valu, char *str
 
 	  if (local_symbols
 	      && local_symbols->nsyms > 0
-	      && gdbarch_stabs_argument_has_addr (current_gdbarch,
-						  SYMBOL_TYPE (sym)))
+	      && gdbarch_stabs_argument_has_addr (gdbarch, SYMBOL_TYPE (sym)))
 	    {
 	      struct symbol *prev_sym;
 	      prev_sym = local_symbols->symbol[local_symbols->nsyms - 1];
@@ -1096,8 +1096,8 @@ define_symbol (CORE_ADDR valu, char *str
       SYMBOL_TYPE (sym) = read_type (&p, objfile);
       SYMBOL_CLASS (sym) = LOC_STATIC;
       SYMBOL_VALUE_ADDRESS (sym) = valu;
-      if (gdbarch_static_transform_name_p (current_gdbarch)
-	  && gdbarch_static_transform_name (current_gdbarch,
+      if (gdbarch_static_transform_name_p (gdbarch)
+	  && gdbarch_static_transform_name (gdbarch,
 					    DEPRECATED_SYMBOL_NAME (sym))
 	     != DEPRECATED_SYMBOL_NAME (sym))
 	{
@@ -1106,7 +1106,7 @@ define_symbol (CORE_ADDR valu, char *str
 	  if (msym != NULL)
 	    {
 	      DEPRECATED_SYMBOL_NAME (sym) = gdbarch_static_transform_name
-					       (current_gdbarch,	
+					       (gdbarch,
 						DEPRECATED_SYMBOL_NAME (sym));
 	      SYMBOL_VALUE_ADDRESS (sym) = SYMBOL_VALUE_ADDRESS (msym);
 	    }
@@ -1279,8 +1279,8 @@ define_symbol (CORE_ADDR valu, char *str
       SYMBOL_TYPE (sym) = read_type (&p, objfile);
       SYMBOL_CLASS (sym) = LOC_STATIC;
       SYMBOL_VALUE_ADDRESS (sym) = valu;
-      if (gdbarch_static_transform_name_p (current_gdbarch)
-	  && gdbarch_static_transform_name (current_gdbarch,
+      if (gdbarch_static_transform_name_p (gdbarch)
+	  && gdbarch_static_transform_name (gdbarch,
 					    DEPRECATED_SYMBOL_NAME (sym))
 	     != DEPRECATED_SYMBOL_NAME (sym))
 	{
@@ -1289,7 +1289,7 @@ define_symbol (CORE_ADDR valu, char *str
 	  if (msym != NULL)
 	    {
 	      DEPRECATED_SYMBOL_NAME (sym) = gdbarch_static_transform_name
-					       (current_gdbarch,	
+					       (gdbarch,	
 						DEPRECATED_SYMBOL_NAME (sym));
 	      SYMBOL_VALUE_ADDRESS (sym) = SYMBOL_VALUE_ADDRESS (msym);
 	    }
@@ -1311,15 +1311,15 @@ define_symbol (CORE_ADDR valu, char *str
       /* Reference parameter which is in a register.  */
       SYMBOL_TYPE (sym) = read_type (&p, objfile);
       SYMBOL_CLASS (sym) = LOC_REGPARM_ADDR;
-      SYMBOL_VALUE (sym) = gdbarch_stab_reg_to_regnum (current_gdbarch, valu);
-      if (SYMBOL_VALUE (sym) >= gdbarch_num_regs (current_gdbarch)
-				+ gdbarch_num_pseudo_regs (current_gdbarch))
+      SYMBOL_VALUE (sym) = gdbarch_stab_reg_to_regnum (gdbarch, valu);
+      if (SYMBOL_VALUE (sym) >= gdbarch_num_regs (gdbarch)
+				+ gdbarch_num_pseudo_regs (gdbarch))
 	{
 	  reg_value_complaint (SYMBOL_VALUE (sym),
-			       gdbarch_num_regs (current_gdbarch)
-				 + gdbarch_num_pseudo_regs (current_gdbarch),
+			       gdbarch_num_regs (gdbarch)
+				 + gdbarch_num_pseudo_regs (gdbarch),
 			       SYMBOL_PRINT_NAME (sym));
-	  SYMBOL_VALUE (sym) = gdbarch_sp_regnum (current_gdbarch);
+	  SYMBOL_VALUE (sym) = gdbarch_sp_regnum (gdbarch);
 	  /* Known safe, though useless */
 	}
       SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
@@ -1351,7 +1351,7 @@ define_symbol (CORE_ADDR valu, char *str
      of by value, i.e. they will pass the address of a structure (in a
      register or on the stack) instead of the structure itself.  */
 
-  if (gdbarch_stabs_argument_has_addr (current_gdbarch, SYMBOL_TYPE (sym))
+  if (gdbarch_stabs_argument_has_addr (gdbarch, SYMBOL_TYPE (sym))
       && (SYMBOL_CLASS (sym) == LOC_REGPARM || SYMBOL_CLASS (sym) == LOC_ARG))
     {
       /* We have to convert LOC_REGPARM to LOC_REGPARM_ADDR (for
diff -urpN src/gdb/xtensa-tdep.c dev/gdb/xtensa-tdep.c
--- src/gdb/xtensa-tdep.c	2007-11-17 12:49:19.000000000 +0100
+++ dev/gdb/xtensa-tdep.c	2007-11-21 08:38:25.000000000 +0100
@@ -303,18 +303,17 @@ xtensa_register_type (struct gdbarch *gd
    to n for An.  So, we only have to add the base number for A0.  */
 
 static int
-xtensa_reg_to_regnum (int regnum)
+xtensa_reg_to_regnum (struct gdbarch *gdbarch, int regnum)
 {
   int i;
 
   if (regnum >= 0 && regnum < 16)
-    return gdbarch_tdep (current_gdbarch)->a0_base + regnum;
+    return gdbarch_tdep (gdbarch)->a0_base + regnum;
 
   for (i = 0;
-       i < gdbarch_num_regs (current_gdbarch)
-	   + gdbarch_num_pseudo_regs (current_gdbarch);
+       i < gdbarch_num_regs (gdbarch) + gdbarch_num_pseudo_regs (gdbarch);
        i++)
-    if (regnum == gdbarch_tdep (current_gdbarch)->regmap[i].target_number)
+    if (regnum == gdbarch_tdep (gdbarch)->regmap[i].target_number)
       return i;
 
   internal_error (__FILE__, __LINE__,

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