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] [2/2] Get rid of current_gdbarch in tdeps


Hi,

this patch replaces some occurences in the tdep files. The changes are mostly trivial or mechanical.

Tested on x86 and via gdb_mbuild.

Ok ?

ChangeLog:

	* alpha-tdep.c (alpha_heuristic_proc_start)
	(alpha_sigtramp_register_address): Add gdbarch as parameter. Replace
	current_gdbarch by gdbarch.

(alpha_heuristic_frame_unwind_cache): Use get_frame_arch to get at the
current architecture by frame_info. Update alpha_heuristic_proc_start call.


	(alpha_sigtramp_frame_this_id, alpha_sigtramp_frame_prev_register): Use
	get_frame_arch to get at the current architecture by frame_info. Update
	alpha_sigtramp_register_address call.

	* arm-tdep.c (thumb_scan_prologue): Add gdbarch as parameter and replace
	current_gdbarch by gdbarch. Update caller.
	(convert_to_extended, convert_from_extended): Add endianess parameter
	for comparison. Update caller.
	(arm_extract_return_value, arm_store_return_value): Use
	get_regcache_arch to get at the current	architecture.

	* cris-tdep.c (cris_register_size): Add gdbarch as parameter. Replace
	current_gdbarch by gdbarch. Update caller.
	(cris_gdb_func, move_to_preg_op, none_reg_mode_move_from_preg_op): Add
	gdbarch as parameter. Update caller. Replace current_gdbarch by gdbarch.

	* h8300-tdep.c (E_PSEUDO_CCR_REGNUM, E_PSEUDO_EXR_REGNUM, BINWORD): Add
	gdbarch	as parameter. Update caller.	
	(h8300_init_frame_cache): Add gdbarch as parameter. Replace
	current_gdbarch by gdbarch. Update caller.

* hppa-tdep.c (skip_prologue_hard_way): Add gdbarch as parameter and update caller. Replace current_gdbarch by gdbarch.

* m32c-tdep.c (m32c_skip_trampoline_code): Use get_frame_arch to get at
the current architecture. Replace current_gdbarch by gdbarch.
* m68hc11-tdep.c (m68hc11_frame_unwind_cache): Likewise.
(STACK_CORRECTION, USE_PAGE_REGISTER): Replace M6811_TDEP by its
expression. Add gdbarch as parameter and replace current_gdbarch with
it. Update caller.
(M6811_TDEP): Remove.
(m68hc11_frame_prev_register): Use get_frame_arch to get at the current
architecture.
(m68hc11_scan_prologue): Add gdbarch as parameter. Replace current_gdbarch by gdbarch. Update caller.


	* m68k-tdep.c (m68k_analyze_prologue): Add gdbarch as parameter and
	update caller.
	(m68k_analyze_register_saves): Likewise. Also replace current_gdbarch
	by gdbarch.

	* rs6000-tdep.c (skip_prologue): Add gdbarch as parameter and update
	caller. Relace current_gdbarch by gdbarch.
	(altivec_register_p, spe_register_p): Likewise.
	* ppc-tdep.h (altivec_register_p, spe_register_p): Add gdbarch as
	parameter.
	* ppc-linux-nat.c (fetch_register, store_register): Update caller of
	altivec_register_p and spe_register_p.

* score-tdep.c (score_fetch_inst): Add gdbarch as parameter. Update caller. Replace current_gdbarch by gdbarch.
(score_analyze_prologue): use get_frame_arch to get at the current
architecture.


	* sparc-tdep.h (sparc_analyze_prologue): Add gdbarch as parameter.
	* sparc-tdep.c (sparc_analyze_prologue): Likewise. Replace
	current_gdbarch by gdbarch. Update caller.
	(sparc_frame_cache): Use get_frame_arch to get at the current
	architecture.
	* sparce64-tdep.c (sparc64_skip_prologue): Update call of
	sparc_analyze_prologue.



diff -urpN src2/gdb/alpha-tdep.c dev2/gdb/alpha-tdep.c
--- src2/gdb/alpha-tdep.c	2008-01-09 12:08:05.000000000 +0100
+++ dev2/gdb/alpha-tdep.c	2008-01-09 12:26:53.000000000 +0100
@@ -768,9 +768,9 @@ alpha_sigtramp_frame_unwind_cache (struc
    all arithmetic, it doesn't seem worthwhile to cache it.  */
 
 static CORE_ADDR
-alpha_sigtramp_register_address (CORE_ADDR sigcontext_addr, int regnum)
+alpha_sigtramp_register_address (struct gdbarch *gdbarch, CORE_ADDR sigcontext_addr, int regnum)
 { 
-  struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
 
   if (regnum >= 0 && regnum < 32)
     return sigcontext_addr + tdep->sc_regs_offset + regnum * 8;
@@ -790,9 +790,10 @@ alpha_sigtramp_frame_this_id (struct fra
 			      void **this_prologue_cache,
 			      struct frame_id *this_id)
 {
+  struct gdbarch *gdbarch = get_frame_arch (next_frame);
+  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   struct alpha_sigtramp_unwind_cache *info
     = alpha_sigtramp_frame_unwind_cache (next_frame, this_prologue_cache);
-  struct gdbarch_tdep *tdep;
   CORE_ADDR stack_addr, code_addr;
 
   /* If the OSABI couldn't locate the sigcontext, give up.  */
@@ -802,7 +803,6 @@ alpha_sigtramp_frame_this_id (struct fra
   /* If we have dynamic signal trampolines, find their start.
      If we do not, then we must assume there is a symbol record
      that can provide the start address.  */
-  tdep = gdbarch_tdep (get_frame_arch (next_frame));
   if (tdep->dynamic_sigtramp_offset)
     {
       int offset;
@@ -817,7 +817,7 @@ alpha_sigtramp_frame_this_id (struct fra
     code_addr = frame_func_unwind (next_frame, SIGTRAMP_FRAME);
 
   /* The stack address is trivially read from the sigcontext.  */
-  stack_addr = alpha_sigtramp_register_address (info->sigcontext_addr,
+  stack_addr = alpha_sigtramp_register_address (gdbarch, info->sigcontext_addr,
 						ALPHA_SP_REGNUM);
   stack_addr = get_frame_memory_unsigned (next_frame, stack_addr,
 					  ALPHA_REGISTER_SIZE);
@@ -841,7 +841,7 @@ alpha_sigtramp_frame_prev_register (stru
   if (info->sigcontext_addr != 0)
     {
       /* All integer and fp registers are stored in memory.  */
-      addr = alpha_sigtramp_register_address (info->sigcontext_addr, regnum);
+      addr = alpha_sigtramp_register_address (get_frame_arch (next_frame), info->sigcontext_addr, regnum);
       if (addr != 0)
 	{
 	  *optimizedp = 0;
@@ -920,9 +920,9 @@ static unsigned int heuristic_fence_post
    function.  But we're guessing anyway...  */
 
 static CORE_ADDR
-alpha_heuristic_proc_start (CORE_ADDR pc)
+alpha_heuristic_proc_start (struct gdbarch *gdbarch, CORE_ADDR pc)
 {
-  struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   CORE_ADDR last_non_nop = pc;
   CORE_ADDR fence = pc - heuristic_fence_post;
   CORE_ADDR orig_pc = pc;
@@ -999,6 +999,7 @@ alpha_heuristic_frame_unwind_cache (stru
 				    void **this_prologue_cache,
 				    CORE_ADDR start_pc)
 {
+  struct gdbarch *gdbarch = get_frame_arch (next_frame);
   struct alpha_heuristic_unwind_cache *info;
   ULONGEST val;
   CORE_ADDR limit_pc, cur_pc;
@@ -1013,7 +1014,7 @@ alpha_heuristic_frame_unwind_cache (stru
 
   limit_pc = frame_pc_unwind (next_frame);
   if (start_pc == 0)
-    start_pc = alpha_heuristic_proc_start (limit_pc);
+    start_pc = alpha_heuristic_proc_start (gdbarch, limit_pc);
   info->start_pc = start_pc;
 
   frame_reg = ALPHA_SP_REGNUM;
diff -urpN src2/gdb/arm-tdep.c dev2/gdb/arm-tdep.c
--- src2/gdb/arm-tdep.c	2008-01-09 12:08:05.000000000 +0100
+++ dev2/gdb/arm-tdep.c	2008-01-09 12:38:51.000000000 +0100
@@ -177,9 +177,9 @@ static void set_disassembly_style_sfunc(
 static void set_disassembly_style (void);
 
 static void convert_from_extended (const struct floatformat *, const void *,
-				   void *);
+				   void *, int);
 static void convert_to_extended (const struct floatformat *, void *,
-				 const void *);
+				 const void *, int);
 
 struct arm_prologue_cache
 {
@@ -534,7 +534,7 @@ arm_skip_prologue (struct gdbarch *gdbar
 /* *INDENT-ON* */
 
 static void
-thumb_scan_prologue (CORE_ADDR prev_pc, struct arm_prologue_cache *cache)
+thumb_scan_prologue (struct gdbarch *gdbarch, CORE_ADDR prev_pc, struct arm_prologue_cache *cache)
 {
   CORE_ADDR prologue_start;
   CORE_ADDR prologue_end;
@@ -565,8 +565,7 @@ thumb_scan_prologue (CORE_ADDR prev_pc, 
 
   prologue_end = min (prologue_end, prev_pc);
 
-  thumb_analyze_prologue (current_gdbarch, prologue_start, prologue_end,
-			  cache);
+  thumb_analyze_prologue (gdbarch, prologue_start, prologue_end, cache);
 }
 
 /* This function decodes an ARM function prologue to determine:
@@ -656,7 +655,7 @@ arm_scan_prologue (struct frame_info *ne
   /* Check for Thumb prologue.  */
   if (arm_pc_is_thumb (prev_pc))
     {
-      thumb_scan_prologue (prev_pc, cache);
+      thumb_scan_prologue (gdbarch, prev_pc, cache);
       return;
     }
 
@@ -1499,10 +1498,11 @@ arm_register_sim_regno (struct gdbarch *
 
 static void
 convert_from_extended (const struct floatformat *fmt, const void *ptr,
-		       void *dbl)
+		       void *dbl, int endianess)
 {
   DOUBLEST d;
-  if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG)
+
+  if (endianess == BFD_ENDIAN_BIG)
     floatformat_to_doublest (&floatformat_arm_ext_big, ptr, &d);
   else
     floatformat_to_doublest (&floatformat_arm_ext_littlebyte_bigword,
@@ -1511,11 +1511,12 @@ convert_from_extended (const struct floa
 }
 
 static void
-convert_to_extended (const struct floatformat *fmt, void *dbl, const void *ptr)
+convert_to_extended (const struct floatformat *fmt, void *dbl, const void *ptr, int endianess)
 {
   DOUBLEST d;
+
   floatformat_to_doublest (fmt, ptr, &d);
-  if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG)
+  if (endianess == BFD_ENDIAN_BIG)
     floatformat_from_doublest (&floatformat_arm_ext_big, &d, dbl);
   else
     floatformat_from_doublest (&floatformat_arm_ext_littlebyte_bigword,
@@ -2094,9 +2095,11 @@ static void
 arm_extract_return_value (struct type *type, struct regcache *regs,
 			  gdb_byte *valbuf)
 {
+  struct gdbarch *gdbarch = get_regcache_arch (regs);
+
   if (TYPE_CODE_FLT == TYPE_CODE (type))
     {
-      switch (gdbarch_tdep (get_regcache_arch (regs))->fp_model)
+      switch (gdbarch_tdep (gdbarch)->fp_model)
 	{
 	case ARM_FLOAT_FPA:
 	  {
@@ -2107,7 +2110,7 @@ arm_extract_return_value (struct type *t
 
 	    regcache_cooked_read (regs, ARM_F0_REGNUM, tmpbuf);
 	    convert_from_extended (floatformat_from_type (type), tmpbuf,
-				   valbuf);
+				   valbuf, gdbarch_byte_order (gdbarch));
 	  }
 	  break;
 
@@ -2281,15 +2284,17 @@ static void
 arm_store_return_value (struct type *type, struct regcache *regs,
 			const gdb_byte *valbuf)
 {
+  struct gdbarch *gdbarch = get_regcache_arch (regs);
+
   if (TYPE_CODE (type) == TYPE_CODE_FLT)
     {
       char buf[MAX_REGISTER_SIZE];
 
-      switch (gdbarch_tdep (get_regcache_arch (regs))->fp_model)
+      switch (gdbarch_tdep (gdbarch)->fp_model)
 	{
 	case ARM_FLOAT_FPA:
 
-	  convert_to_extended (floatformat_from_type (type), buf, valbuf);
+	  convert_to_extended (floatformat_from_type (type), buf, valbuf, gdbarch_byte_order (gdbarch));
 	  regcache_cooked_write (regs, ARM_F0_REGNUM, buf);
 	  break;
 
diff -urpN src2/gdb/cris-tdep.c dev2/gdb/cris-tdep.c
--- src2/gdb/cris-tdep.c	2008-01-09 12:08:05.000000000 +0100
+++ dev2/gdb/cris-tdep.c	2008-01-09 14:39:16.000000000 +0100
@@ -699,7 +699,8 @@ cris_get_signed_offset (unsigned short i
 
 /* Calls an op function given the op-type, working on the insn and the
    inst_env.  */
-static void cris_gdb_func (enum cris_op_type, unsigned short, inst_env_type *);
+static void cris_gdb_func (struct gdbarch *, enum cris_op_type, unsigned short,
+			   inst_env_type *);
 
 static struct gdbarch *cris_gdbarch_init (struct gdbarch_info,
                                           struct gdbarch_list *);
@@ -1547,9 +1548,9 @@ cris_spec_reg_applicable (struct cris_sp
    register, -1 for an invalid register.  */
 
 static int
-cris_register_size (int regno)
+cris_register_size (struct gdbarch *gdbarch, int regno)
 {
-  struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   int i;
   int spec_regno;
   
@@ -1574,8 +1575,8 @@ cris_register_size (int regno)
       /* Special register not applicable to this CRIS version.  */
       return 0;
     }
-  else if (regno >= gdbarch_pc_regnum (current_gdbarch)
-	   && regno < gdbarch_num_regs (current_gdbarch))
+  else if (regno >= gdbarch_pc_regnum (gdbarch)
+	   && regno < gdbarch_num_regs (gdbarch))
     {
       /* This will apply to CRISv32 only where there are additional registers
 	 after the special registers (pseudo PC and support registers).  */
@@ -1593,7 +1594,7 @@ static int
 cris_cannot_fetch_register (struct gdbarch *gdbarch, int regno)
 {
   return ((regno < 0 || regno >= gdbarch_num_regs (gdbarch))
-          || (cris_register_size (regno) == 0));
+          || (cris_register_size (gdbarch, regno) == 0));
 }
 
 /* Nonzero if regno should not be written to the target, for various 
@@ -1610,7 +1611,7 @@ cris_cannot_store_register (struct gdbar
 
   if (regno < 0
       || regno >= gdbarch_num_regs (gdbarch)
-      || cris_register_size (regno) == 0)
+      || cris_register_size (gdbarch, regno) == 0)
     /* Not implemented.  */
     return 1;
 
@@ -1635,7 +1636,7 @@ static int
 crisv32_cannot_fetch_register (struct gdbarch *gdbarch, int regno)
 {
   return ((regno < 0 || regno >= gdbarch_num_regs (gdbarch))
-          || (cris_register_size (regno) == 0));
+          || (cris_register_size (gdbarch, regno) == 0));
 }
 
 /* Nonzero if regno should not be written to the target, for various 
@@ -1652,7 +1653,7 @@ crisv32_cannot_store_register (struct gd
 
   if (regno < 0
       || regno >= gdbarch_num_regs (gdbarch)
-      || cris_register_size (regno) == 0)
+      || cris_register_size (gdbarch, regno) == 0)
     /* Not implemented.  */
     return 1;
 
@@ -2132,7 +2133,7 @@ find_step_target (struct frame_info *fra
         }
       else
         {
-          cris_gdb_func (cris_opcodes[i].op, insn, inst_env);
+          cris_gdb_func (gdbarch, cris_opcodes[i].op, insn, inst_env);
         }
     } while (!inst_env->invalid 
              && (inst_env->prefix_found || inst_env->xflag_found 
@@ -2928,7 +2929,8 @@ none_reg_mode_jump_op (unsigned short in
 /* Handles moves to special registers (aka P-register) for all modes.  */
 
 static void 
-move_to_preg_op (unsigned short inst, inst_env_type *inst_env)
+move_to_preg_op (struct gdbarch *gdbarch, unsigned short inst,
+		 inst_env_type *inst_env)
 {
   if (inst_env->prefix_found)
     {
@@ -2959,11 +2961,11 @@ move_to_preg_op (unsigned short inst, in
             }
 
           /* The increment depends on the size of the special register.  */
-          if (cris_register_size (cris_get_operand2 (inst)) == 1)
+          if (cris_register_size (gdbarch, cris_get_operand2 (inst)) == 1)
             {
               process_autoincrement (INST_BYTE_SIZE, inst, inst_env);
             }
-          else if (cris_register_size (cris_get_operand2 (inst)) == 2)
+          else if (cris_register_size (gdbarch, cris_get_operand2 (inst)) == 2)
             {
               process_autoincrement (INST_WORD_SIZE, inst, inst_env);
             }
@@ -2983,7 +2985,8 @@ move_to_preg_op (unsigned short inst, in
    except register.  */
 
 static void 
-none_reg_mode_move_from_preg_op (unsigned short inst, inst_env_type *inst_env)
+none_reg_mode_move_from_preg_op (struct gdbarch *gdbarch, unsigned short inst,
+				 inst_env_type *inst_env)
 {
   if (inst_env->prefix_found)
     {
@@ -3014,11 +3017,11 @@ none_reg_mode_move_from_preg_op (unsigne
             }
           
           /* The increment depends on the size of the special register.  */
-          if (cris_register_size (cris_get_operand2 (inst)) == 1)
+          if (cris_register_size (gdbarch, cris_get_operand2 (inst)) == 1)
             {
               process_autoincrement (INST_BYTE_SIZE, inst, inst_env);
             }
-          else if (cris_register_size (cris_get_operand2 (inst)) == 2)
+          else if (cris_register_size (gdbarch, cris_get_operand2 (inst)) == 2)
             {
               process_autoincrement (INST_WORD_SIZE, inst, inst_env);
             }
@@ -3698,8 +3701,8 @@ quick_mode_and_cmp_move_or_op (unsigned 
 /* Translate op_type to a function and call it.  */
 
 static void
-cris_gdb_func (enum cris_op_type op_type, unsigned short inst, 
-	       inst_env_type *inst_env)
+cris_gdb_func (struct gdbarch *gdbarch, enum cris_op_type op_type,
+	       unsigned short inst, inst_env_type *inst_env)
 {
   switch (op_type)
     {
@@ -3768,7 +3771,7 @@ cris_gdb_func (enum cris_op_type op_type
       break;
 
     case cris_move_to_preg_op:
-      move_to_preg_op (inst, inst_env);
+      move_to_preg_op (gdbarch, inst, inst_env);
       break;
 
     case cris_muls_op:
@@ -3792,7 +3795,7 @@ cris_gdb_func (enum cris_op_type op_type
       break;
 
     case cris_none_reg_mode_move_from_preg_op:
-      none_reg_mode_move_from_preg_op (inst, inst_env);
+      none_reg_mode_move_from_preg_op (gdbarch, inst, inst_env);
       break;
 
     case cris_quick_mode_add_sub_op:
diff -urpN src2/gdb/h8300-tdep.c dev2/gdb/h8300-tdep.c
--- src2/gdb/h8300-tdep.c	2008-01-09 12:08:05.000000000 +0100
+++ dev2/gdb/h8300-tdep.c	2008-01-09 13:00:30.000000000 +0100
@@ -60,8 +60,8 @@ enum gdb_regnum
 
 #define H8300_MAX_NUM_REGS 18
 
-#define E_PSEUDO_CCR_REGNUM (gdbarch_num_regs (current_gdbarch))
-#define E_PSEUDO_EXR_REGNUM (gdbarch_num_regs (current_gdbarch)+1)
+#define E_PSEUDO_CCR_REGNUM(gdbarch) (gdbarch_num_regs (gdbarch))
+#define E_PSEUDO_EXR_REGNUM(gdbarch) (gdbarch_num_regs (gdbarch)+1)
 
 struct h8300_frame_cache
 {
@@ -90,8 +90,8 @@ static int is_h8300smode (struct gdbarch
 static int is_h8300sxmode (struct gdbarch *gdbarch);
 static int is_h8300_normal_mode (struct gdbarch *gdbarch);
 
-#define BINWORD ((is_h8300hmode (current_gdbarch) \
-		  && !is_h8300_normal_mode (current_gdbarch)) \
+#define BINWORD(gdbarch) ((is_h8300hmode (gdbarch) \
+		  && !is_h8300_normal_mode (gdbarch)) \
 		 ? h8300h_reg_size : h8300_reg_size)
 
 static CORE_ADDR
@@ -118,7 +118,7 @@ h8300_unwind_dummy_id (struct gdbarch *g
 /* Allocate and initialize a frame cache.  */
 
 static void
-h8300_init_frame_cache (struct h8300_frame_cache *cache)
+h8300_init_frame_cache (struct gdbarch *gdbarch, struct h8300_frame_cache *cache)
 {
   int i;
 
@@ -132,7 +132,7 @@ h8300_init_frame_cache (struct h8300_fra
 
   /* Saved registers.  We initialize these to -1 since zero is a valid
      offset (that's where %fp is supposed to be stored).  */
-  for (i = 0; i < gdbarch_num_regs (current_gdbarch); i++)
+  for (i = 0; i < gdbarch_num_regs (gdbarch); i++)
     cache->saved_regs[i] = -1;
 }
 
@@ -421,6 +421,7 @@ h8300_analyze_prologue (CORE_ADDR pc, CO
 static struct h8300_frame_cache *
 h8300_frame_cache (struct frame_info *next_frame, void **this_cache)
 {
+  struct gdbarch *gdbarch = get_frame_arch (next_frame);
   struct h8300_frame_cache *cache;
   char buf[4];
   int i;
@@ -430,7 +431,7 @@ h8300_frame_cache (struct frame_info *ne
     return *this_cache;
 
   cache = FRAME_OBSTACK_ZALLOC (struct h8300_frame_cache);
-  h8300_init_frame_cache (cache);
+  h8300_init_frame_cache (gdbarch, cache);
   *this_cache = cache;
 
   /* In principle, for normal frames, %fp holds the frame pointer,
@@ -443,7 +444,7 @@ h8300_frame_cache (struct frame_info *ne
   if (cache->base == 0)
     return cache;
 
-  cache->saved_regs[E_PC_REGNUM] = -BINWORD;
+  cache->saved_regs[E_PC_REGNUM] = -BINWORD (gdbarch);
 
   cache->pc = frame_func_unwind (next_frame, NORMAL_FRAME);
   current_pc = frame_pc_unwind (next_frame);
@@ -462,18 +463,18 @@ h8300_frame_cache (struct frame_info *ne
 
       cache->base = frame_unwind_register_unsigned (next_frame, E_SP_REGNUM)
 		    + cache->sp_offset;
-      cache->saved_sp = cache->base + BINWORD;
+      cache->saved_sp = cache->base + BINWORD (gdbarch);
       cache->saved_regs[E_PC_REGNUM] = 0;
     }
   else
     {
-      cache->saved_sp = cache->base + 2 * BINWORD;
-      cache->saved_regs[E_PC_REGNUM] = -BINWORD;
+      cache->saved_sp = cache->base + 2 * BINWORD (gdbarch);
+      cache->saved_regs[E_PC_REGNUM] = -BINWORD (gdbarch);
     }
 
   /* Adjust all the saved registers such that they contain addresses
      instead of offsets.  */
-  for (i = 0; i < gdbarch_num_regs (get_frame_arch (next_frame)); i++)
+  for (i = 0; i < gdbarch_num_regs (gdbarch); i++)
     if (cache->saved_regs[i] != -1)
       cache->saved_regs[i] = cache->base - cache->saved_regs[i];
 
@@ -513,7 +514,7 @@ h8300_frame_prev_register (struct frame_
       *addrp = 0;
       *realnump = -1;
       if (valuep)
-	store_unsigned_integer (valuep, BINWORD, cache->saved_sp);
+	store_unsigned_integer (valuep, BINWORD (gdbarch), cache->saved_sp);
       return;
     }
 
@@ -580,7 +581,7 @@ h8300_skip_prologue (struct gdbarch *gdb
         return sal.end;
 
       /* No useable line symbol.  Use prologue parsing method.  */
-      h8300_init_frame_cache (&cache);
+      h8300_init_frame_cache (gdbarch, &cache);
       return h8300_analyze_prologue (func_addr, func_end, &cache);
     }
 
@@ -659,7 +660,7 @@ h8300_push_dummy_call (struct gdbarch *g
 		       int struct_return, CORE_ADDR struct_addr)
 {
   int stack_alloc = 0, stack_offset = 0;
-  int wordsize = BINWORD;
+  int wordsize = BINWORD (gdbarch);
   int reg = E_ARG0_REGNUM;
   int argument;
 
@@ -1013,18 +1014,19 @@ h8300_print_register (struct gdbarch *gd
   rval = get_frame_register_signed (frame, regno);
 
   fprintf_filtered (file, "%-14s ", name);
-  if ((regno == E_PSEUDO_CCR_REGNUM) || \
-      (regno == E_PSEUDO_EXR_REGNUM && is_h8300smode (gdbarch)))
+  if ((regno == E_PSEUDO_CCR_REGNUM (gdbarch)) || \
+      (regno == E_PSEUDO_EXR_REGNUM (gdbarch) && is_h8300smode (gdbarch)))
     {
       fprintf_filtered (file, "0x%02x        ", (unsigned char) rval);
       print_longest (file, 'u', 1, rval);
     }
   else
     {
-      fprintf_filtered (file, "0x%s  ", phex ((ULONGEST) rval, BINWORD));
+      fprintf_filtered (file, "0x%s  ", phex ((ULONGEST) rval,
+			BINWORD (gdbarch)));
       print_longest (file, 'd', 1, rval);
     }
-  if (regno == E_PSEUDO_CCR_REGNUM)
+  if (regno == E_PSEUDO_CCR_REGNUM (gdbarch))
     {
       /* CCR register */
       int C, Z, N, V;
@@ -1063,7 +1065,7 @@ h8300_print_register (struct gdbarch *gd
       if ((Z | (N ^ V)) == 1)
 	fprintf_filtered (file, "<= ");
     }
-  else if (regno == E_PSEUDO_EXR_REGNUM && is_h8300smode (gdbarch))
+  else if (regno == E_PSEUDO_EXR_REGNUM (gdbarch) && is_h8300smode (gdbarch))
     {
       /* EXR register */
       unsigned char l = rval & 0xff;
@@ -1084,11 +1086,13 @@ h8300_print_registers_info (struct gdbar
     {
       for (regno = E_R0_REGNUM; regno <= E_SP_REGNUM; ++regno)
 	h8300_print_register (gdbarch, file, frame, regno);
-      h8300_print_register (gdbarch, file, frame, E_PSEUDO_CCR_REGNUM);
+      h8300_print_register (gdbarch, file, frame,
+			    E_PSEUDO_CCR_REGNUM (gdbarch));
       h8300_print_register (gdbarch, file, frame, E_PC_REGNUM);
       if (is_h8300smode (gdbarch))
 	{
-	  h8300_print_register (gdbarch, file, frame, E_PSEUDO_EXR_REGNUM);
+	  h8300_print_register (gdbarch, file, frame,
+				E_PSEUDO_EXR_REGNUM (gdbarch));
 	  if (is_h8300sxmode (gdbarch))
 	    {
 	      h8300_print_register (gdbarch, file, frame, E_SBR_REGNUM);
@@ -1110,10 +1114,12 @@ h8300_print_registers_info (struct gdbar
   else
     {
       if (regno == E_CCR_REGNUM)
-	h8300_print_register (gdbarch, file, frame, E_PSEUDO_CCR_REGNUM);
-      else if (regno == E_PSEUDO_EXR_REGNUM
+	h8300_print_register (gdbarch, file, frame,
+			      E_PSEUDO_CCR_REGNUM (gdbarch));
+      else if (regno == E_PSEUDO_EXR_REGNUM (gdbarch)
 	       && is_h8300smode (gdbarch))
-	h8300_print_register (gdbarch, file, frame, E_PSEUDO_EXR_REGNUM);
+	h8300_print_register (gdbarch, file, frame,
+			      E_PSEUDO_EXR_REGNUM (gdbarch));
       else
 	h8300_print_register (gdbarch, file, frame, regno);
     }
@@ -1136,9 +1142,9 @@ h8300_register_type (struct gdbarch *gdb
 	case E_FP_REGNUM:
 	  return builtin_type_void_data_ptr;
 	default:
-	  if (regno == E_PSEUDO_CCR_REGNUM)
+	  if (regno == E_PSEUDO_CCR_REGNUM (gdbarch))
 	    return builtin_type_uint8;
-	  else if (regno == E_PSEUDO_EXR_REGNUM)
+	  else if (regno == E_PSEUDO_EXR_REGNUM (gdbarch))
 	    return builtin_type_uint8;
 	  else if (is_h8300hmode (gdbarch))
 	    return builtin_type_int32;
@@ -1153,9 +1159,9 @@ h8300_pseudo_register_read (struct gdbar
 			    struct regcache *regcache, int regno,
 			    gdb_byte *buf)
 {
-  if (regno == E_PSEUDO_CCR_REGNUM)
+  if (regno == E_PSEUDO_CCR_REGNUM (gdbarch))
     regcache_raw_read (regcache, E_CCR_REGNUM, buf);
-  else if (regno == E_PSEUDO_EXR_REGNUM)
+  else if (regno == E_PSEUDO_EXR_REGNUM (gdbarch))
     regcache_raw_read (regcache, E_EXR_REGNUM, buf);
   else
     regcache_raw_read (regcache, regno, buf);
@@ -1166,9 +1172,9 @@ h8300_pseudo_register_write (struct gdba
 			     struct regcache *regcache, int regno,
 			     const gdb_byte *buf)
 {
-  if (regno == E_PSEUDO_CCR_REGNUM)
+  if (regno == E_PSEUDO_CCR_REGNUM (gdbarch))
     regcache_raw_write (regcache, E_CCR_REGNUM, buf);
-  else if (regno == E_PSEUDO_EXR_REGNUM)
+  else if (regno == E_PSEUDO_EXR_REGNUM (gdbarch))
     regcache_raw_write (regcache, E_EXR_REGNUM, buf);
   else
     regcache_raw_write (regcache, regno, buf);
@@ -1178,7 +1184,7 @@ static int
 h8300_dbg_reg_to_regnum (struct gdbarch *gdbarch, int regno)
 {
   if (regno == E_CCR_REGNUM)
-    return E_PSEUDO_CCR_REGNUM;
+    return E_PSEUDO_CCR_REGNUM (gdbarch);
   return regno;
 }
 
@@ -1186,9 +1192,9 @@ static int
 h8300s_dbg_reg_to_regnum (struct gdbarch *gdbarch, int regno)
 {
   if (regno == E_CCR_REGNUM)
-    return E_PSEUDO_CCR_REGNUM;
+    return E_PSEUDO_CCR_REGNUM (gdbarch);
   if (regno == E_EXR_REGNUM)
-    return E_PSEUDO_EXR_REGNUM;
+    return E_PSEUDO_EXR_REGNUM (gdbarch);
   return regno;
 }
 
diff -urpN src2/gdb/hppa-tdep.c dev2/gdb/hppa-tdep.c
--- src2/gdb/hppa-tdep.c	2008-01-09 12:08:05.000000000 +0100
+++ dev2/gdb/hppa-tdep.c	2008-01-09 13:03:50.000000000 +0100
@@ -1469,7 +1469,8 @@ inst_saves_fr (unsigned long inst)
 
 
 static CORE_ADDR
-skip_prologue_hard_way (CORE_ADDR pc, int stop_before_branch)
+skip_prologue_hard_way (struct gdbarch *gdbarch, CORE_ADDR pc,
+			int stop_before_branch)
 {
   char buf[4];
   CORE_ADDR orig_pc = pc;
@@ -1595,10 +1596,10 @@ restart:
 
          FIXME.  Can still die if we have a mix of GR and FR argument
          stores!  */
-      if (reg_num >= (gdbarch_ptr_bit (current_gdbarch) == 64 ? 19 : 23)
+      if (reg_num >= (gdbarch_ptr_bit (gdbarch) == 64 ? 19 : 23)
 	  && reg_num <= 26)
 	{
-	  while (reg_num >= (gdbarch_ptr_bit (current_gdbarch) == 64 ? 19 : 23)
+	  while (reg_num >= (gdbarch_ptr_bit (gdbarch) == 64 ? 19 : 23)
 		 && reg_num <= 26)
 	    {
 	      pc += 4;
@@ -1627,7 +1628,7 @@ restart:
       if ((inst & 0xfc000000) == 0x34000000
 	  && inst_saves_fr (next_inst) >= 4
 	  && inst_saves_fr (next_inst)
-	       <= (gdbarch_ptr_bit (current_gdbarch) == 64 ? 11 : 7))
+	       <= (gdbarch_ptr_bit (gdbarch) == 64 ? 11 : 7))
 	{
 	  /* So we drop into the code below in a reasonable state.  */
 	  reg_num = inst_saves_fr (next_inst);
@@ -1639,11 +1640,11 @@ restart:
          never does prologue scheduling.  So once we see one, skip past
          all of them.  */
       if (reg_num >= 4
-	  && reg_num <= (gdbarch_ptr_bit (current_gdbarch) == 64 ? 11 : 7))
+	  && reg_num <= (gdbarch_ptr_bit (gdbarch) == 64 ? 11 : 7))
 	{
 	  while (reg_num >= 4
 		 && reg_num
-		      <= (gdbarch_ptr_bit (current_gdbarch) == 64 ? 11 : 7))
+		      <= (gdbarch_ptr_bit (gdbarch) == 64 ? 11 : 7))
 	    {
 	      pc += 8;
 	      status = read_memory_nobpt (pc, buf, 4);
@@ -1781,7 +1782,7 @@ hppa_skip_prologue (struct gdbarch *gdba
   if (post_prologue_pc != 0)
     return max (pc, post_prologue_pc);
   else
-    return (skip_prologue_hard_way (pc, 1));
+    return (skip_prologue_hard_way (gdbarch, pc, 1));
 }
 
 /* Return an unwind entry that falls within the frame's code block.  */
@@ -1908,7 +1909,7 @@ hppa_frame_cache (struct frame_info *nex
     else
       start_pc = frame_func_unwind (next_frame, NORMAL_FRAME);
 
-    prologue_end = skip_prologue_hard_way (start_pc, 0);
+    prologue_end = skip_prologue_hard_way (gdbarch, start_pc, 0);
     end_pc = frame_pc_unwind (next_frame);
 
     if (prologue_end != 0 && end_pc > prologue_end)
diff -urpN src2/gdb/m32c-tdep.c dev2/gdb/m32c-tdep.c
--- src2/gdb/m32c-tdep.c	2008-01-09 12:08:05.000000000 +0100
+++ dev2/gdb/m32c-tdep.c	2008-01-09 13:08:10.000000000 +0100
@@ -2332,7 +2332,7 @@ m32c_return_value (struct gdbarch *gdbar
 static CORE_ADDR
 m32c_skip_trampoline_code (struct frame_info *frame, CORE_ADDR stop_pc)
 {
-  struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+  struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (frame));
 
   /* It would be nicer to simply look up the addresses of known
      trampolines once, and then compare stop_pc with them.  However,
diff -urpN src2/gdb/m68hc11-tdep.c dev2/gdb/m68hc11-tdep.c
--- src2/gdb/m68hc11-tdep.c	2008-01-09 12:08:05.000000000 +0100
+++ dev2/gdb/m68hc11-tdep.c	2008-01-09 13:16:50.000000000 +0100
@@ -146,9 +146,8 @@ struct gdbarch_tdep
     int elf_flags;
   };
 
-#define M6811_TDEP gdbarch_tdep (current_gdbarch)
-#define STACK_CORRECTION (M6811_TDEP->stack_correction)
-#define USE_PAGE_REGISTER (M6811_TDEP->use_page_register)
+#define STACK_CORRECTION(gdbarch) (gdbarch_tdep (gdbarch)->stack_correction)
+#define USE_PAGE_REGISTER(gdbarch) (gdbarch_tdep (gdbarch)->use_page_register)
 
 struct m68hc11_unwind_cache
 {
@@ -367,9 +366,9 @@ m68hc11_pseudo_register_write (struct gd
 static const char *
 m68hc11_register_name (struct gdbarch *gdbarch, int reg_nr)
 {
-  if (reg_nr == M68HC12_HARD_PC_REGNUM && USE_PAGE_REGISTER)
+  if (reg_nr == M68HC12_HARD_PC_REGNUM && USE_PAGE_REGISTER (gdbarch))
     return "pc";
-  if (reg_nr == HARD_PC_REGNUM && USE_PAGE_REGISTER)
+  if (reg_nr == HARD_PC_REGNUM && USE_PAGE_REGISTER (gdbarch))
     return "ppc";
   
   if (reg_nr < 0)
@@ -604,8 +603,8 @@ m68hc11_get_return_insn (CORE_ADDR pc)
     - the offset of the previous frame saved address (from current frame)
     - the soft registers which are pushed.  */
 static CORE_ADDR
-m68hc11_scan_prologue (CORE_ADDR pc, CORE_ADDR current_pc,
-                       struct m68hc11_unwind_cache *info)
+m68hc11_scan_prologue (struct gdbarch *gdbarch, CORE_ADDR pc,
+		       CORE_ADDR current_pc, struct m68hc11_unwind_cache *info)
 {
   LONGEST save_addr;
   CORE_ADDR func_end;
@@ -629,7 +628,7 @@ m68hc11_scan_prologue (CORE_ADDR pc, COR
       return pc;
     }
 
-  seq_table = gdbarch_tdep (current_gdbarch)->prologue;
+  seq_table = gdbarch_tdep (gdbarch)->prologue;
   
   /* The 68hc11 stack is as follows:
 
@@ -755,7 +754,7 @@ m68hc11_skip_prologue (struct gdbarch *g
 	return sal.end;
     }
 
-  pc = m68hc11_scan_prologue (pc, (CORE_ADDR) -1, &tmp_cache);
+  pc = m68hc11_scan_prologue (gdbarch, pc, (CORE_ADDR) -1, &tmp_cache);
   return pc;
 }
 
@@ -778,6 +777,7 @@ struct m68hc11_unwind_cache *
 m68hc11_frame_unwind_cache (struct frame_info *next_frame,
                             void **this_prologue_cache)
 {
+  struct gdbarch *gdbarch = get_frame_arch (next_frame);
   ULONGEST prev_sp;
   ULONGEST this_base;
   struct m68hc11_unwind_cache *info;
@@ -808,7 +808,7 @@ m68hc11_frame_unwind_cache (struct frame
 
   current_pc = frame_pc_unwind (next_frame);
   if (info->pc != 0)
-    m68hc11_scan_prologue (info->pc, current_pc, info);
+    m68hc11_scan_prologue (gdbarch, info->pc, current_pc, info);
 
   info->saved_regs[HARD_PC_REGNUM].addr = info->size;
 
@@ -817,7 +817,7 @@ m68hc11_frame_unwind_cache (struct frame
       info->saved_regs[HARD_PC_REGNUM].addr = info->sp_offset;
       this_base = frame_unwind_register_unsigned (next_frame, HARD_SP_REGNUM);
       prev_sp = this_base + info->sp_offset + 2;
-      this_base += STACK_CORRECTION;
+      this_base += STACK_CORRECTION (gdbarch);
     }
   else
     {
@@ -825,7 +825,7 @@ m68hc11_frame_unwind_cache (struct frame
          to before the first saved register giving the SP.  */
       prev_sp = this_base + info->size + 2;
 
-      this_base += STACK_CORRECTION;
+      this_base += STACK_CORRECTION (gdbarch);
       if (soft_regs[SOFT_FP_REGNUM].name)
         info->saved_regs[SOFT_FP_REGNUM].addr = info->size - 2;
    }
@@ -855,8 +855,8 @@ m68hc11_frame_unwind_cache (struct frame
   /* Adjust all the saved registers so that they contain addresses and not
      offsets.  */
   for (i = 0;
-       i < gdbarch_num_regs (current_gdbarch)
-	   + gdbarch_num_pseudo_regs (current_gdbarch) - 1;
+       i < gdbarch_num_regs (gdbarch)
+	   + gdbarch_num_pseudo_regs (gdbarch) - 1;
        i++)
     if (trad_frame_addr_p (info->saved_regs, i))
       {
@@ -916,7 +916,7 @@ m68hc11_frame_prev_register (struct fram
       /* Take into account the 68HC12 specific call (PC + page).  */
       if (info->return_kind == RETURN_RTC
           && *addrp >= 0x08000 && *addrp < 0x0c000
-          && USE_PAGE_REGISTER)
+          && USE_PAGE_REGISTER (get_frame_arch (next_frame)))
         {
           int page_optimized;
 
@@ -1216,7 +1216,7 @@ m68hc11_push_dummy_call (struct gdbarch 
   write_memory (sp, buf, 2);
 
   /* Finally, update the stack pointer...  */
-  sp -= STACK_CORRECTION;
+  sp -= STACK_CORRECTION (gdbarch);
   regcache_cooked_write_unsigned (regcache, HARD_SP_REGNUM, sp);
 
   /* ...and fake a frame pointer.  */
diff -urpN src2/gdb/m68k-tdep.c dev2/gdb/m68k-tdep.c
--- src2/gdb/m68k-tdep.c	2008-01-09 12:08:05.000000000 +0100
+++ dev2/gdb/m68k-tdep.c	2008-01-09 13:30:39.000000000 +0100
@@ -690,7 +690,8 @@ m68k_analyze_frame_setup (CORE_ADDR pc, 
    smaller.  Otherwise, return PC.  */
 
 static CORE_ADDR
-m68k_analyze_register_saves (CORE_ADDR pc, CORE_ADDR current_pc,
+m68k_analyze_register_saves (struct gdbarch *gdbarch, CORE_ADDR pc,
+			     CORE_ADDR current_pc,
 			     struct m68k_frame_cache *cache)
 {
   if (cache->locals >= 0)
@@ -704,7 +705,7 @@ m68k_analyze_register_saves (CORE_ADDR p
 	{
 	  op = read_memory_unsigned_integer (pc, 2);
 	  if (op == P_FMOVEMX_SP
-	      && gdbarch_tdep (current_gdbarch)->fpregs_present)
+	      && gdbarch_tdep (gdbarch)->fpregs_present)
 	    {
 	      /* fmovem.x REGS,-(%sp) */
 	      op = read_memory_unsigned_integer (pc + 2, 2);
@@ -788,13 +789,13 @@ m68k_analyze_register_saves (CORE_ADDR p
    */
 
 static CORE_ADDR
-m68k_analyze_prologue (CORE_ADDR pc, CORE_ADDR current_pc,
-		       struct m68k_frame_cache *cache)
+m68k_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc,
+		       CORE_ADDR current_pc, struct m68k_frame_cache *cache)
 {
   unsigned int op;
 
   pc = m68k_analyze_frame_setup (pc, current_pc, cache);
-  pc = m68k_analyze_register_saves (pc, current_pc, cache);
+  pc = m68k_analyze_register_saves (gdbarch, pc, current_pc, cache);
   if (pc >= current_pc)
     return current_pc;
 
@@ -819,7 +820,7 @@ m68k_skip_prologue (struct gdbarch *gdba
   int op;
 
   cache.locals = -1;
-  pc = m68k_analyze_prologue (start_pc, (CORE_ADDR) -1, &cache);
+  pc = m68k_analyze_prologue (gdbarch, start_pc, (CORE_ADDR) -1, &cache);
   if (cache.locals < 0)
     return start_pc;
   return pc;
@@ -868,7 +869,8 @@ m68k_frame_cache (struct frame_info *nex
 
   cache->pc = frame_func_unwind (next_frame, NORMAL_FRAME);
   if (cache->pc != 0)
-    m68k_analyze_prologue (cache->pc, frame_pc_unwind (next_frame), cache);
+    m68k_analyze_prologue (get_frame_arch (next_frame), cache->pc,
+			   frame_pc_unwind (next_frame), cache);
 
   if (cache->locals < 0)
     {
diff -urpN src2/gdb/ppc-linux-nat.c dev2/gdb/ppc-linux-nat.c
--- src2/gdb/ppc-linux-nat.c	2008-01-01 23:53:12.000000000 +0100
+++ dev2/gdb/ppc-linux-nat.c	2008-01-09 13:39:50.000000000 +0100
@@ -337,7 +337,7 @@ fetch_register (struct regcache *regcach
   unsigned int offset;         /* Offset of registers within the u area. */
   char buf[MAX_REGISTER_SIZE];
 
-  if (altivec_register_p (regno))
+  if (altivec_register_p (gdbarch, regno))
     {
       /* If this is the first time through, or if it is not the first
          time through, and we have comfirmed that there is kernel
@@ -352,7 +352,7 @@ fetch_register (struct regcache *regcach
         AltiVec registers, fall through and return zeroes, because
         regaddr will be -1 in this case.  */
     }
-  else if (spe_register_p (regno))
+  else if (spe_register_p (gdbarch, regno))
     {
       fetch_spe_register (regcache, tid, regno);
       return;
@@ -637,12 +637,12 @@ store_register (const struct regcache *r
   size_t bytes_to_transfer;
   char buf[MAX_REGISTER_SIZE];
 
-  if (altivec_register_p (regno))
+  if (altivec_register_p (gdbarch, regno))
     {
       store_altivec_register (regcache, tid, regno);
       return;
     }
-  else if (spe_register_p (regno))
+  else if (spe_register_p (gdbarch, regno))
     {
       store_spe_register (regcache, tid, regno);
       return;
diff -urpN src2/gdb/ppc-tdep.h dev2/gdb/ppc-tdep.h
--- src2/gdb/ppc-tdep.h	2008-01-01 23:53:12.000000000 +0100
+++ dev2/gdb/ppc-tdep.h	2008-01-09 13:38:56.000000000 +0100
@@ -66,8 +66,8 @@ enum return_value_convention ppc64_sysv_
 							  const gdb_byte *writebuf);
 
 /* From rs6000-tdep.c... */
-int altivec_register_p (int regno);
-int spe_register_p (int regno);
+int altivec_register_p (struct gdbarch *gdbarch, int regno);
+int spe_register_p (struct gdbarch *gdbarch, int regno);
 
 /* Return non-zero if the architecture described by GDBARCH has
    floating-point registers (f0 --- f31 and fpscr).  */
diff -urpN src2/gdb/rs6000-tdep.c dev2/gdb/rs6000-tdep.c
--- src2/gdb/rs6000-tdep.c	2008-01-09 12:08:05.000000000 +0100
+++ dev2/gdb/rs6000-tdep.c	2008-01-09 15:28:49.000000000 +0100
@@ -157,14 +157,14 @@ CORE_ADDR (*rs6000_find_toc_address_hook
 
 static CORE_ADDR branch_dest (struct frame_info *frame, int opcode,
 			      int instr, CORE_ADDR pc, CORE_ADDR safety);
-static CORE_ADDR skip_prologue (CORE_ADDR, CORE_ADDR,
+static CORE_ADDR skip_prologue (struct gdbarch *, CORE_ADDR, CORE_ADDR,
                                 struct rs6000_framedata *);
 
 /* Is REGNO an AltiVec register?  Return 1 if so, 0 otherwise.  */
 int
-altivec_register_p (int regno)
+altivec_register_p (struct gdbarch *gdbarch, int regno)
 {
-  struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   if (tdep->ppc_vr0_regnum < 0 || tdep->ppc_vrsave_regnum < 0)
     return 0;
   else
@@ -174,9 +174,9 @@ altivec_register_p (int regno)
 
 /* Return true if REGNO is an SPE register, false otherwise.  */
 int
-spe_register_p (int regno)
+spe_register_p (struct gdbarch *gdbarch, int regno)
 {
-  struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   
   /* Is it a reference to EV0 -- EV31, and do we have those?  */
   if (tdep->ppc_ev0_regnum >= 0
@@ -779,7 +779,7 @@ rs6000_skip_prologue (struct gdbarch *gd
   if (limit_pc == 0)
     limit_pc = pc + 100;          /* Magic.  */
 
-  pc = skip_prologue (pc, limit_pc, &frame);
+  pc = skip_prologue (gdbarch, pc, limit_pc, &frame);
   return pc;
 }
 
@@ -1251,7 +1251,8 @@ bl_to_blrl_insn_p (CORE_ADDR pc, int ins
  */
 
 static CORE_ADDR
-skip_prologue (CORE_ADDR pc, CORE_ADDR lim_pc, struct rs6000_framedata *fdata)
+skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR lim_pc,
+	       struct rs6000_framedata *fdata)
 {
   CORE_ADDR orig_pc = pc;
   CORE_ADDR last_prologue_pc = pc;
@@ -1272,8 +1273,8 @@ skip_prologue (CORE_ADDR pc, CORE_ADDR l
   int prev_insn_was_prologue_insn = 1;
   int num_skip_non_prologue_insns = 0;
   int r0_contains_arg = 0;
-  const struct bfd_arch_info *arch_info = gdbarch_bfd_arch_info (current_gdbarch);
-  struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+  const struct bfd_arch_info *arch_info = gdbarch_bfd_arch_info (gdbarch);
+  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
 
   memset (fdata, 0, sizeof (struct rs6000_framedata));
   fdata->saved_gpr = -1;
@@ -2882,7 +2883,7 @@ rs6000_frame_cache (struct frame_info *n
 
   func = frame_func_unwind (next_frame, NORMAL_FRAME);
   pc = frame_pc_unwind (next_frame);
-  skip_prologue (func, pc, &fdata);
+  skip_prologue (gdbarch, func, pc, &fdata);
 
   /* Figure out the parent's stack pointer.  */
 
diff -urpN src2/gdb/score-tdep.c dev2/gdb/score-tdep.c
--- src2/gdb/score-tdep.c	2008-01-09 12:08:05.000000000 +0100
+++ dev2/gdb/score-tdep.c	2008-01-09 13:43:19.000000000 +0100
@@ -641,7 +641,7 @@ score_adjust_memblock_ptr (char **memblo
 }
 
 static inst_t *
-score_fetch_inst (CORE_ADDR addr, char *memblock)
+score_fetch_inst (struct gdbarch *gdbarch, CORE_ADDR addr, char *memblock)
 {
   static inst_t inst = { 0, 0 };
   char buf[SCORE_INSTLEN] = { 0 };
@@ -668,7 +668,7 @@ score_fetch_inst (CORE_ADDR addr, char *
   inst.raw = extract_unsigned_integer (buf, SCORE_INSTLEN);
   inst.is15 = !(inst.raw & 0x80008000);
   inst.v = RM_PBITS (inst.raw);
-  big = (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG);
+  big = (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG);
   if (inst.is15)
     {
       if (big ^ ((addr & 0x2) == 2))
@@ -686,7 +686,7 @@ score_skip_prologue (struct gdbarch *gdb
   int iscan = 32, stack_sub = 0;
   while (iscan-- > 0)
     {
-      inst_t *inst = score_fetch_inst (cpc, NULL);
+      inst_t *inst = score_fetch_inst (gdbarch, cpc, NULL);
       if (!inst)
         break;
       if (!inst->is15 && !stack_sub
@@ -731,7 +731,7 @@ score_skip_prologue (struct gdbarch *gdb
 static int
 score_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR cur_pc)
 {
-  inst_t *inst = score_fetch_inst (cur_pc, NULL);
+  inst_t *inst = score_fetch_inst (gdbarch, cur_pc, NULL);
 
   if (inst->v == 0x23)
     return 1;   /* mv! r0, r2 */
@@ -757,6 +757,7 @@ score_analyze_prologue (CORE_ADDR starta
                         struct frame_info *next_frame,
                         struct score_frame_cache *this_cache)
 {
+  struct gdbarch *gdbarch = get_frame_arch (next_frame);
   CORE_ADDR sp;
   CORE_ADDR fp;
   CORE_ADDR cur_pc = startaddr;
@@ -787,13 +788,13 @@ score_analyze_prologue (CORE_ADDR starta
           /* Reading memory block from target succefully and got all
              the instructions(from STARTADDR to PC) needed.  */
           score_adjust_memblock_ptr (&memblock, prev_pc, cur_pc);
-          inst = score_fetch_inst (cur_pc, memblock);
+          inst = score_fetch_inst (gdbarch, cur_pc, memblock);
         }
       else
         {
           /* Otherwise, we fetch 4 bytes from target, and GDB also
              work correctly.  */
-          inst = score_fetch_inst (cur_pc, NULL);
+          inst = score_fetch_inst (gdbarch, cur_pc, NULL);
         }
 
       if (inst->is15 == 1)
@@ -895,7 +896,7 @@ score_analyze_prologue (CORE_ADDR starta
                 {
                   unsigned int save_v = inst->v;
                   inst_t *inst2 =
-                    score_fetch_inst (cur_pc + SCORE_INSTLEN, NULL);
+                    score_fetch_inst (gdbarch, cur_pc + SCORE_INSTLEN, NULL);
                   if (inst2->v == 0x23)
                     {
                       /* mv! r0, r2 */
diff -urpN src2/gdb/sparc64-tdep.c dev2/gdb/sparc64-tdep.c
--- src2/gdb/sparc64-tdep.c	2008-01-09 12:08:05.000000000 +0100
+++ dev2/gdb/sparc64-tdep.c	2008-01-09 13:48:25.000000000 +0100
@@ -428,7 +428,8 @@ sparc64_skip_prologue (struct gdbarch *g
 	return sal.end;
     }
 
-  return sparc_analyze_prologue (start_pc, 0xffffffffffffffffULL, &cache);
+  return sparc_analyze_prologue (gdbarch, start_pc, 0xffffffffffffffffULL,
+				 &cache);
 }
 
 /* Normal frames.  */
diff -urpN src2/gdb/sparc-tdep.c dev2/gdb/sparc-tdep.c
--- src2/gdb/sparc-tdep.c	2008-01-09 12:08:05.000000000 +0100
+++ dev2/gdb/sparc-tdep.c	2008-01-09 13:47:30.000000000 +0100
@@ -711,10 +711,10 @@ sparc_skip_stack_check (const CORE_ADDR 
 }
 
 CORE_ADDR
-sparc_analyze_prologue (CORE_ADDR pc, CORE_ADDR current_pc,
-			struct sparc_frame_cache *cache)
+sparc_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc,
+			CORE_ADDR current_pc, struct sparc_frame_cache *cache)
 {
-  struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   unsigned long insn;
   int offset = 0;
   int dest = -1;
@@ -795,7 +795,7 @@ sparc32_skip_prologue (struct gdbarch *g
 	return sal.end;
     }
 
-  start_pc = sparc_analyze_prologue (start_pc, 0xffffffffUL, &cache);
+  start_pc = sparc_analyze_prologue (gdbarch, start_pc, 0xffffffffUL, &cache);
 
   /* The psABI says that "Although the first 6 words of arguments
      reside in registers, the standard stack frame reserves space for
@@ -842,7 +842,8 @@ sparc_frame_cache (struct frame_info *ne
 
   cache->pc = frame_func_unwind (next_frame, NORMAL_FRAME);
   if (cache->pc != 0)
-    sparc_analyze_prologue (cache->pc, frame_pc_unwind (next_frame), cache);
+    sparc_analyze_prologue (get_frame_arch (next_frame), cache->pc,
+			    frame_pc_unwind (next_frame), cache);
 
   if (cache->frameless_p)
     {
diff -urpN src2/gdb/sparc-tdep.h dev2/gdb/sparc-tdep.h
--- src2/gdb/sparc-tdep.h	2008-01-01 23:53:13.000000000 +0100
+++ dev2/gdb/sparc-tdep.h	2008-01-09 13:45:39.000000000 +0100
@@ -151,7 +151,8 @@ extern unsigned long sparc_fetch_instruc
 /* Fetch StackGhost Per-Process XOR cookie.  */
 extern ULONGEST sparc_fetch_wcookie (void);
 
-extern CORE_ADDR sparc_analyze_prologue (CORE_ADDR pc, CORE_ADDR current_pc,
+extern CORE_ADDR sparc_analyze_prologue (struct gdbarch *gdbarch,
+					 CORE_ADDR pc, CORE_ADDR current_pc,
 					 struct sparc_frame_cache *cache);
 
 extern struct sparc_frame_cache *


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