aboutsummaryrefslogtreecommitdiff
path: root/gdb/h8300-tdep.c
diff options
context:
space:
mode:
authorMarkus Deuling <deuling@de.ibm.com>2008-01-11 14:43:15 +0000
committerMarkus Deuling <deuling@de.ibm.com>2008-01-11 14:43:15 +0000
commitbe8626e05a1d01d9467d67dead4d3b176d0a9cb6 (patch)
tree10c5e0ac7fbee4ec243419c6a9a06ad374c13ad8 /gdb/h8300-tdep.c
parented49a04fe1bc299bc4b22c01a15c1f46ae21a294 (diff)
downloadgdb-be8626e05a1d01d9467d67dead4d3b176d0a9cb6.zip
gdb-be8626e05a1d01d9467d67dead4d3b176d0a9cb6.tar.gz
gdb-be8626e05a1d01d9467d67dead4d3b176d0a9cb6.tar.bz2
* 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.
Diffstat (limited to 'gdb/h8300-tdep.c')
-rw-r--r--gdb/h8300-tdep.c75
1 files changed, 41 insertions, 34 deletions
diff --git a/gdb/h8300-tdep.c b/gdb/h8300-tdep.c
index 9bc61c5..0e3d0df 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;
}