+Wed Aug 2 19:15:34 2000 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * arch-utils.h, gdbarch.c (default_register_sim_regno): New
+ function.
+ * gdbarch.sh (REGISTER_SIM_REGNO): Add.
+ * gdbarch.h, gdbarch.c: Regenerate.
+ * remote-sim.c (REGISTER_SIM_REGNO): Delete definition.
+
+ * config/d10v/tm-d10v.h (REGISTER_SIM_REGNO): Delete.
+ * d10v-tdep.c (d10v_gdbarch_init): Update.
+ (struct gdbarch_tdep): Delete member register_sim_regno.
+ (d10v_register_sim_regno): Delete function.
+
Wed Aug 2 14:46:18 2000 Andrew Cagney <cagney@b1.cygnus.com>
* remote.c (enum packet_detect, packet_support_enums,
}
+int
+default_register_sim_regno (int num)
+{
+ return num;
+}
+
/* Functions to manipulate the endianness of the target. */
#ifdef TARGET_BYTE_ORDER_SELECTABLE
extern int (*target_architecture_hook) (const struct bfd_arch_info *);
+
+/* Default raw->sim register re-numbering - does nothing. */
+
+extern int default_register_sim_regno (int reg_nr);
+
#endif
/* Target-specific definition for the Mitsubishi D10V
- Copyright (C) 1996,1999 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1999, 2000 Free Software Foundation, Inc.
This file is part of GDB.
#define GDB_MULTI_ARCH 1
-extern int d10v_register_sim_regno (int reg);
-#define REGISTER_SIM_REGNO(NR) d10v_register_sim_regno((NR))
-
#define NO_EXTRA_ALIGNMENT_NEEDED 1
int nr_dmap_regs;
unsigned long (*dmap_register) (int nr);
unsigned long (*imap_register) (int nr);
- int (*register_sim_regno) (int nr);
};
/* These are the addresses the D10V-EVA board maps data and
return nr;
}
-int
-d10v_register_sim_regno (int nr)
-{
- return gdbarch_tdep (current_gdbarch)->register_sim_regno (nr);
-}
-
/* Index within `registers' of the first byte of the space for
register REG_NR. */
int d10v_num_regs;
struct gdbarch_tdep *tdep;
gdbarch_register_name_ftype *d10v_register_name;
+ gdbarch_register_sim_regno_ftype *d10v_register_sim_regno;
/* Find a candidate among the list of pre-declared architectures. */
arches = gdbarch_list_lookup_by_info (arches, &info);
case bfd_mach_d10v_ts2:
d10v_num_regs = 37;
d10v_register_name = d10v_ts2_register_name;
+ d10v_register_sim_regno = d10v_ts2_register_sim_regno;
tdep->a0_regnum = TS2_A0_REGNUM;
tdep->nr_dmap_regs = TS2_NR_DMAP_REGS;
- tdep->register_sim_regno = d10v_ts2_register_sim_regno;
tdep->dmap_register = d10v_ts2_dmap_register;
tdep->imap_register = d10v_ts2_imap_register;
break;
case bfd_mach_d10v_ts3:
d10v_num_regs = 42;
d10v_register_name = d10v_ts3_register_name;
+ d10v_register_sim_regno = d10v_ts3_register_sim_regno;
tdep->a0_regnum = TS3_A0_REGNUM;
tdep->nr_dmap_regs = TS3_NR_DMAP_REGS;
- tdep->register_sim_regno = d10v_ts3_register_sim_regno;
tdep->dmap_register = d10v_ts3_dmap_register;
tdep->imap_register = d10v_ts3_imap_register;
break;
set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown);
set_gdbarch_stack_align (gdbarch, d10v_stack_align);
+ set_gdbarch_register_sim_regno (gdbarch, d10v_register_sim_regno);
+
return gdbarch;
}
int max_register_virtual_size;
gdbarch_register_virtual_type_ftype *register_virtual_type;
gdbarch_do_registers_info_ftype *do_registers_info;
+ gdbarch_register_sim_regno_ftype *register_sim_regno;
int use_generic_dummy_frames;
int call_dummy_location;
gdbarch_call_dummy_address_ftype *call_dummy_address;
0,
0,
0,
+ 0,
generic_get_saved_register,
0,
0,
gdbarch->max_register_raw_size = -1;
gdbarch->max_register_virtual_size = -1;
gdbarch->do_registers_info = do_registers_info;
+ gdbarch->register_sim_regno = default_register_sim_regno;
gdbarch->use_generic_dummy_frames = -1;
gdbarch->call_dummy_start_offset = -1;
gdbarch->call_dummy_breakpoint_offset = -1;
&& (gdbarch->register_virtual_type == 0))
internal_error ("gdbarch: verify_gdbarch: register_virtual_type invalid");
/* Skip verify of do_registers_info, invalid_p == 0 */
+ /* Skip verify of register_sim_regno, invalid_p == 0 */
if ((GDB_MULTI_ARCH >= 1)
&& (gdbarch->use_generic_dummy_frames == -1))
internal_error ("gdbarch: verify_gdbarch: use_generic_dummy_frames invalid");
"DO_REGISTERS_INFO(reg_nr, fpregs)",
XSTRING (DO_REGISTERS_INFO (reg_nr, fpregs)));
#endif
+#ifdef REGISTER_SIM_REGNO
+ fprintf_unfiltered (file,
+ "gdbarch_dump: %s # %s\n",
+ "REGISTER_SIM_REGNO(reg_nr)",
+ XSTRING (REGISTER_SIM_REGNO (reg_nr)));
+#endif
#ifdef USE_GENERIC_DUMMY_FRAMES
fprintf_unfiltered (file,
"gdbarch_dump: USE_GENERIC_DUMMY_FRAMES # %s\n",
(long) current_gdbarch->do_registers_info
/*DO_REGISTERS_INFO ()*/);
#endif
+#ifdef REGISTER_SIM_REGNO
+ if (GDB_MULTI_ARCH)
+ fprintf_unfiltered (file,
+ "gdbarch_dump: REGISTER_SIM_REGNO = 0x%08lx\n",
+ (long) current_gdbarch->register_sim_regno
+ /*REGISTER_SIM_REGNO ()*/);
+#endif
#ifdef USE_GENERIC_DUMMY_FRAMES
fprintf_unfiltered (file,
"gdbarch_dump: USE_GENERIC_DUMMY_FRAMES = %ld\n",
gdbarch->do_registers_info = do_registers_info;
}
+int
+gdbarch_register_sim_regno (struct gdbarch *gdbarch, int reg_nr)
+{
+ if (gdbarch->register_sim_regno == 0)
+ internal_error ("gdbarch: gdbarch_register_sim_regno invalid");
+ if (gdbarch_debug >= 2)
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_register_sim_regno called\n");
+ return gdbarch->register_sim_regno (reg_nr);
+}
+
+void
+set_gdbarch_register_sim_regno (struct gdbarch *gdbarch,
+ gdbarch_register_sim_regno_ftype register_sim_regno)
+{
+ gdbarch->register_sim_regno = register_sim_regno;
+}
+
int
gdbarch_use_generic_dummy_frames (struct gdbarch *gdbarch)
{
data-pointer. */
void *
-gdbarch_data (data)
- struct gdbarch_data *data;
+gdbarch_data (struct gdbarch_data *data)
{
if (data->index >= current_gdbarch->nr_data)
internal_error ("gdbarch_data: request for non-existant data.");
extern void _initialize_gdbarch (void);
void
-_initialize_gdbarch ()
+_initialize_gdbarch (void)
{
struct cmd_list_element *c;
#endif
#endif
+/* MAP a GDB RAW register number onto a simulator register number. See
+ also include/...-sim.h. */
+
+/* Default (function) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (REGISTER_SIM_REGNO)
+#define REGISTER_SIM_REGNO(reg_nr) (default_register_sim_regno (reg_nr))
+#endif
+
+typedef int (gdbarch_register_sim_regno_ftype) (int reg_nr);
+extern int gdbarch_register_sim_regno (struct gdbarch *gdbarch, int reg_nr);
+extern void set_gdbarch_register_sim_regno (struct gdbarch *gdbarch, gdbarch_register_sim_regno_ftype *register_sim_regno);
+#if GDB_MULTI_ARCH
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (REGISTER_SIM_REGNO)
+#define REGISTER_SIM_REGNO(reg_nr) (gdbarch_register_sim_regno (current_gdbarch, reg_nr))
+#endif
+#endif
+
extern int gdbarch_use_generic_dummy_frames (struct gdbarch *gdbarch);
extern void set_gdbarch_use_generic_dummy_frames (struct gdbarch *gdbarch, int use_generic_dummy_frames);
#if GDB_MULTI_ARCH
v:2:MAX_REGISTER_VIRTUAL_SIZE:int:max_register_virtual_size::::0:-1
f:2:REGISTER_VIRTUAL_TYPE:struct type *:register_virtual_type:int reg_nr:reg_nr::0:0
f:2:DO_REGISTERS_INFO:void:do_registers_info:int reg_nr, int fpregs:reg_nr, fpregs:::do_registers_info::0
+# MAP a GDB RAW register number onto a simulator register number. See
+# also include/...-sim.h.
+f:2:REGISTER_SIM_REGNO:int:register_sim_regno:int reg_nr:reg_nr:::default_register_sim_regno::0
#
v:1:USE_GENERIC_DUMMY_FRAMES:int:use_generic_dummy_frames::::0:-1
v:2:CALL_DUMMY_LOCATION:int:call_dummy_location::::0:0
}
}
-#ifndef REGISTER_SIM_REGNO
-#define REGISTER_SIM_REGNO(N) (N)
-#endif
-
static void
gdbsim_fetch_register (int regno)
{