Multi-arch REGISTER_SIM_REGNO. Update d10v.

This commit is contained in:
Andrew Cagney 2000-08-02 11:05:50 +00:00
parent 8e2481732f
commit 7c7651b2d0
9 changed files with 86 additions and 20 deletions

View File

@ -1,3 +1,16 @@
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,

View File

@ -220,6 +220,12 @@ generic_register_convertible_not (int num)
}
int
default_register_sim_regno (int num)
{
return num;
}
/* Functions to manipulate the endianness of the target. */
#ifdef TARGET_BYTE_ORDER_SELECTABLE

View File

@ -88,4 +88,9 @@ extern void set_architecture_from_arch_mach (enum bfd_architecture, unsigned lon
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

View File

@ -1,5 +1,5 @@
/* 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.
@ -22,7 +22,4 @@
#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

View File

@ -55,7 +55,6 @@ struct gdbarch_tdep
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
@ -274,12 +273,6 @@ d10v_ts3_register_sim_regno (int nr)
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. */
@ -1467,6 +1460,7 @@ d10v_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
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);
@ -1483,9 +1477,9 @@ d10v_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
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;
@ -1493,9 +1487,9 @@ d10v_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
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;
@ -1608,6 +1602,8 @@ d10v_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
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;
}

View File

@ -162,6 +162,7 @@ struct 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;
@ -298,6 +299,7 @@ struct gdbarch startup_gdbarch =
0,
0,
0,
0,
generic_get_saved_register,
0,
0,
@ -384,6 +386,7 @@ gdbarch_alloc (const struct gdbarch_info *info,
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;
@ -527,6 +530,7 @@ verify_gdbarch (struct gdbarch *gdbarch)
&& (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");
@ -880,6 +884,12 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
"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",
@ -1484,6 +1494,13 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
(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",
@ -2518,6 +2535,23 @@ set_gdbarch_do_registers_info (struct gdbarch *gdbarch,
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)
{
@ -3728,8 +3762,7 @@ init_gdbarch_data (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.");
@ -4121,7 +4154,7 @@ disassemble_info tm_print_insn_info;
extern void _initialize_gdbarch (void);
void
_initialize_gdbarch ()
_initialize_gdbarch (void)
{
struct cmd_list_element *c;

View File

@ -410,6 +410,23 @@ extern void set_gdbarch_do_registers_info (struct gdbarch *gdbarch, gdbarch_do_r
#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

View File

@ -342,6 +342,9 @@ f:2:REGISTER_VIRTUAL_SIZE:int:register_virtual_size:int reg_nr:reg_nr::0:0
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

View File

@ -270,10 +270,6 @@ gdb_os_error (host_callback * p, const char *format,...)
}
}
#ifndef REGISTER_SIM_REGNO
#define REGISTER_SIM_REGNO(N) (N)
#endif
static void
gdbsim_fetch_register (int regno)
{