+2008-01-11 Markus Deuling <deuling@de.ibm.com>
+
+ * 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 <deuling@de.ibm.com>
* exec.c: #include "arch-utils.h"
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;
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. */
/* 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;
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);
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;
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;
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;
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;
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
{
/* *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;
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:
/* 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;
}
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,
}
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,
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:
{
regcache_cooked_read (regs, ARM_F0_REGNUM, tmpbuf);
convert_from_extended (floatformat_from_type (type), tmpbuf,
- valbuf);
+ valbuf, gdbarch_byte_order (gdbarch));
}
break;
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;
/* 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 *);
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;
/* 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). */
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
if (regno < 0
|| regno >= gdbarch_num_regs (gdbarch)
- || cris_register_size (regno) == 0)
+ || cris_register_size (gdbarch, regno) == 0)
/* Not implemented. */
return 1;
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
if (regno < 0
|| regno >= gdbarch_num_regs (gdbarch)
- || cris_register_size (regno) == 0)
+ || cris_register_size (gdbarch, regno) == 0)
/* Not implemented. */
return 1;
}
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
/* 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)
{
}
/* 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);
}
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)
{
}
/* 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);
}
/* 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)
{
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:
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:
#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
{
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
/* 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;
/* 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;
}
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;
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,
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);
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];
*addrp = 0;
*realnump = -1;
if (valuep)
- store_unsigned_integer (valuep, BINWORD, cache->saved_sp);
+ store_unsigned_integer (valuep, BINWORD (gdbarch), cache->saved_sp);
return;
}
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);
}
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;
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;
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;
{
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);
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);
}
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;
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);
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);
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;
}
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;
}
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;
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;
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);
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);
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. */
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)
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,
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
{
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)
- 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;
return pc;
}
- seq_table = gdbarch_tdep (current_gdbarch)->prologue;
+ seq_table = gdbarch_tdep (gdbarch)->prologue;
/* The 68hc11 stack is as follows:
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;
}
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;
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;
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
{
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;
}
/* 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))
{
/* 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;
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. */
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)
{
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);
*/
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;
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;
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)
{
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
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
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;
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;
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). */
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
/* 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
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;
}
*/
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;
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;
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. */
}
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 };
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))
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
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 */
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;
/* 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)
{
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 */
}
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;
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
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)
{
/* 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 *
return sal.end;
}
- return sparc_analyze_prologue (start_pc, 0xffffffffffffffffULL, &cache);
+ return sparc_analyze_prologue (gdbarch, start_pc, 0xffffffffffffffffULL,
+ &cache);
}
/* Normal frames. */