aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog96
-rw-r--r--gdb/alpha-tdep.c6
-rw-r--r--gdb/amd64-linux-tdep.c4
-rw-r--r--gdb/amd64-tdep.c2
-rw-r--r--gdb/amd64-tdep.h2
-rw-r--r--gdb/arm-tdep.c2
-rw-r--r--gdb/avr-tdep.c2
-rw-r--r--gdb/cris-tdep.c10
-rw-r--r--gdb/frv-tdep.c2
-rw-r--r--gdb/gdbarch.c4
-rw-r--r--gdb/gdbarch.h2
-rwxr-xr-xgdb/gdbarch.sh2
-rw-r--r--gdb/h8300-tdep.c6
-rw-r--r--gdb/hppa-tdep.c4
-rw-r--r--gdb/i386-linux-tdep.c4
-rw-r--r--gdb/i386-tdep.c6
-rw-r--r--gdb/i386-tdep.h2
-rw-r--r--gdb/ia64-tdep.c2
-rw-r--r--gdb/iq2000-tdep.c2
-rw-r--r--gdb/m32c-tdep.c4
-rw-r--r--gdb/m32r-tdep.c4
-rw-r--r--gdb/m68hc11-tdep.c7
-rw-r--r--gdb/m68k-tdep.c2
-rw-r--r--gdb/m88k-tdep.c2
-rw-r--r--gdb/mep-tdep.c6
-rw-r--r--gdb/mips-tdep.c16
-rw-r--r--gdb/mn10300-tdep.c12
-rw-r--r--gdb/mt-tdep.c20
-rw-r--r--gdb/rs6000-tdep.c6
-rw-r--r--gdb/s390-tdep.c2
-rw-r--r--gdb/score-tdep.c8
-rw-r--r--gdb/sh-tdep.c62
-rw-r--r--gdb/sh64-tdep.c126
-rw-r--r--gdb/sparc-tdep.c2
-rw-r--r--gdb/sparc64-tdep.c2
-rw-r--r--gdb/spu-tdep.c2
-rw-r--r--gdb/target-descriptions.c13
-rw-r--r--gdb/target-descriptions.h2
-rw-r--r--gdb/v850-tdep.c8
-rw-r--r--gdb/vax-tdep.c2
-rw-r--r--gdb/xstormy16-tdep.c2
-rw-r--r--gdb/xtensa-tdep.c18
42 files changed, 295 insertions, 193 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index a059d1b..cab902e 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,99 @@
+2007-11-02 Markus Deuling <deuling@de.ibm.com>
+
+ * gdbarch.sh (register_name): Add gdbarch parameter.
+ * gdbarch.{c,h}: Regenerate.
+
+ * target-descriptions.c (tdesc_register_name): Add gdbarch parameter.
+ (tdesc_register_name): Replace current_gdbarch by gdbarch.
+ * target-descriptions.h (tdesc_register_name): Add gdbarch parameter.
+
+ * xstormy16-tdep.c (xstormy16_register_name): Add gdbarch parameter.
+ * vax-tdep.c (vax_register_name): Add gdbarch parameter.
+ * spu-tdep.c (spu_register_name): Add gdbarch parameter.
+ * s390-tdep.c (s390_register_name): Add gdbarch parameter.
+ * mt-tdep.c (mt_register_name): Add gdbarch parameter.
+ (mt_registers_info): Replace current_gdbarch by gdbarch.
+ (mt_register_reggroup_p): Add gdbarch to mt_register_name call.
+ * mips-tdep.c (mips_register_name): Add gdbarch parameter. Replace
+ current_gdbarch by gdbarch.
+ (mips_register_name): Add gdbarch to tdesc_register_name call.
+ * mep-tdep.c (mep_register_name): Add gdbarch parameter. Replace
+ current_gdbarch by gdbarch.
+ (mep_register_reggroup_p): Add gdbarch to mep_register_name call.
+ * m32c-tdep.c (m32c_register_name): Add gdbarch parameter. Replace
+ current_gdbarch by gdbarch.
+ * m88k-tdep.c (m88k_register_name): Add gdbarch parameter.
+ * m68k-tdep.c (m68k_register_name): Add gdbarch parameter.
+ * m32r-tdep.c (m32r_register_name): Add gdbarch parameter.
+ (m32r_frame_unwind_cache): Use get_frame_arch to get at the current
+ architecture by frame_info.
+ * iq2000-tdep.c (iq2000_register_name): Add gdbarch parameter.
+ * ia64-tdep.c (ia64_register_name): Add gdbarch parameter.
+ * hppa-tdep.c (hppa32_register_name, hppa64_register_name): Add gdbarch
+ parameter.
+ * h8300-tdep.c (h8300_register_name, h8300s_register_name)
+ (h8300sx_register_name): Add gdbarch parameter.
+ * cris-tdep.c (cris_register_name, crisv32_register_name): Add
+ gdbarch parameter. Replace current_gdbarch by gdbarch.
+ (cris_gdbarch_init): Replace current_gdbarch by gdbarch (comment).
+ * avr-tdep.c (avr_register_name): Add gdbarch parameter.
+ * arm-tdep.c (arm_register_name): Add gdbarch paramete
+ * amd64-tdep.c (amd64_register_name): Add gdbarch parameter. Update
+ caller.
+ * amd64-tdep.h (amd64_register_name): Add gdbarch parameter.
+ * amd64-linux-tdep.c (amd64_linux_register_name): Add gdbarch parameter.
+ * alpha-tdep.c (alpha_register_name): Add gdbarch parameter.
+ (alpha_cannot_fetch_register, alpha_cannot_store_register): Update call
+ of alpha_register_name.
+ * frv-tdep.c (frv_register_name): Add gdbarch parameter.
+ * i386-tdep.c (i386_register_name): Add gdbarch parameter. Replace
+ current_gdbarch by gdbarch.
+ (i386_register_type): Replace ?current_gdbarch by gdbarch.
+ * i386-tdep.h (i386_register_name): Add gdbarch parameter.
+ * i386-linux-tdep.c (i386_linux_register_name): Add gdbarch parameter.
+
+ * m68hc11-tdep.c (m68hc11_register_name): Add gdbarch parameter.
+ (m68hc11_register_reggroup_p): Add gdbarch to call of
+ m68hc11_register_name.
+ * mn10300-tdep.c (mn10300_generic_register_name, am33_register_name)
+ (am33_2_register_name): Add gdbarch parameter.
+ (mn10300_frame_unwind_cache): Use get_frame_arch to get at the current
+ architecture by frame_info.
+ (mn10300_dump_tdep): Replace current_gdbarch by gdbarch.
+ * rs6000-tdep.c (rs6000_register_name): Add gdbarch parameter. Replace
+ current_gdbarch by gdbarch.
+ * score-tdep.c (score_register_name): Add gdbarch parameter.
+ (score_return_value, score_push_dummy_call): Replace current_gdbarch
+ by gdbarch.
+ * sh64-tdep.c (sh64_register_name): Add gdbarch parameter.
+ (sh64_compact_reg_base_num, sh64_register_convert_to_virtual)
+ (sh64_register_convert_to_raw, sh64_fv_reg_base_num)
+ (sh64_dr_reg_base_num, sh64_fpp_reg_base_num): Add gdbarch parameter
+ and update caller. Replace current_gdbarch by gdbarch.
+ (sh64_extract_return_value, sh64_store_return_value): Use
+ get_regcache_arch to get at the current architecture by regcache.
+ * sh-tdep.c (sh_sh_register_name, sh_sh3_register_name)
+ (sh_sh3e_register_name, sh_sh2e_register_name, sh_sh2a_register_name)
+ (sh_sh2a_nofpu_register_name, sh_sh_dsp_register_name)
+ (sh_sh3_dsp_register_name, sh_sh4_register_name)
+ (sh_sh4_nofpu_register_name, sh_sh4al_dsp_register_name): Add gdbarch
+ parameter.
+ (fv_reg_base_num, dr_reg_base_num, sh_justify_value_in_reg)
+ (sh_next_flt_argreg): Add gdbarch parameter and update caller. Replace
+ current_gdbarch by gdbarch.
+ (sh_extract_return_value_fpu, sh_store_return_value_fpu): Use
+ get_regcache_arch to get at the current architecture by regcache.
+ * sparc-tdep.c (sparc32_register_name): Add gdbarch parameter.
+ * sparc64-tdep.c (sparc64_register_name): Add gdbarch parameter.
+ * v850-tdep.c (v850_register_name, v850e_register_name): Add gdbarch
+ parameter.
+ (v850_unwind_sp, v850_unwind_pc): Replace current_gdbarch by gdbarch.
+ * xtensa-tdep.c (xtensa_register_name): Add gdbarch parameter. Replace
+ current_gdbarch by gdbarch.
+ (xtensa_pseudo_register_read, xtensa_pseudo_register_write)
+ (xtensa_frame_prev_register): Add gdbarch parameter to
+ xtensa_register_name call.
+
2007-10-31 Ulrich Weigand <uweigand@de.ibm.com>
* ppc-linux-tdep.c (ppc_linux_skip_trampoline_code): Fall back to
diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c
index 4b175d0..6efb85b 100644
--- a/gdb/alpha-tdep.c
+++ b/gdb/alpha-tdep.c
@@ -54,7 +54,7 @@
compatibility with existing remote alpha targets. */
static const char *
-alpha_register_name (int regno)
+alpha_register_name (struct gdbarch *gdbarch, int regno)
{
static const char * const register_names[] =
{
@@ -80,14 +80,14 @@ static int
alpha_cannot_fetch_register (int regno)
{
return (regno == ALPHA_ZERO_REGNUM
- || strlen (alpha_register_name (regno)) == 0);
+ || strlen (alpha_register_name (current_gdbarch, regno)) == 0);
}
static int
alpha_cannot_store_register (int regno)
{
return (regno == ALPHA_ZERO_REGNUM
- || strlen (alpha_register_name (regno)) == 0);
+ || strlen (alpha_register_name (current_gdbarch, regno)) == 0);
}
static struct type *
diff --git a/gdb/amd64-linux-tdep.c b/gdb/amd64-linux-tdep.c
index aeb6600..b2115ad 100644
--- a/gdb/amd64-linux-tdep.c
+++ b/gdb/amd64-linux-tdep.c
@@ -205,12 +205,12 @@ static int amd64_linux_sc_reg_offset[] =
/* Replacement register functions which know about %orig_rax. */
static const char *
-amd64_linux_register_name (int reg)
+amd64_linux_register_name (struct gdbarch *gdbarch, int reg)
{
if (reg == AMD64_LINUX_ORIG_RAX_REGNUM)
return "orig_rax";
- return amd64_register_name (reg);
+ return amd64_register_name (gdbarch, reg);
}
static struct type *
diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c
index ff5272b..b03320e 100644
--- a/gdb/amd64-tdep.c
+++ b/gdb/amd64-tdep.c
@@ -73,7 +73,7 @@ static const char *amd64_register_names[] =
/* Return the name of register REGNUM. */
const char *
-amd64_register_name (int regnum)
+amd64_register_name (struct gdbarch *gdbarch, int regnum)
{
if (regnum >= 0 && regnum < AMD64_NUM_REGS)
return amd64_register_names[regnum];
diff --git a/gdb/amd64-tdep.h b/gdb/amd64-tdep.h
index 4d28ce7..2637577 100644
--- a/gdb/amd64-tdep.h
+++ b/gdb/amd64-tdep.h
@@ -65,7 +65,7 @@ extern void amd64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch);
/* Functions from amd64-tdep.c which may be needed on architectures
with extra registers. */
-extern const char *amd64_register_name (int regnum);
+extern const char *amd64_register_name (struct gdbarch *gdbarch, int regnum);
extern struct type *amd64_register_type (struct gdbarch *gdbarch, int regnum);
/* Fill register REGNUM in REGCACHE with the appropriate
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index 190f6a1..b0db482 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -2596,7 +2596,7 @@ set_disassembly_style_sfunc (char *args, int from_tty,
/* Return the ARM register name corresponding to register I. */
static const char *
-arm_register_name (int i)
+arm_register_name (struct gdbarch *gdbarch, int i)
{
if (i >= ARRAY_SIZE (arm_register_names))
/* These registers are only supported on targets which supply
diff --git a/gdb/avr-tdep.c b/gdb/avr-tdep.c
index db2fd0f..22349f9 100644
--- a/gdb/avr-tdep.c
+++ b/gdb/avr-tdep.c
@@ -188,7 +188,7 @@ struct gdbarch_tdep
/* Lookup the name of a register given it's number. */
static const char *
-avr_register_name (int regnum)
+avr_register_name (struct gdbarch *gdbarch, int regnum)
{
static char *register_names[] = {
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c
index 4a4dbc8..ca3b433 100644
--- a/gdb/cris-tdep.c
+++ b/gdb/cris-tdep.c
@@ -1778,7 +1778,7 @@ cris_special_register_name (int regno)
}
static const char *
-cris_register_name (int regno)
+cris_register_name (struct gdbarch *gdbarch, int regno)
{
static char *cris_genreg_names[] =
{ "r0", "r1", "r2", "r3", \
@@ -1791,7 +1791,7 @@ cris_register_name (int regno)
/* General register. */
return cris_genreg_names[regno];
}
- else if (regno >= NUM_GENREGS && regno < gdbarch_num_regs (current_gdbarch))
+ else if (regno >= NUM_GENREGS && regno < gdbarch_num_regs (gdbarch))
{
return cris_special_register_name (regno);
}
@@ -1803,7 +1803,7 @@ cris_register_name (int regno)
}
static const char *
-crisv32_register_name (int regno)
+crisv32_register_name (struct gdbarch *gdbarch, int regno)
{
static char *crisv32_genreg_names[] =
{ "r0", "r1", "r2", "r3", \
@@ -1828,7 +1828,7 @@ crisv32_register_name (int regno)
{
return cris_special_register_name (regno);
}
- else if (regno == gdbarch_pc_regnum (current_gdbarch))
+ else if (regno == gdbarch_pc_regnum (gdbarch))
{
return "pc";
}
@@ -4133,7 +4133,7 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* The total amount of space needed to store (in an array called registers)
GDB's copy of the machine's register state. Note: We can not use
- cris_register_size at this point, since it relies on current_gdbarch
+ cris_register_size at this point, since it relies on gdbarch
being set. */
switch (tdep->cris_version)
{
diff --git a/gdb/frv-tdep.c b/gdb/frv-tdep.c
index 4403e6e..bab497c 100644
--- a/gdb/frv-tdep.c
+++ b/gdb/frv-tdep.c
@@ -278,7 +278,7 @@ set_variant_scratch_registers (struct gdbarch_tdep *var)
}
static const char *
-frv_register_name (int reg)
+frv_register_name (struct gdbarch *gdbarch, int reg)
{
if (reg < 0)
return "?toosmall?";
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index 4759236..1f5993e 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -527,6 +527,8 @@ verify_gdbarch (struct gdbarch *current_gdbarch)
/* Skip verify of dwarf_reg_to_regnum, invalid_p == 0 */
/* Skip verify of sdb_reg_to_regnum, invalid_p == 0 */
/* Skip verify of dwarf2_reg_to_regnum, invalid_p == 0 */
+ if (current_gdbarch->register_name == 0)
+ fprintf_unfiltered (log, "\n\tregister_name");
/* Skip verify of register_type, has predicate */
/* Skip verify of unwind_dummy_id, has predicate */
/* Skip verify of deprecated_fp_regnum, invalid_p == 0 */
@@ -1617,7 +1619,7 @@ gdbarch_register_name (struct gdbarch *gdbarch, int regnr)
gdb_assert (gdbarch->register_name != NULL);
if (gdbarch_debug >= 2)
fprintf_unfiltered (gdb_stdlog, "gdbarch_register_name called\n");
- return gdbarch->register_name (regnr);
+ return gdbarch->register_name (gdbarch, regnr);
}
void
diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h
index f207a50..6674159 100644
--- a/gdb/gdbarch.h
+++ b/gdb/gdbarch.h
@@ -232,7 +232,7 @@ typedef int (gdbarch_dwarf2_reg_to_regnum_ftype) (int dwarf2_regnr);
extern int gdbarch_dwarf2_reg_to_regnum (struct gdbarch *gdbarch, int dwarf2_regnr);
extern void set_gdbarch_dwarf2_reg_to_regnum (struct gdbarch *gdbarch, gdbarch_dwarf2_reg_to_regnum_ftype *dwarf2_reg_to_regnum);
-typedef const char * (gdbarch_register_name_ftype) (int regnr);
+typedef const char * (gdbarch_register_name_ftype) (struct gdbarch *gdbarch, int regnr);
extern const char * gdbarch_register_name (struct gdbarch *gdbarch, int regnr);
extern void set_gdbarch_register_name (struct gdbarch *gdbarch, gdbarch_register_name_ftype *register_name);
diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh
index ffafb5d..7112b04 100755
--- a/gdb/gdbarch.sh
+++ b/gdb/gdbarch.sh
@@ -421,7 +421,7 @@ f:int:dwarf_reg_to_regnum:int dwarf_regnr:dwarf_regnr::no_op_reg_to_regnum::0
# Convert from an sdb register number to an internal gdb register number.
f:int:sdb_reg_to_regnum:int sdb_regnr:sdb_regnr::no_op_reg_to_regnum::0
f:int:dwarf2_reg_to_regnum:int dwarf2_regnr:dwarf2_regnr::no_op_reg_to_regnum::0
-f:const char *:register_name:int regnr:regnr
+m:const char *:register_name:int regnr:regnr::0
# Return the type of a register specified by the architecture. Only
# the register cache should call this function directly; others should
diff --git a/gdb/h8300-tdep.c b/gdb/h8300-tdep.c
index a4dfe9e..ee67d4f 100644
--- a/gdb/h8300-tdep.c
+++ b/gdb/h8300-tdep.c
@@ -947,7 +947,7 @@ h8300h_return_value (struct gdbarch *gdbarch, struct type *type,
static struct cmd_list_element *setmachinelist;
static const char *
-h8300_register_name (int regno)
+h8300_register_name (struct gdbarch *gdbarch, int regno)
{
/* The register names change depending on which h8300 processor
type is selected. */
@@ -965,7 +965,7 @@ h8300_register_name (int regno)
}
static const char *
-h8300s_register_name (int regno)
+h8300s_register_name (struct gdbarch *gdbarch, int regno)
{
static char *register_names[] = {
"er0", "er1", "er2", "er3", "er4", "er5", "er6",
@@ -983,7 +983,7 @@ h8300s_register_name (int regno)
}
static const char *
-h8300sx_register_name (int regno)
+h8300sx_register_name (struct gdbarch *gdbarch, int regno)
{
static char *register_names[] = {
"er0", "er1", "er2", "er3", "er4", "er5", "er6",
diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c
index a245198..52b7d55 100644
--- a/gdb/hppa-tdep.c
+++ b/gdb/hppa-tdep.c
@@ -581,7 +581,7 @@ hppa_breakpoint_from_pc (CORE_ADDR *pc, int *len)
/* Return the name of a register. */
static const char *
-hppa32_register_name (int i)
+hppa32_register_name (struct gdbarch *gdbarch, int i)
{
static char *names[] = {
"flags", "r1", "rp", "r3",
@@ -624,7 +624,7 @@ hppa32_register_name (int i)
}
static const char *
-hppa64_register_name (int i)
+hppa64_register_name (struct gdbarch *gdbarch, int i)
{
static char *names[] = {
"flags", "r1", "rp", "r3",
diff --git a/gdb/i386-linux-tdep.c b/gdb/i386-linux-tdep.c
index aacc74c..98a281b 100644
--- a/gdb/i386-linux-tdep.c
+++ b/gdb/i386-linux-tdep.c
@@ -38,13 +38,13 @@
/* Return the name of register REG. */
static const char *
-i386_linux_register_name (int reg)
+i386_linux_register_name (struct gdbarch *gdbarch, int reg)
{
/* Deal with the extra "orig_eax" pseudo register. */
if (reg == I386_LINUX_ORIG_EAX_REGNUM)
return "orig_eax";
- return i386_register_name (reg);
+ return i386_register_name (gdbarch, reg);
}
/* Return non-zero, when the register is in the corresponding register
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index 1fda5b1..736a56e 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -152,9 +152,9 @@ i386_fpc_regnum_p (int regnum)
/* Return the name of register REGNUM. */
const char *
-i386_register_name (int regnum)
+i386_register_name (struct gdbarch *gdbarch, int regnum)
{
- if (i386_mmx_regnum_p (current_gdbarch, regnum))
+ if (i386_mmx_regnum_p (gdbarch, regnum))
return i386_mmx_names[regnum - I387_MM0_REGNUM];
if (regnum >= 0 && regnum < i386_num_register_names)
@@ -1750,7 +1750,7 @@ i386_register_type (struct gdbarch *gdbarch, int regnum)
return i386_sse_type (gdbarch);
#define I387_ST0_REGNUM I386_ST0_REGNUM
-#define I387_NUM_XMM_REGS (gdbarch_tdep (current_gdbarch)->num_xmm_regs)
+#define I387_NUM_XMM_REGS (gdbarch_tdep (gdbarch)->num_xmm_regs)
if (regnum == I387_MXCSR_REGNUM)
return i386_mxcsr_type;
diff --git a/gdb/i386-tdep.h b/gdb/i386-tdep.h
index dcf3eed..6cb25b5 100644
--- a/gdb/i386-tdep.h
+++ b/gdb/i386-tdep.h
@@ -168,7 +168,7 @@ extern struct type *i386_sse_type (struct gdbarch *gdbarch);
extern CORE_ADDR i386_pe_skip_trampoline_code (CORE_ADDR pc, char *name);
/* Return the name of register REGNUM. */
-extern char const *i386_register_name (int regnum);
+extern char const *i386_register_name (struct gdbarch * gdbarch, int regnum);
/* Return non-zero if REGNUM is a member of the specified group. */
extern int i386_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
diff --git a/gdb/ia64-tdep.c b/gdb/ia64-tdep.c
index d5bea78..09fe676 100644
--- a/gdb/ia64-tdep.c
+++ b/gdb/ia64-tdep.c
@@ -298,7 +298,7 @@ ia64_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
}
static const char *
-ia64_register_name (int reg)
+ia64_register_name (struct gdbarch *gdbarch, int reg)
{
return ia64_register_names[reg];
}
diff --git a/gdb/iq2000-tdep.c b/gdb/iq2000-tdep.c
index ab3b196..c7f49de 100644
--- a/gdb/iq2000-tdep.c
+++ b/gdb/iq2000-tdep.c
@@ -118,7 +118,7 @@ iq2000_address_to_pointer (struct type *type, void *buf, CORE_ADDR addr)
Returns the name of the iq2000 register number N. */
static const char *
-iq2000_register_name (int regnum)
+iq2000_register_name (struct gdbarch *gdbarch, int regnum)
{
static const char * names[E_NUM_REGS] =
{
diff --git a/gdb/m32c-tdep.c b/gdb/m32c-tdep.c
index 49d07ce..83c97cf 100644
--- a/gdb/m32c-tdep.c
+++ b/gdb/m32c-tdep.c
@@ -227,9 +227,9 @@ make_types (struct gdbarch *arch)
/* Register set. */
static const char *
-m32c_register_name (int num)
+m32c_register_name (struct gdbarch *gdbarch, int num)
{
- return gdbarch_tdep (current_gdbarch)->regs[num].name;
+ return gdbarch_tdep (gdbarch)->regs[num].name;
}
diff --git a/gdb/m32r-tdep.c b/gdb/m32r-tdep.c
index c0973e8..43c5852 100644
--- a/gdb/m32r-tdep.c
+++ b/gdb/m32r-tdep.c
@@ -212,7 +212,7 @@ char *m32r_register_names[] = {
};
static const char *
-m32r_register_name (int reg_nr)
+m32r_register_name (struct gdbarch *gdbarch, int reg_nr)
{
if (reg_nr < 0)
return NULL;
@@ -623,7 +623,7 @@ m32r_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) - 1; i++)
+ for (i = 0; i < gdbarch_num_regs (get_frame_arch (next_frame)) - 1; i++)
if (trad_frame_addr_p (info->saved_regs, i))
info->saved_regs[i].addr = (info->prev_sp + info->saved_regs[i].addr);
diff --git a/gdb/m68hc11-tdep.c b/gdb/m68hc11-tdep.c
index 68ec49a..d02e163 100644
--- a/gdb/m68hc11-tdep.c
+++ b/gdb/m68hc11-tdep.c
@@ -365,7 +365,7 @@ m68hc11_pseudo_register_write (struct gdbarch *gdbarch,
}
static const char *
-m68hc11_register_name (int reg_nr)
+m68hc11_register_name (struct gdbarch *gdbarch, int reg_nr)
{
if (reg_nr == M68HC12_HARD_PC_REGNUM && USE_PAGE_REGISTER)
return "pc";
@@ -1395,13 +1395,14 @@ m68hc11_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
|| regnum == SOFT_TMP_REGNUM
|| regnum == SOFT_ZS_REGNUM
|| regnum == SOFT_XY_REGNUM)
- && m68hc11_register_name (regnum)));
+ && m68hc11_register_name (gdbarch, regnum)));
}
/* Group to identify gcc soft registers (d1..dN). */
if (group == m68hc11_soft_reggroup)
{
- return regnum >= SOFT_D1_REGNUM && m68hc11_register_name (regnum);
+ return regnum >= SOFT_D1_REGNUM
+ && m68hc11_register_name (gdbarch, regnum);
}
if (group == m68hc11_hard_reggroup)
diff --git a/gdb/m68k-tdep.c b/gdb/m68k-tdep.c
index b75a952..5523be0 100644
--- a/gdb/m68k-tdep.c
+++ b/gdb/m68k-tdep.c
@@ -154,7 +154,7 @@ static const char *m68k_register_names[] = {
Returns the name of the standard m68k register regnum. */
static const char *
-m68k_register_name (int regnum)
+m68k_register_name (struct gdbarch *gdbarch, int regnum)
{
if (regnum < 0 || regnum >= ARRAY_SIZE (m68k_register_names))
internal_error (__FILE__, __LINE__,
diff --git a/gdb/m88k-tdep.c b/gdb/m88k-tdep.c
index 2cfd4c2..e638959 100644
--- a/gdb/m88k-tdep.c
+++ b/gdb/m88k-tdep.c
@@ -49,7 +49,7 @@ m88k_fetch_instruction (CORE_ADDR pc)
/* Return the name of register REGNUM. */
static const char *
-m88k_register_name (int regnum)
+m88k_register_name (struct gdbarch *gdbarch, int regnum)
{
static char *register_names[] =
{
diff --git a/gdb/mep-tdep.c b/gdb/mep-tdep.c
index 3a639a8..5ff87e7 100644
--- a/gdb/mep-tdep.c
+++ b/gdb/mep-tdep.c
@@ -928,9 +928,9 @@ current_ccr_names ()
static const char *
-mep_register_name (int regnr)
+mep_register_name (struct gdbarch *gdbarch, int regnr)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
/* General-purpose registers. */
static const char *gpr_names[] = {
@@ -1031,7 +1031,7 @@ mep_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
{
/* Filter reserved or unused register numbers. */
{
- const char *name = mep_register_name (regnum);
+ const char *name = mep_register_name (gdbarch, regnum);
if (! name || name[0] == '\0')
return 0;
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index 648cc3a..fa86fa0 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -493,9 +493,9 @@ static const char *mips_irix_reg_names[NUM_MIPS_PROCESSOR_REGS] = {
/* Return the name of the register corresponding to REGNO. */
static const char *
-mips_register_name (int regno)
+mips_register_name (struct gdbarch *gdbarch, int regno)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
/* GPR names for all ABIs other than n32/n64. */
static char *mips_gpr_names[] = {
"zero", "at", "v0", "v1", "a0", "a1", "a2", "a3",
@@ -512,12 +512,12 @@ mips_register_name (int regno)
"t8", "t9", "k0", "k1", "gp", "sp", "s8", "ra"
};
- enum mips_abi abi = mips_abi (current_gdbarch);
+ enum mips_abi abi = mips_abi (gdbarch);
/* Map [gdbarch_num_regs .. 2*gdbarch_num_regs) onto the raw registers,
but then don't make the raw register names visible. */
- int rawnum = regno % gdbarch_num_regs (current_gdbarch);
- if (regno < gdbarch_num_regs (current_gdbarch))
+ int rawnum = regno % gdbarch_num_regs (gdbarch);
+ if (regno < gdbarch_num_regs (gdbarch))
return "";
/* The MIPS integer registers are always mapped from 0 to 31. The
@@ -530,9 +530,9 @@ mips_register_name (int regno)
else
return mips_gpr_names[rawnum];
}
- else if (tdesc_has_registers (gdbarch_target_desc (current_gdbarch)))
- return tdesc_register_name (rawnum);
- else if (32 <= rawnum && rawnum < gdbarch_num_regs (current_gdbarch))
+ else if (tdesc_has_registers (gdbarch_target_desc (gdbarch)))
+ return tdesc_register_name (gdbarch, rawnum);
+ else if (32 <= rawnum && rawnum < gdbarch_num_regs (gdbarch))
{
gdb_assert (rawnum - 32 < NUM_MIPS_PROCESSOR_REGS);
return tdep->mips_processor_reg_names[rawnum - 32];
diff --git a/gdb/mn10300-tdep.c b/gdb/mn10300-tdep.c
index f044caf..df63d80 100644
--- a/gdb/mn10300-tdep.c
+++ b/gdb/mn10300-tdep.c
@@ -219,7 +219,7 @@ register_name (int reg, char **regs, long sizeof_regs)
}
static const char *
-mn10300_generic_register_name (int reg)
+mn10300_generic_register_name (struct gdbarch *gdbarch, int reg)
{
static char *regs[] =
{ "d0", "d1", "d2", "d3", "a0", "a1", "a2", "a3",
@@ -232,7 +232,7 @@ mn10300_generic_register_name (int reg)
static const char *
-am33_register_name (int reg)
+am33_register_name (struct gdbarch *gdbarch, int reg)
{
static char *regs[] =
{ "d0", "d1", "d2", "d3", "a0", "a1", "a2", "a3",
@@ -244,7 +244,7 @@ am33_register_name (int reg)
}
static const char *
-am33_2_register_name (int reg)
+am33_2_register_name (struct gdbarch *gdbarch, int reg)
{
static char *regs[] =
{
@@ -843,7 +843,7 @@ mn10300_frame_unwind_cache (struct frame_info *next_frame,
return (*this_prologue_cache);
cache = trad_frame_cache_zalloc (next_frame);
- pc = gdbarch_unwind_pc (current_gdbarch, next_frame);
+ pc = gdbarch_unwind_pc (get_frame_arch (next_frame), next_frame);
mn10300_analyze_prologue (next_frame, (void **) &cache, pc);
if (find_pc_partial_function (pc, NULL, &start, &end))
trad_frame_set_id (cache,
@@ -1179,9 +1179,9 @@ mn10300_gdbarch_init (struct gdbarch_info info,
/* Dump out the mn10300 specific architecture information. */
static void
-mn10300_dump_tdep (struct gdbarch *current_gdbarch, struct ui_file *file)
+mn10300_dump_tdep (struct gdbarch *gdbarch, struct ui_file *file)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
fprintf_unfiltered (file, "mn10300_dump_tdep: am33_mode = %d\n",
tdep->am33_mode);
}
diff --git a/gdb/mt-tdep.c b/gdb/mt-tdep.c
index 93e3b78..2513bdd 100644
--- a/gdb/mt-tdep.c
+++ b/gdb/mt-tdep.c
@@ -140,7 +140,7 @@ enum mt_gdb_regnums
/* Return name of register number specified by REGNUM. */
static const char *
-mt_register_name (int regnum)
+mt_register_name (struct gdbarch *gdbarch, int regnum)
{
static const char *const register_names[] = {
/* CPU regs. */
@@ -311,7 +311,7 @@ mt_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
if (group == all_reggroup)
return (regnum >= 0
&& regnum < MT_NUM_REGS + MT_NUM_PSEUDO_REGS
- && mt_register_name (regnum)[0] != '\0');
+ && mt_register_name (gdbarch, regnum)[0] != '\0');
if (group == general_reggroup)
return (regnum >= MT_R0_REGNUM && regnum <= MT_R15_REGNUM);
@@ -619,8 +619,8 @@ mt_frame_align (struct gdbarch *gdbarch, CORE_ADDR sp)
static void
mt_registers_info (struct gdbarch *gdbarch,
- struct ui_file *file,
- struct frame_info *frame, int regnum, int all)
+ struct ui_file *file,
+ struct frame_info *frame, int regnum, int all)
{
if (regnum == -1)
{
@@ -660,9 +660,9 @@ mt_registers_info (struct gdbarch *gdbarch,
frame_register_read (frame, regnum, buff);
fputs_filtered (gdbarch_register_name
- (current_gdbarch, regnum), file);
+ (gdbarch, regnum), file);
print_spaces_filtered (15 - strlen (gdbarch_register_name
- (current_gdbarch, regnum)),
+ (gdbarch, regnum)),
file);
fputs_filtered ("0x", file);
@@ -684,10 +684,10 @@ mt_registers_info (struct gdbarch *gdbarch,
frame_register_read (frame, MT_COPRO_REGNUM, buf);
/* And print. */
regnum = MT_COPRO_PSEUDOREG_REGNUM;
- fputs_filtered (gdbarch_register_name (current_gdbarch, regnum),
+ fputs_filtered (gdbarch_register_name (gdbarch, regnum),
file);
print_spaces_filtered (15 - strlen (gdbarch_register_name
- (current_gdbarch, regnum)),
+ (gdbarch, regnum)),
file);
val_print (register_type (gdbarch, regnum), buf,
0, 0, file, 0, 1, 0, Val_no_prettyprint);
@@ -717,10 +717,10 @@ mt_registers_info (struct gdbarch *gdbarch,
/* And print. */
regnum = MT_MAC_PSEUDOREG_REGNUM;
- fputs_filtered (gdbarch_register_name (current_gdbarch, regnum),
+ fputs_filtered (gdbarch_register_name (gdbarch, regnum),
file);
print_spaces_filtered (15 - strlen (gdbarch_register_name
- (current_gdbarch, regnum)),
+ (gdbarch, regnum)),
file);
fputs_filtered ("0x", file);
print_longest (file, 'x', 0, newmac);
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index 0843be5..bf53c42 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -2355,9 +2355,9 @@ regsize (const struct reg *reg, int wordsize)
is an anonymous register. */
static const char *
-rs6000_register_name (int regno)
+rs6000_register_name (struct gdbarch *gdbarch, int regno)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
/* The upper half "registers" have names in the XML description,
but we present only the low GPRs and the full 64-bit registers
@@ -2381,7 +2381,7 @@ rs6000_register_name (int regno)
return spe_regnames[regno - tdep->ppc_ev0_regnum];
}
- return tdesc_register_name (regno);
+ return tdesc_register_name (gdbarch, regno);
}
/* Return the GDB type object for the "standard" data type of data in
diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c
index 9deeabc..0c3f6f6 100644
--- a/gdb/s390-tdep.c
+++ b/gdb/s390-tdep.c
@@ -65,7 +65,7 @@ struct gdbarch_tdep
/* Return the name of register REGNUM. */
static const char *
-s390_register_name (int regnum)
+s390_register_name (struct gdbarch *gdbarch, int regnum)
{
static const char *register_names[S390_NUM_TOTAL_REGS] =
{
diff --git a/gdb/score-tdep.c b/gdb/score-tdep.c
index 250ebb9..8df499e 100644
--- a/gdb/score-tdep.c
+++ b/gdb/score-tdep.c
@@ -284,7 +284,7 @@ score_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
}
static const char *
-score_register_name (int regnum)
+score_register_name (struct gdbarch *gdbarch, int regnum)
{
const char *score_register_names[] = {
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
@@ -433,7 +433,7 @@ score_return_value (struct gdbarch *gdbarch, struct type *type,
if (offset + xfer > TYPE_LENGTH (type))
xfer = TYPE_LENGTH (type) - offset;
score_xfer_register (regcache, regnum, xfer,
- gdbarch_byte_order (current_gdbarch),
+ gdbarch_byte_order (gdbarch),
readbuf, writebuf, offset);
}
return RETURN_VALUE_REGISTER_CONVENTION;
@@ -543,7 +543,7 @@ score_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
Where X is a hole. */
- if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG
+ if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG
&& (typecode == TYPE_CODE_STRUCT
|| typecode == TYPE_CODE_UNION)
&& argreg > SCORE_LAST_ARG_REGNUM
@@ -557,7 +557,7 @@ score_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* The last part of a arg should shift left when
gdbarch_byte_order is BFD_ENDIAN_BIG. */
- if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG
+ if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG
&& arg_last_part_p == 1
&& (typecode == TYPE_CODE_STRUCT
|| typecode == TYPE_CODE_UNION))
diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c
index fb36252..d9b7304 100644
--- a/gdb/sh-tdep.c
+++ b/gdb/sh-tdep.c
@@ -74,7 +74,7 @@ struct sh_frame_cache
};
static const char *
-sh_sh_register_name (int reg_nr)
+sh_sh_register_name (struct gdbarch *gdbarch, int reg_nr)
{
static char *register_names[] = {
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
@@ -96,7 +96,7 @@ sh_sh_register_name (int reg_nr)
}
static const char *
-sh_sh3_register_name (int reg_nr)
+sh_sh3_register_name (struct gdbarch *gdbarch, int reg_nr)
{
static char *register_names[] = {
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
@@ -118,7 +118,7 @@ sh_sh3_register_name (int reg_nr)
}
static const char *
-sh_sh3e_register_name (int reg_nr)
+sh_sh3e_register_name (struct gdbarch *gdbarch, int reg_nr)
{
static char *register_names[] = {
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
@@ -140,7 +140,7 @@ sh_sh3e_register_name (int reg_nr)
}
static const char *
-sh_sh2e_register_name (int reg_nr)
+sh_sh2e_register_name (struct gdbarch *gdbarch, int reg_nr)
{
static char *register_names[] = {
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
@@ -162,7 +162,7 @@ sh_sh2e_register_name (int reg_nr)
}
static const char *
-sh_sh2a_register_name (int reg_nr)
+sh_sh2a_register_name (struct gdbarch *gdbarch, int reg_nr)
{
static char *register_names[] = {
/* general registers 0-15 */
@@ -202,7 +202,7 @@ sh_sh2a_register_name (int reg_nr)
}
static const char *
-sh_sh2a_nofpu_register_name (int reg_nr)
+sh_sh2a_nofpu_register_name (struct gdbarch *gdbarch, int reg_nr)
{
static char *register_names[] = {
/* general registers 0-15 */
@@ -242,7 +242,7 @@ sh_sh2a_nofpu_register_name (int reg_nr)
}
static const char *
-sh_sh_dsp_register_name (int reg_nr)
+sh_sh_dsp_register_name (struct gdbarch *gdbarch, int reg_nr)
{
static char *register_names[] = {
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
@@ -264,7 +264,7 @@ sh_sh_dsp_register_name (int reg_nr)
}
static const char *
-sh_sh3_dsp_register_name (int reg_nr)
+sh_sh3_dsp_register_name (struct gdbarch *gdbarch, int reg_nr)
{
static char *register_names[] = {
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
@@ -287,7 +287,7 @@ sh_sh3_dsp_register_name (int reg_nr)
}
static const char *
-sh_sh4_register_name (int reg_nr)
+sh_sh4_register_name (struct gdbarch *gdbarch, int reg_nr)
{
static char *register_names[] = {
/* general registers 0-15 */
@@ -324,7 +324,7 @@ sh_sh4_register_name (int reg_nr)
}
static const char *
-sh_sh4_nofpu_register_name (int reg_nr)
+sh_sh4_nofpu_register_name (struct gdbarch *gdbarch, int reg_nr)
{
static char *register_names[] = {
/* general registers 0-15 */
@@ -359,7 +359,7 @@ sh_sh4_nofpu_register_name (int reg_nr)
}
static const char *
-sh_sh4al_dsp_register_name (int reg_nr)
+sh_sh4al_dsp_register_name (struct gdbarch *gdbarch, int reg_nr)
{
static char *register_names[] = {
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
@@ -873,7 +873,7 @@ sh_frame_align (struct gdbarch *ignore, CORE_ADDR sp)
/* Helper function to justify value in register according to endianess. */
static char *
-sh_justify_value_in_reg (struct value *val, int len)
+sh_justify_value_in_reg (struct gdbarch *gdbarch, struct value *val, int len)
{
static char valbuf[4];
@@ -881,7 +881,7 @@ sh_justify_value_in_reg (struct value *val, int len)
if (len < 4)
{
/* value gets right-justified in the register or stack word */
- if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG)
+ if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
memcpy (valbuf + (4 - len), (char *) value_contents (val), len);
else
memcpy (valbuf, (char *) value_contents (val), len);
@@ -924,7 +924,7 @@ sh_init_flt_argreg (void)
29) the parity of the register number is preserved, which is important
for the double register passing test (see the "argreg & 1" test below). */
static int
-sh_next_flt_argreg (int len)
+sh_next_flt_argreg (struct gdbarch *gdbarch, int len)
{
int argreg;
@@ -954,7 +954,7 @@ sh_next_flt_argreg (int len)
/* Also mark the next register as used. */
flt_argreg_array[argreg + 1] = 1;
}
- else if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_LITTLE)
+ else if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_LITTLE)
{
/* In little endian, gcc passes floats like this: f5, f4, f7, f6, ... */
if (!flt_argreg_array[argreg + 1])
@@ -1053,7 +1053,7 @@ sh_push_dummy_call_fpu (struct gdbarch *gdbarch,
{
type = value_type (args[argnum]);
len = TYPE_LENGTH (type);
- val = sh_justify_value_in_reg (args[argnum], len);
+ val = sh_justify_value_in_reg (gdbarch, args[argnum], len);
/* Some decisions have to be made how various types are handled.
This also differs in different ABIs. */
@@ -1062,7 +1062,7 @@ sh_push_dummy_call_fpu (struct gdbarch *gdbarch,
/* Find out the next register to use for a floating point value. */
treat_as_flt = sh_treat_as_flt_p (type);
if (treat_as_flt)
- flt_argreg = sh_next_flt_argreg (len);
+ flt_argreg = sh_next_flt_argreg (gdbarch, len);
/* In contrast to non-FPU CPUs, arguments are never split between
registers and stack. If an argument doesn't fit in the remaining
registers it's always pushed entirely on the stack. */
@@ -1160,7 +1160,7 @@ sh_push_dummy_call_nofpu (struct gdbarch *gdbarch,
{
type = value_type (args[argnum]);
len = TYPE_LENGTH (type);
- val = sh_justify_value_in_reg (args[argnum], len);
+ val = sh_justify_value_in_reg (gdbarch, args[argnum], len);
while (len > 0)
{
@@ -1230,12 +1230,13 @@ static void
sh_extract_return_value_fpu (struct type *type, struct regcache *regcache,
void *valbuf)
{
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
if (sh_treat_as_flt_p (type))
{
int len = TYPE_LENGTH (type);
- int i, regnum = gdbarch_fp0_regnum (current_gdbarch);
+ int i, regnum = gdbarch_fp0_regnum (gdbarch);
for (i = 0; i < len; i += 4)
- if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_LITTLE)
+ if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_LITTLE)
regcache_raw_read (regcache, regnum++, (char *) valbuf + len - 4 - i);
else
regcache_raw_read (regcache, regnum++, (char *) valbuf + i);
@@ -1274,12 +1275,13 @@ static void
sh_store_return_value_fpu (struct type *type, struct regcache *regcache,
const void *valbuf)
{
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
if (sh_treat_as_flt_p (type))
{
int len = TYPE_LENGTH (type);
- int i, regnum = gdbarch_fp0_regnum (current_gdbarch);
+ int i, regnum = gdbarch_fp0_regnum (gdbarch);
for (i = 0; i < len; i += 4)
- if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_LITTLE)
+ if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_LITTLE)
regcache_raw_write (regcache, regnum++,
(char *) valbuf + len - 4 - i);
else
@@ -2177,22 +2179,22 @@ sh_register_convert_to_raw (struct type *type, int regnum,
/* For vectors of 4 floating point registers. */
static int
-fv_reg_base_num (int fv_regnum)
+fv_reg_base_num (struct gdbarch *gdbarch, int fv_regnum)
{
int fp_regnum;
- fp_regnum = gdbarch_fp0_regnum (current_gdbarch)
+ fp_regnum = gdbarch_fp0_regnum (gdbarch)
+ (fv_regnum - FV0_REGNUM) * 4;
return fp_regnum;
}
/* For double precision floating point registers, i.e 2 fp regs.*/
static int
-dr_reg_base_num (int dr_regnum)
+dr_reg_base_num (struct gdbarch *gdbarch, int dr_regnum)
{
int fp_regnum;
- fp_regnum = gdbarch_fp0_regnum (current_gdbarch)
+ fp_regnum = gdbarch_fp0_regnum (gdbarch)
+ (dr_regnum - DR0_REGNUM) * 2;
return fp_regnum;
}
@@ -2209,7 +2211,7 @@ sh_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
else
if (reg_nr >= DR0_REGNUM && reg_nr <= DR_LAST_REGNUM)
{
- base_regnum = dr_reg_base_num (reg_nr);
+ base_regnum = dr_reg_base_num (gdbarch, reg_nr);
/* Build the value in the provided buffer. */
/* Read the real regs for which this one is an alias. */
@@ -2225,7 +2227,7 @@ sh_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
}
else if (reg_nr >= FV0_REGNUM && reg_nr <= FV_LAST_REGNUM)
{
- base_regnum = fv_reg_base_num (reg_nr);
+ base_regnum = fv_reg_base_num (gdbarch, reg_nr);
/* Read the real regs for which this one is an alias. */
for (portion = 0; portion < 4; portion++)
@@ -2257,7 +2259,7 @@ sh_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
}
else if (reg_nr >= DR0_REGNUM && reg_nr <= DR_LAST_REGNUM)
{
- base_regnum = dr_reg_base_num (reg_nr);
+ base_regnum = dr_reg_base_num (gdbarch, reg_nr);
/* We must pay attention to the endiannes. */
sh_register_convert_to_raw (register_type (gdbarch, reg_nr),
@@ -2272,7 +2274,7 @@ sh_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
}
else if (reg_nr >= FV0_REGNUM && reg_nr <= FV_LAST_REGNUM)
{
- base_regnum = fv_reg_base_num (reg_nr);
+ base_regnum = fv_reg_base_num (gdbarch, reg_nr);
/* Write the real regs for which this one is an alias. */
for (portion = 0; portion < 4; portion++)
diff --git a/gdb/sh64-tdep.c b/gdb/sh64-tdep.c
index d7b6bf3..d26b82c 100644
--- a/gdb/sh64-tdep.c
+++ b/gdb/sh64-tdep.c
@@ -124,7 +124,7 @@ enum
};
static const char *
-sh64_register_name (int reg_nr)
+sh64_register_name (struct gdbarch *gdbarch, int reg_nr)
{
static char *register_names[] =
{
@@ -685,34 +685,31 @@ gdb_print_insn_sh64 (bfd_vma memaddr, disassemble_info *info)
/* For vectors of 4 floating point registers. */
static int
-sh64_fv_reg_base_num (int fv_regnum)
+sh64_fv_reg_base_num (struct gdbarch *gdbarch, int fv_regnum)
{
int fp_regnum;
- fp_regnum = gdbarch_fp0_regnum (current_gdbarch) +
- (fv_regnum - FV0_REGNUM) * 4;
+ fp_regnum = gdbarch_fp0_regnum (gdbarch) + (fv_regnum - FV0_REGNUM) * 4;
return fp_regnum;
}
/* For double precision floating point registers, i.e 2 fp regs.*/
static int
-sh64_dr_reg_base_num (int dr_regnum)
+sh64_dr_reg_base_num (struct gdbarch *gdbarch, int dr_regnum)
{
int fp_regnum;
- fp_regnum = gdbarch_fp0_regnum (current_gdbarch) +
- (dr_regnum - DR0_REGNUM) * 2;
+ fp_regnum = gdbarch_fp0_regnum (gdbarch) + (dr_regnum - DR0_REGNUM) * 2;
return fp_regnum;
}
/* For pairs of floating point registers */
static int
-sh64_fpp_reg_base_num (int fpp_regnum)
+sh64_fpp_reg_base_num (struct gdbarch *gdbarch, int fpp_regnum)
{
int fp_regnum;
- fp_regnum = gdbarch_fp0_regnum (current_gdbarch) +
- (fpp_regnum - FPP0_REGNUM) * 2;
+ fp_regnum = gdbarch_fp0_regnum (gdbarch) + (fpp_regnum - FPP0_REGNUM) * 2;
return fp_regnum;
}
@@ -779,7 +776,7 @@ sh64_fpp_reg_base_num (int fpp_regnum)
*/
/* *INDENT-ON* */
static int
-sh64_compact_reg_base_num (int reg_nr)
+sh64_compact_reg_base_num (struct gdbarch *gdbarch, int reg_nr)
{
int base_regnum = reg_nr;
@@ -791,20 +788,22 @@ sh64_compact_reg_base_num (int reg_nr)
/* floating point register N maps to floating point register N */
else if (reg_nr >= FP0_C_REGNUM
&& reg_nr <= FP_LAST_C_REGNUM)
- base_regnum = reg_nr - FP0_C_REGNUM + gdbarch_fp0_regnum (current_gdbarch);
+ base_regnum = reg_nr - FP0_C_REGNUM + gdbarch_fp0_regnum (gdbarch);
/* double prec register N maps to base regnum for double prec register N */
else if (reg_nr >= DR0_C_REGNUM
&& reg_nr <= DR_LAST_C_REGNUM)
- base_regnum = sh64_dr_reg_base_num (DR0_REGNUM + reg_nr - DR0_C_REGNUM);
+ base_regnum = sh64_dr_reg_base_num (gdbarch,
+ DR0_REGNUM + reg_nr - DR0_C_REGNUM);
/* vector N maps to base regnum for vector register N */
else if (reg_nr >= FV0_C_REGNUM
&& reg_nr <= FV_LAST_C_REGNUM)
- base_regnum = sh64_fv_reg_base_num (FV0_REGNUM + reg_nr - FV0_C_REGNUM);
+ base_regnum = sh64_fv_reg_base_num (gdbarch,
+ FV0_REGNUM + reg_nr - FV0_C_REGNUM);
else if (reg_nr == PC_C_REGNUM)
- base_regnum = gdbarch_pc_regnum (current_gdbarch);
+ base_regnum = gdbarch_pc_regnum (gdbarch);
else if (reg_nr == GBR_C_REGNUM)
base_regnum = 16;
@@ -823,7 +822,7 @@ sh64_compact_reg_base_num (int reg_nr)
base_regnum = FPSCR_REGNUM; /*???? this register is a mess. */
else if (reg_nr == FPUL_C_REGNUM)
- base_regnum = gdbarch_fp0_regnum (current_gdbarch) + 32;
+ base_regnum = gdbarch_fp0_regnum (gdbarch) + 32;
return base_regnum;
}
@@ -1203,15 +1202,16 @@ static void
sh64_extract_return_value (struct type *type, struct regcache *regcache,
void *valbuf)
{
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
int len = TYPE_LENGTH (type);
-
+
if (TYPE_CODE (type) == TYPE_CODE_FLT)
{
if (len == 4)
{
/* Return value stored in gdbarch_fp0_regnum */
regcache_raw_read (regcache,
- gdbarch_fp0_regnum (current_gdbarch), valbuf);
+ gdbarch_fp0_regnum (gdbarch), valbuf);
}
else if (len == 8)
{
@@ -1221,7 +1221,7 @@ sh64_extract_return_value (struct type *type, struct regcache *regcache,
regcache_cooked_read (regcache, DR0_REGNUM, buf);
- if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_LITTLE)
+ if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_LITTLE)
floatformat_to_doublest (&floatformat_ieee_double_littlebyte_bigword,
buf, &val);
else
@@ -1240,8 +1240,8 @@ sh64_extract_return_value (struct type *type, struct regcache *regcache,
at the most significant end. */
regcache_raw_read (regcache, DEFAULT_RETURN_REGNUM, buf);
- if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG)
- offset = register_size (current_gdbarch, DEFAULT_RETURN_REGNUM)
+ if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
+ offset = register_size (gdbarch, DEFAULT_RETURN_REGNUM)
- len;
else
offset = 0;
@@ -1263,14 +1263,15 @@ static void
sh64_store_return_value (struct type *type, struct regcache *regcache,
const void *valbuf)
{
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
char buf[64]; /* more than enough... */
int len = TYPE_LENGTH (type);
if (TYPE_CODE (type) == TYPE_CODE_FLT)
{
- int i, regnum = gdbarch_fp0_regnum (current_gdbarch);
+ int i, regnum = gdbarch_fp0_regnum (gdbarch);
for (i = 0; i < len; i += 4)
- if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_LITTLE)
+ if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_LITTLE)
regcache_raw_write (regcache, regnum++,
(char *) valbuf + len - 4 - i);
else
@@ -1281,15 +1282,15 @@ sh64_store_return_value (struct type *type, struct regcache *regcache,
int return_register = DEFAULT_RETURN_REGNUM;
int offset = 0;
- if (len <= register_size (current_gdbarch, return_register))
+ if (len <= register_size (gdbarch, return_register))
{
/* Pad with zeros. */
- memset (buf, 0, register_size (current_gdbarch, return_register));
- if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_LITTLE)
- offset = 0; /*register_size (current_gdbarch,
+ memset (buf, 0, register_size (gdbarch, return_register));
+ if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_LITTLE)
+ offset = 0; /*register_size (gdbarch,
return_register) - len;*/
else
- offset = register_size (current_gdbarch, return_register) - len;
+ offset = register_size (gdbarch, return_register) - len;
memcpy (buf + offset, valbuf, len);
regcache_raw_write (regcache, return_register, buf);
@@ -1542,13 +1543,13 @@ sh64_register_type (struct gdbarch *gdbarch, int reg_nr)
}
static void
-sh64_register_convert_to_virtual (int regnum, struct type *type,
- char *from, char *to)
+sh64_register_convert_to_virtual (struct gdbarch *gdbarch, int regnum,
+ struct type *type, char *from, char *to)
{
- if (gdbarch_byte_order (current_gdbarch) != BFD_ENDIAN_LITTLE)
+ if (gdbarch_byte_order (gdbarch) != BFD_ENDIAN_LITTLE)
{
/* It is a no-op. */
- memcpy (to, from, register_size (current_gdbarch, regnum));
+ memcpy (to, from, register_size (gdbarch, regnum));
return;
}
@@ -1567,13 +1568,13 @@ sh64_register_convert_to_virtual (int regnum, struct type *type,
}
static void
-sh64_register_convert_to_raw (struct type *type, int regnum,
- const void *from, void *to)
+sh64_register_convert_to_raw (struct gdbarch *gdbarch, struct type *type,
+ int regnum, const void *from, void *to)
{
- if (gdbarch_byte_order (current_gdbarch) != BFD_ENDIAN_LITTLE)
+ if (gdbarch_byte_order (gdbarch) != BFD_ENDIAN_LITTLE)
{
/* It is a no-op. */
- memcpy (to, from, register_size (current_gdbarch, regnum));
+ memcpy (to, from, register_size (gdbarch, regnum));
return;
}
@@ -1602,7 +1603,7 @@ sh64_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
if (reg_nr >= DR0_REGNUM
&& reg_nr <= DR_LAST_REGNUM)
{
- base_regnum = sh64_dr_reg_base_num (reg_nr);
+ base_regnum = sh64_dr_reg_base_num (gdbarch, reg_nr);
/* Build the value in the provided buffer. */
/* DR regs are double precision registers obtained by
@@ -1613,7 +1614,7 @@ sh64_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
+ register_size (gdbarch, base_regnum) * portion));
/* We must pay attention to the endianness. */
- sh64_register_convert_to_virtual (reg_nr,
+ sh64_register_convert_to_virtual (gdbarch, reg_nr,
register_type (gdbarch, reg_nr),
temp_buffer, buffer);
@@ -1622,7 +1623,7 @@ sh64_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
else if (reg_nr >= FPP0_REGNUM
&& reg_nr <= FPP_LAST_REGNUM)
{
- base_regnum = sh64_fpp_reg_base_num (reg_nr);
+ base_regnum = sh64_fpp_reg_base_num (gdbarch, reg_nr);
/* Build the value in the provided buffer. */
/* FPP regs are pairs of single precision registers obtained by
@@ -1636,7 +1637,7 @@ sh64_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
else if (reg_nr >= FV0_REGNUM
&& reg_nr <= FV_LAST_REGNUM)
{
- base_regnum = sh64_fv_reg_base_num (reg_nr);
+ base_regnum = sh64_fv_reg_base_num (gdbarch, reg_nr);
/* Build the value in the provided buffer. */
/* FV regs are vectors of single precision registers obtained by
@@ -1651,7 +1652,7 @@ sh64_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
else if (reg_nr >= R0_C_REGNUM
&& reg_nr <= T_C_REGNUM)
{
- base_regnum = sh64_compact_reg_base_num (reg_nr);
+ base_regnum = sh64_compact_reg_base_num (gdbarch, reg_nr);
/* Build the value in the provided buffer. */
regcache_raw_read (regcache, base_regnum, temp_buffer);
@@ -1663,7 +1664,7 @@ sh64_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
else if (reg_nr >= FP0_C_REGNUM
&& reg_nr <= FP_LAST_C_REGNUM)
{
- base_regnum = sh64_compact_reg_base_num (reg_nr);
+ base_regnum = sh64_compact_reg_base_num (gdbarch, reg_nr);
/* Build the value in the provided buffer. */
/* Floating point registers map 1-1 to the media fp regs,
@@ -1674,7 +1675,7 @@ sh64_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
else if (reg_nr >= DR0_C_REGNUM
&& reg_nr <= DR_LAST_C_REGNUM)
{
- base_regnum = sh64_compact_reg_base_num (reg_nr);
+ base_regnum = sh64_compact_reg_base_num (gdbarch, reg_nr);
/* DR_C regs are double precision registers obtained by
concatenating 2 single precision floating point registers. */
@@ -1684,7 +1685,7 @@ sh64_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
+ register_size (gdbarch, base_regnum) * portion));
/* We must pay attention to the endianness. */
- sh64_register_convert_to_virtual (reg_nr,
+ sh64_register_convert_to_virtual (gdbarch, reg_nr,
register_type (gdbarch, reg_nr),
temp_buffer, buffer);
}
@@ -1692,7 +1693,7 @@ sh64_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
else if (reg_nr >= FV0_C_REGNUM
&& reg_nr <= FV_LAST_C_REGNUM)
{
- base_regnum = sh64_compact_reg_base_num (reg_nr);
+ base_regnum = sh64_compact_reg_base_num (gdbarch, reg_nr);
/* Build the value in the provided buffer. */
/* FV_C regs are vectors of single precision registers obtained by
@@ -1749,7 +1750,7 @@ sh64_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
else if (reg_nr == FPUL_C_REGNUM)
{
- base_regnum = sh64_compact_reg_base_num (reg_nr);
+ base_regnum = sh64_compact_reg_base_num (gdbarch, reg_nr);
/* FPUL_C register is floating point register 32,
same size, same endianness. */
@@ -1768,9 +1769,9 @@ sh64_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
if (reg_nr >= DR0_REGNUM
&& reg_nr <= DR_LAST_REGNUM)
{
- base_regnum = sh64_dr_reg_base_num (reg_nr);
+ base_regnum = sh64_dr_reg_base_num (gdbarch, reg_nr);
/* We must pay attention to the endianness. */
- sh64_register_convert_to_raw (register_type (gdbarch, reg_nr),
+ sh64_register_convert_to_raw (gdbarch, register_type (gdbarch, reg_nr),
reg_nr,
buffer, temp_buffer);
@@ -1785,7 +1786,7 @@ sh64_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
else if (reg_nr >= FPP0_REGNUM
&& reg_nr <= FPP_LAST_REGNUM)
{
- base_regnum = sh64_fpp_reg_base_num (reg_nr);
+ base_regnum = sh64_fpp_reg_base_num (gdbarch, reg_nr);
/* Write the real regs for which this one is an alias. */
for (portion = 0; portion < 2; portion++)
@@ -1798,7 +1799,7 @@ sh64_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
else if (reg_nr >= FV0_REGNUM
&& reg_nr <= FV_LAST_REGNUM)
{
- base_regnum = sh64_fv_reg_base_num (reg_nr);
+ base_regnum = sh64_fv_reg_base_num (gdbarch, reg_nr);
/* Write the real regs for which this one is an alias. */
for (portion = 0; portion < 4; portion++)
@@ -1813,7 +1814,7 @@ sh64_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
else if (reg_nr >= R0_C_REGNUM
&& reg_nr <= T_C_REGNUM)
{
- base_regnum = sh64_compact_reg_base_num (reg_nr);
+ base_regnum = sh64_compact_reg_base_num (gdbarch, reg_nr);
/* reg_nr is 32 bit here, and base_regnum is 64 bits. */
if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
offset = 4;
@@ -1833,18 +1834,19 @@ sh64_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
else if (reg_nr >= FP0_C_REGNUM
&& reg_nr <= FP_LAST_C_REGNUM)
{
- base_regnum = sh64_compact_reg_base_num (reg_nr);
+ base_regnum = sh64_compact_reg_base_num (gdbarch, reg_nr);
regcache_raw_write (regcache, base_regnum, buffer);
}
else if (reg_nr >= DR0_C_REGNUM
&& reg_nr <= DR_LAST_C_REGNUM)
{
- base_regnum = sh64_compact_reg_base_num (reg_nr);
+ base_regnum = sh64_compact_reg_base_num (gdbarch, reg_nr);
for (portion = 0; portion < 2; portion++)
{
/* We must pay attention to the endianness. */
- sh64_register_convert_to_raw (register_type (gdbarch, reg_nr),
+ sh64_register_convert_to_raw (gdbarch,
+ register_type (gdbarch, reg_nr),
reg_nr,
buffer, temp_buffer);
@@ -1858,7 +1860,7 @@ sh64_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
else if (reg_nr >= FV0_C_REGNUM
&& reg_nr <= FV_LAST_C_REGNUM)
{
- base_regnum = sh64_compact_reg_base_num (reg_nr);
+ base_regnum = sh64_compact_reg_base_num (gdbarch, reg_nr);
for (portion = 0; portion < 4; portion++)
{
@@ -1924,7 +1926,7 @@ sh64_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
else if (reg_nr == FPUL_C_REGNUM)
{
- base_regnum = sh64_compact_reg_base_num (reg_nr);
+ base_regnum = sh64_compact_reg_base_num (gdbarch, reg_nr);
regcache_raw_write (regcache, base_regnum, buffer);
}
}
@@ -2035,7 +2037,7 @@ sh64_do_pseudo_register (struct gdbarch *gdbarch, struct ui_file *file,
else if ((regnum >= DR0_REGNUM && regnum <= DR_LAST_REGNUM))
{
- int fp_regnum = sh64_dr_reg_base_num (regnum);
+ int fp_regnum = sh64_dr_reg_base_num (gdbarch, regnum);
fprintf_filtered (file, "dr%d\t0x%08x%08x\n", regnum - DR0_REGNUM,
(unsigned) get_frame_register_unsigned (frame, fp_regnum),
(unsigned) get_frame_register_unsigned (frame, fp_regnum + 1));
@@ -2043,7 +2045,7 @@ sh64_do_pseudo_register (struct gdbarch *gdbarch, struct ui_file *file,
else if ((regnum >= DR0_C_REGNUM && regnum <= DR_LAST_C_REGNUM))
{
- int fp_regnum = sh64_compact_reg_base_num (regnum);
+ int fp_regnum = sh64_compact_reg_base_num (gdbarch, regnum);
fprintf_filtered (file, "dr%d_c\t0x%08x%08x\n", regnum - DR0_C_REGNUM,
(unsigned) get_frame_register_unsigned (frame, fp_regnum),
(unsigned) get_frame_register_unsigned (frame, fp_regnum + 1));
@@ -2051,7 +2053,7 @@ sh64_do_pseudo_register (struct gdbarch *gdbarch, struct ui_file *file,
else if ((regnum >= FV0_REGNUM && regnum <= FV_LAST_REGNUM))
{
- int fp_regnum = sh64_fv_reg_base_num (regnum);
+ int fp_regnum = sh64_fv_reg_base_num (gdbarch, regnum);
fprintf_filtered (file, "fv%d\t0x%08x\t0x%08x\t0x%08x\t0x%08x\n",
regnum - FV0_REGNUM,
(unsigned) get_frame_register_unsigned (frame, fp_regnum),
@@ -2062,7 +2064,7 @@ sh64_do_pseudo_register (struct gdbarch *gdbarch, struct ui_file *file,
else if ((regnum >= FV0_C_REGNUM && regnum <= FV_LAST_C_REGNUM))
{
- int fp_regnum = sh64_compact_reg_base_num (regnum);
+ int fp_regnum = sh64_compact_reg_base_num (gdbarch, regnum);
fprintf_filtered (file, "fv%d_c\t0x%08x\t0x%08x\t0x%08x\t0x%08x\n",
regnum - FV0_C_REGNUM,
(unsigned) get_frame_register_unsigned (frame, fp_regnum),
@@ -2073,7 +2075,7 @@ sh64_do_pseudo_register (struct gdbarch *gdbarch, struct ui_file *file,
else if (regnum >= FPP0_REGNUM && regnum <= FPP_LAST_REGNUM)
{
- int fp_regnum = sh64_fpp_reg_base_num (regnum);
+ int fp_regnum = sh64_fpp_reg_base_num (gdbarch, regnum);
fprintf_filtered (file, "fpp%d\t0x%08x\t0x%08x\n", regnum - FPP0_REGNUM,
(unsigned) get_frame_register_unsigned (frame, fp_regnum),
(unsigned) get_frame_register_unsigned (frame, fp_regnum + 1));
@@ -2081,7 +2083,7 @@ sh64_do_pseudo_register (struct gdbarch *gdbarch, struct ui_file *file,
else if (regnum >= R0_C_REGNUM && regnum <= R_LAST_C_REGNUM)
{
- int c_regnum = sh64_compact_reg_base_num (regnum);
+ int c_regnum = sh64_compact_reg_base_num (gdbarch, regnum);
fprintf_filtered (file, "r%d_c\t0x%08x\n", regnum - R0_C_REGNUM,
(unsigned) get_frame_register_unsigned (frame, c_regnum));
}
diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c
index 7343892..60eccd2 100644
--- a/gdb/sparc-tdep.c
+++ b/gdb/sparc-tdep.c
@@ -271,7 +271,7 @@ static const char *sparc32_pseudo_register_names[] =
/* Return the name of register REGNUM. */
static const char *
-sparc32_register_name (int regnum)
+sparc32_register_name (struct gdbarch *gdbarch, int regnum)
{
if (regnum >= 0 && regnum < SPARC32_NUM_REGS)
return sparc32_register_names[regnum];
diff --git a/gdb/sparc64-tdep.c b/gdb/sparc64-tdep.c
index 7d955d9..1afec31 100644
--- a/gdb/sparc64-tdep.c
+++ b/gdb/sparc64-tdep.c
@@ -225,7 +225,7 @@ static const char *sparc64_pseudo_register_names[] =
/* Return the name of register REGNUM. */
static const char *
-sparc64_register_name (int regnum)
+sparc64_register_name (struct gdbarch *gdbarch, int regnum)
{
if (regnum >= 0 && regnum < SPARC64_NUM_REGS)
return sparc64_register_names[regnum];
diff --git a/gdb/spu-tdep.c b/gdb/spu-tdep.c
index 4142739..7fb99a4 100644
--- a/gdb/spu-tdep.c
+++ b/gdb/spu-tdep.c
@@ -94,7 +94,7 @@ static struct cmd_list_element *infospucmdlist = NULL;
/* Registers. */
static const char *
-spu_register_name (int reg_nr)
+spu_register_name (struct gdbarch *gdbarch, int reg_nr)
{
static char *register_names[] =
{
diff --git a/gdb/target-descriptions.c b/gdb/target-descriptions.c
index bb5b8ab..ac4901d 100644
--- a/gdb/target-descriptions.c
+++ b/gdb/target-descriptions.c
@@ -507,21 +507,20 @@ tdesc_find_register (struct gdbarch *gdbarch, int regno)
from an architecture-provided pseudo_register_name method. */
const char *
-tdesc_register_name (int regno)
+tdesc_register_name (struct gdbarch *gdbarch, int regno)
{
- struct tdesc_reg *reg = tdesc_find_register (current_gdbarch, regno);
- int num_regs = gdbarch_num_regs (current_gdbarch);
- int num_pseudo_regs = gdbarch_num_pseudo_regs (current_gdbarch);
+ struct tdesc_reg *reg = tdesc_find_register (gdbarch, regno);
+ int num_regs = gdbarch_num_regs (gdbarch);
+ int num_pseudo_regs = gdbarch_num_pseudo_regs (gdbarch);
if (reg != NULL)
return reg->name;
if (regno >= num_regs && regno < num_regs + num_pseudo_regs)
{
- struct tdesc_arch_data *data = gdbarch_data (current_gdbarch,
- tdesc_data);
+ struct tdesc_arch_data *data = gdbarch_data (gdbarch, tdesc_data);
gdb_assert (data->pseudo_register_name != NULL);
- return data->pseudo_register_name (regno);
+ return data->pseudo_register_name (gdbarch, regno);
}
return "";
diff --git a/gdb/target-descriptions.h b/gdb/target-descriptions.h
index 95fb942..8e85c37 100644
--- a/gdb/target-descriptions.h
+++ b/gdb/target-descriptions.h
@@ -152,7 +152,7 @@ struct type *tdesc_named_type (const struct tdesc_feature *feature,
/* Return the name of register REGNO, from the target description or
from an architecture-provided pseudo_register_name method. */
-const char *tdesc_register_name (int regno);
+const char *tdesc_register_name (struct gdbarch *gdbarch, int regno);
/* Check whether REGNUM is a member of REGGROUP using the target
description. Return -1 if the target description does not
diff --git a/gdb/v850-tdep.c b/gdb/v850-tdep.c
index 72bcabc..742db7a 100644
--- a/gdb/v850-tdep.c
+++ b/gdb/v850-tdep.c
@@ -139,7 +139,7 @@ struct pifsr /* Info about one saved register. */
};
static const char *
-v850_register_name (int regnum)
+v850_register_name (struct gdbarch *gdbarch, int regnum)
{
static const char *v850_reg_names[] =
{ "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
@@ -158,7 +158,7 @@ v850_register_name (int regnum)
}
static const char *
-v850e_register_name (int regnum)
+v850e_register_name (struct gdbarch *gdbarch, int regnum)
{
static const char *v850e_reg_names[] =
{
@@ -939,14 +939,14 @@ static CORE_ADDR
v850_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
{
return frame_unwind_register_unsigned (next_frame,
- gdbarch_sp_regnum (current_gdbarch));
+ gdbarch_sp_regnum (gdbarch));
}
static CORE_ADDR
v850_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
{
return frame_unwind_register_unsigned (next_frame,
- gdbarch_pc_regnum (current_gdbarch));
+ gdbarch_pc_regnum (gdbarch));
}
static struct frame_id
diff --git a/gdb/vax-tdep.c b/gdb/vax-tdep.c
index ca48e9b..c1ff3a0 100644
--- a/gdb/vax-tdep.c
+++ b/gdb/vax-tdep.c
@@ -40,7 +40,7 @@
/* Return the name of register REGNUM. */
static const char *
-vax_register_name (int regnum)
+vax_register_name (struct gdbarch *gdbarch, int regnum)
{
static char *register_names[] =
{
diff --git a/gdb/xstormy16-tdep.c b/gdb/xstormy16-tdep.c
index 92239bb..7cd6410 100644
--- a/gdb/xstormy16-tdep.c
+++ b/gdb/xstormy16-tdep.c
@@ -104,7 +104,7 @@ enum
Returns the name of the standard Xstormy16 register N. */
static const char *
-xstormy16_register_name (int regnum)
+xstormy16_register_name (struct gdbarch *gdbarch, int regnum)
{
static char *register_names[] = {
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c
index cce09f5..52aa7be 100644
--- a/gdb/xtensa-tdep.c
+++ b/gdb/xtensa-tdep.c
@@ -181,12 +181,12 @@ extract_call_winsize (CORE_ADDR pc)
/* Returns the name of a register. */
static const char *
-xtensa_register_name (int regnum)
+xtensa_register_name (struct gdbarch *gdbarch, int regnum)
{
/* Return the name stored in the register map. */
- if (regnum >= 0 && regnum < gdbarch_num_regs (current_gdbarch)
- + gdbarch_num_pseudo_regs (current_gdbarch))
- return gdbarch_tdep (current_gdbarch)->regmap[regnum].name;
+ if (regnum >= 0 && regnum < gdbarch_num_regs (gdbarch)
+ + gdbarch_num_pseudo_regs (gdbarch))
+ return gdbarch_tdep (gdbarch)->regmap[regnum].name;
internal_error (__FILE__, __LINE__, _("invalid register %d"), regnum);
return 0;
@@ -500,7 +500,7 @@ xtensa_pseudo_register_read (struct gdbarch *gdbarch,
gdb_byte *buffer)
{
DEBUGTRACE ("xtensa_pseudo_register_read (... regnum = %d (%s) ...)\n",
- regnum, xtensa_register_name (regnum));
+ regnum, xtensa_register_name (gdbarch, regnum));
if (regnum == gdbarch_num_regs (gdbarch)
+ gdbarch_num_pseudo_regs (gdbarch))
@@ -536,7 +536,7 @@ xtensa_pseudo_register_read (struct gdbarch *gdbarch,
if ((flags & xtTargetFlagsNonVisibleRegs) == 0)
{
warning (_("cannot read register %s"),
- xtensa_register_name (regnum));
+ xtensa_register_name (gdbarch, regnum));
return;
}
}
@@ -584,7 +584,7 @@ xtensa_pseudo_register_write (struct gdbarch *gdbarch,
const gdb_byte *buffer)
{
DEBUGTRACE ("xtensa_pseudo_register_write (... regnum = %d (%s) ...)\n",
- regnum, xtensa_register_name (regnum));
+ regnum, xtensa_register_name (gdbarch, regnum));
if (regnum == gdbarch_num_regs (gdbarch)
+ gdbarch_num_pseudo_regs (gdbarch))
@@ -624,7 +624,7 @@ xtensa_pseudo_register_write (struct gdbarch *gdbarch,
if ((flags & xtTargetFlagsNonVisibleRegs) == 0)
{
warning (_("cannot write register %s"),
- xtensa_register_name (regnum));
+ xtensa_register_name (gdbarch, regnum));
return;
}
}
@@ -1248,7 +1248,7 @@ xtensa_frame_prev_register (struct frame_info *next_frame,
"*this 0x%08x, regnum %d (%s), ...)\n",
(unsigned int) next_frame,
*this_cache ? (unsigned int) *this_cache : 0, regnum,
- xtensa_register_name (regnum));
+ xtensa_register_name (gdbarch, regnum));
if (regnum ==gdbarch_pc_regnum (gdbarch))
saved_reg = cache->ra;