From: Markus Deuling Date: Fri, 11 Jan 2008 14:43:15 +0000 (+0000) Subject: * alpha-tdep.c (alpha_heuristic_proc_start) X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=be8626e05a1d01d9467d67dead4d3b176d0a9cb6;hp=ed49a04fe1bc299bc4b22c01a15c1f46ae21a294;p=deliverable%2Fbinutils-gdb.git * 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. * mn10300-tdep.c (mn10300_dwarf2_reg_to_regnum): Add gdbarch as parameter. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index b5cf434264..98c3f25fc2 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,78 @@ +2008-01-11 Markus Deuling + + * 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. + + * mn10300-tdep.c (mn10300_dwarf2_reg_to_regnum): Add gdbarch as + parameter. + 2008-01-11 Markus Deuling * exec.c: #include "arch-utils.h" diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c index 7d0eee96e6..e00bfd0f70 100644 --- a/gdb/alpha-tdep.c +++ b/gdb/alpha-tdep.c @@ -768,9 +768,10 @@ alpha_sigtramp_frame_unwind_cache (struct frame_info *next_frame, 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 +791,10 @@ alpha_sigtramp_frame_this_id (struct frame_info *next_frame, 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 +804,6 @@ alpha_sigtramp_frame_this_id (struct frame_info *next_frame, /* 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 +818,7 @@ alpha_sigtramp_frame_this_id (struct frame_info *next_frame, 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 +842,8 @@ alpha_sigtramp_frame_prev_register (struct frame_info *next_frame, 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 +922,9 @@ static unsigned int heuristic_fence_post = 0; 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 +1001,7 @@ alpha_heuristic_frame_unwind_cache (struct frame_info *next_frame, 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 +1016,7 @@ alpha_heuristic_frame_unwind_cache (struct frame_info *next_frame, 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 --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index 228b972394..0a18e0ff12 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -177,9 +177,9 @@ static void set_disassembly_style_sfunc(char *, int, 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,8 @@ arm_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc) /* *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 +566,7 @@ thumb_scan_prologue (CORE_ADDR prev_pc, struct arm_prologue_cache *cache) 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 +656,7 @@ arm_scan_prologue (struct frame_info *next_frame, /* 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 +1499,11 @@ arm_register_sim_regno (struct gdbarch *gdbarch, int regnum) 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 +1512,13 @@ convert_from_extended (const struct floatformat *fmt, const void *ptr, } 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 +2097,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 +2112,7 @@ arm_extract_return_value (struct type *type, struct regcache *regs, 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 +2286,18 @@ 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 --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c index 5888a1b73c..b95a9d9183 100644 --- a/gdb/cris-tdep.c +++ b/gdb/cris-tdep.c @@ -699,7 +699,8 @@ cris_get_signed_offset (unsigned short insn) /* 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_spec_reg spec_reg) 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 gdbarch *gdbarch, int regno) 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 gdbarch *gdbarch, int regno) 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 *frame, inst_env_type *inst_env) } 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 inst, inst_env_type *inst_env) /* 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, inst_env_type *inst_env) } /* 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, inst_env_type *inst_env) 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 (unsigned short inst, inst_env_type *inst_env) } /* 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 short inst, inst_env_type *inst_env) /* 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, unsigned short inst, 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, unsigned short inst, 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 --git a/gdb/h8300-tdep.c b/gdb/h8300-tdep.c index 9bc61c5281..0e3d0df55d 100644 --- a/gdb/h8300-tdep.c +++ b/gdb/h8300-tdep.c @@ -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 *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,8 @@ h8300_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *next_frame) /* 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 +133,7 @@ h8300_init_frame_cache (struct h8300_frame_cache *cache) /* 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 +422,7 @@ h8300_analyze_prologue (CORE_ADDR pc, CORE_ADDR current_pc, 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 +432,7 @@ h8300_frame_cache (struct frame_info *next_frame, void **this_cache) 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 +445,7 @@ h8300_frame_cache (struct frame_info *next_frame, void **this_cache) 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 +464,18 @@ h8300_frame_cache (struct frame_info *next_frame, void **this_cache) 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 +515,7 @@ h8300_frame_prev_register (struct frame_info *next_frame, void **this_cache, *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 +582,7 @@ h8300_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc) 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 +661,7 @@ h8300_push_dummy_call (struct gdbarch *gdbarch, struct value *function, 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 +1015,19 @@ h8300_print_register (struct gdbarch *gdbarch, struct ui_file *file, 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 +1066,7 @@ h8300_print_register (struct gdbarch *gdbarch, struct ui_file *file, 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 +1087,13 @@ h8300_print_registers_info (struct gdbarch *gdbarch, struct ui_file *file, { 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 +1115,12 @@ h8300_print_registers_info (struct gdbarch *gdbarch, struct ui_file *file, 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 +1143,9 @@ h8300_register_type (struct gdbarch *gdbarch, int regno) 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 +1160,9 @@ h8300_pseudo_register_read (struct gdbarch *gdbarch, 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 +1173,9 @@ h8300_pseudo_register_write (struct gdbarch *gdbarch, 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 +1185,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 +1193,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 --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c index b9791dea84..e5b09f58d8 100644 --- a/gdb/hppa-tdep.c +++ b/gdb/hppa-tdep.c @@ -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 *gdbarch, CORE_ADDR pc) 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 *next_frame, void **this_cache) 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 --git a/gdb/m32c-tdep.c b/gdb/m32c-tdep.c index e68e9fec9d..7302a7f6ba 100644 --- a/gdb/m32c-tdep.c +++ b/gdb/m32c-tdep.c @@ -2332,7 +2332,7 @@ m32c_return_value (struct gdbarch *gdbarch, 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 --git a/gdb/m68hc11-tdep.c b/gdb/m68hc11-tdep.c index b85cb8f4ba..1504bf3d21 100644 --- a/gdb/m68hc11-tdep.c +++ b/gdb/m68hc11-tdep.c @@ -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 gdbarch *gdbarch, 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, CORE_ADDR current_pc, 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 *gdbarch, CORE_ADDR pc) 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_info *next_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 *next_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_info *next_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_info *next_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 frame_info *next_frame, /* 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 *gdbarch, struct value *function, 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 --git a/gdb/m68k-tdep.c b/gdb/m68k-tdep.c index 1eed9295c3..bfb1af9f94 100644 --- a/gdb/m68k-tdep.c +++ b/gdb/m68k-tdep.c @@ -690,7 +690,8 @@ m68k_analyze_frame_setup (CORE_ADDR pc, CORE_ADDR current_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 pc, CORE_ADDR current_pc, { 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 pc, CORE_ADDR current_pc, */ 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 *gdbarch, CORE_ADDR start_pc) 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 *next_frame, void **this_cache) 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 --git a/gdb/mn10300-tdep.c b/gdb/mn10300-tdep.c index 9fcae8a956..17a1f1ad70 100644 --- a/gdb/mn10300-tdep.c +++ b/gdb/mn10300-tdep.c @@ -1080,7 +1080,7 @@ mn10300_push_dummy_call (struct gdbarch *gdbarch, to work with the existing GDB, neither of them can change. So we just have to cope. */ static int -mn10300_dwarf2_reg_to_regnum (int dwarf2) +mn10300_dwarf2_reg_to_regnum (struct gdbarch *gdbarch, int dwarf2) { /* This table is supposed to be shaped like the gdbarch_register_name initializer in gcc/config/mn10300/mn10300.h. Registers which diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c index a0ee46e701..80c5298ef1 100644 --- a/gdb/ppc-linux-nat.c +++ b/gdb/ppc-linux-nat.c @@ -337,7 +337,7 @@ fetch_register (struct regcache *regcache, int tid, int regno) 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 *regcache, int tid, int regno) 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 *regcache, int tid, int regno) 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 --git a/gdb/ppc-tdep.h b/gdb/ppc-tdep.h index da2b6dd99a..424c878a6d 100644 --- a/gdb/ppc-tdep.h +++ b/gdb/ppc-tdep.h @@ -66,8 +66,8 @@ enum return_value_convention ppc64_sysv_abi_return_value (struct gdbarch *gdbarc 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 --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index c5122e3366..f129a7f90d 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -157,14 +157,14 @@ CORE_ADDR (*rs6000_find_toc_address_hook) (CORE_ADDR) = NULL; 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 *gdbarch, CORE_ADDR pc) 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 insn) */ 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 lim_pc, struct rs6000_framedata *fdata) 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 *next_frame, void **this_cache) 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 --git a/gdb/score-tdep.c b/gdb/score-tdep.c index f691753a80..4ef6200246 100644 --- a/gdb/score-tdep.c +++ b/gdb/score-tdep.c @@ -641,7 +641,7 @@ score_adjust_memblock_ptr (char **memblock, CORE_ADDR prev_pc, } 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 *memblock) 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 *gdbarch, CORE_ADDR pc) 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 *gdbarch, CORE_ADDR pc) 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 startaddr, CORE_ADDR pc, 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 startaddr, CORE_ADDR pc, /* 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 startaddr, CORE_ADDR pc, { 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 --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c index 27514fa07a..10656734d3 100644 --- a/gdb/sparc-tdep.c +++ b/gdb/sparc-tdep.c @@ -711,10 +711,10 @@ sparc_skip_stack_check (const CORE_ADDR start_pc) } 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 *gdbarch, CORE_ADDR start_pc) 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 *next_frame, void **this_cache) 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 --git a/gdb/sparc-tdep.h b/gdb/sparc-tdep.h index 3256019397..9f3a1ea475 100644 --- a/gdb/sparc-tdep.h +++ b/gdb/sparc-tdep.h @@ -151,7 +151,8 @@ extern unsigned long sparc_fetch_instruction (CORE_ADDR pc); /* 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 * diff --git a/gdb/sparc64-tdep.c b/gdb/sparc64-tdep.c index 2d9c8e36a3..371d02e2ef 100644 --- a/gdb/sparc64-tdep.c +++ b/gdb/sparc64-tdep.c @@ -428,7 +428,8 @@ sparc64_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc) return sal.end; } - return sparc_analyze_prologue (start_pc, 0xffffffffffffffffULL, &cache); + return sparc_analyze_prologue (gdbarch, start_pc, 0xffffffffffffffffULL, + &cache); } /* Normal frames. */