From 27d94c493022d2df99367343248bd552f17c79a1 Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Fri, 2 May 2003 23:56:12 +0000 Subject: [PATCH] 2003-05-02 Andrew Cagney * gdbarch.sh (REGISTER_SIZE, REGISTER_BYTES): Make optional. * gdbarch.h, gdbarch.c: Re-generate. * d10v-tdep.c (d10v_gdbarch_init): Do not set register_size, register_virtual_size, pc_regnum, or register_bytes. (D10V_PC_REGNUM): Rename _PC_REGNUM. (d10v_register_type): Use D10V_PC_REGNUM. (d10v_print_registers_info, d10v_read_pc): Ditto. (d10v_write_pc, d10v_eva_prepare_to_trace): Ditto. (d10v_unwind_pc, d10v_frame_prev_register): Ditto. --- gdb/ChangeLog | 12 ++++++++++++ gdb/d10v-tdep.c | 20 ++++++++------------ gdb/gdbarch.c | 14 -------------- gdb/gdbarch.h | 8 ++------ gdb/gdbarch.sh | 4 ++-- 5 files changed, 24 insertions(+), 34 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 89143753f2..d861069962 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,15 @@ +2003-05-02 Andrew Cagney + + * gdbarch.sh (REGISTER_SIZE, REGISTER_BYTES): Make optional. + * gdbarch.h, gdbarch.c: Re-generate. + * d10v-tdep.c (d10v_gdbarch_init): Do not set register_size, + register_virtual_size, pc_regnum, or register_bytes. + (D10V_PC_REGNUM): Rename _PC_REGNUM. + (d10v_register_type): Use D10V_PC_REGNUM. + (d10v_print_registers_info, d10v_read_pc): Ditto. + (d10v_write_pc, d10v_eva_prepare_to_trace): Ditto. + (d10v_unwind_pc, d10v_frame_prev_register): Ditto. + 2003-05-02 David Carlton * objfiles.c (allocate_objfile): For anonymous objfiles, allocate diff --git a/gdb/d10v-tdep.c b/gdb/d10v-tdep.c index 8eb9d6ffa3..5f054d5c32 100644 --- a/gdb/d10v-tdep.c +++ b/gdb/d10v-tdep.c @@ -73,7 +73,7 @@ enum LR_REGNUM = 13, D10V_SP_REGNUM = 15, PSW_REGNUM = 16, - _PC_REGNUM = 18, + D10V_PC_REGNUM = 18, NR_IMAP_REGS = 2, NR_A_REGS = 2, TS2_NUM_REGS = 37, @@ -322,7 +322,7 @@ d10v_ts3_register_sim_regno (int nr) static struct type * d10v_register_type (struct gdbarch *gdbarch, int reg_nr) { - if (reg_nr == PC_REGNUM) + if (reg_nr == D10V_PC_REGNUM) return builtin_type_void_func_ptr; if (reg_nr == D10V_SP_REGNUM || reg_nr == D10V_FP_REGNUM) return builtin_type_void_data_ptr; @@ -811,7 +811,7 @@ d10v_print_registers_info (struct gdbarch *gdbarch, struct ui_file *file, { ULONGEST pc, psw, rpt_s, rpt_e, rpt_c; - frame_read_unsigned_register (frame, PC_REGNUM, &pc); + frame_read_unsigned_register (frame, D10V_PC_REGNUM, &pc); frame_read_unsigned_register (frame, PSW_REGNUM, &psw); frame_read_unsigned_register (frame, frame_map_name_to_regnum ("rpt_s", -1), &rpt_s); frame_read_unsigned_register (frame, frame_map_name_to_regnum ("rpt_e", -1), &rpt_e); @@ -895,7 +895,7 @@ d10v_read_pc (ptid_t ptid) save_ptid = inferior_ptid; inferior_ptid = ptid; - pc = (int) read_register (PC_REGNUM); + pc = (int) read_register (D10V_PC_REGNUM); inferior_ptid = save_ptid; retval = d10v_make_iaddr (pc); return retval; @@ -908,7 +908,7 @@ d10v_write_pc (CORE_ADDR val, ptid_t ptid) save_ptid = inferior_ptid; inferior_ptid = ptid; - write_register (PC_REGNUM, d10v_convert_iaddr_to_raw (val)); + write_register (D10V_PC_REGNUM, d10v_convert_iaddr_to_raw (val)); inferior_ptid = save_ptid; } @@ -1207,7 +1207,7 @@ d10v_eva_prepare_to_trace (void) if (!tracing) return; - last_pc = read_register (PC_REGNUM); + last_pc = read_register (D10V_PC_REGNUM); } /* Collect trace data from the target board and format it into a form @@ -1373,7 +1373,7 @@ static CORE_ADDR d10v_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame) { ULONGEST pc; - frame_unwind_unsigned_register (next_frame, PC_REGNUM, &pc); + frame_unwind_unsigned_register (next_frame, D10V_PC_REGNUM, &pc); return d10v_make_iaddr (pc); } @@ -1477,7 +1477,7 @@ d10v_frame_prev_register (struct frame_info *next_frame, { struct d10v_unwind_cache *info = d10v_frame_unwind_cache (next_frame, this_prologue_cache); - if (regnum == PC_REGNUM) + if (regnum == D10V_PC_REGNUM) { /* The call instruction saves the caller's PC in LR. The function prologue of the callee may then save the LR on the @@ -1582,11 +1582,7 @@ d10v_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_num_regs (gdbarch, d10v_num_regs); set_gdbarch_sp_regnum (gdbarch, D10V_SP_REGNUM); - set_gdbarch_pc_regnum (gdbarch, 18); set_gdbarch_register_name (gdbarch, d10v_register_name); - set_gdbarch_register_size (gdbarch, 2); - set_gdbarch_register_bytes (gdbarch, (d10v_num_regs - 2) * 2 + 16); - set_gdbarch_register_virtual_size (gdbarch, generic_register_size); set_gdbarch_register_type (gdbarch, d10v_register_type); set_gdbarch_ptr_bit (gdbarch, 2 * TARGET_CHAR_BIT); diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index bda28c7d37..6ed7d86cae 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -514,8 +514,6 @@ gdbarch_alloc (const struct gdbarch_info *info, current_gdbarch->sdb_reg_to_regnum = no_op_reg_to_regnum; current_gdbarch->dwarf2_reg_to_regnum = no_op_reg_to_regnum; current_gdbarch->register_name = legacy_register_name; - current_gdbarch->register_size = -1; - current_gdbarch->register_bytes = -1; current_gdbarch->register_byte = generic_register_byte; current_gdbarch->register_raw_size = generic_register_size; current_gdbarch->register_virtual_size = generic_register_size; @@ -643,12 +641,6 @@ verify_gdbarch (struct gdbarch *gdbarch) /* Skip verify of sdb_reg_to_regnum, invalid_p == 0 */ /* Skip verify of dwarf2_reg_to_regnum, invalid_p == 0 */ /* Skip verify of register_name, invalid_p == 0 */ - if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) - && (gdbarch->register_size == -1)) - fprintf_unfiltered (log, "\n\tregister_size"); - if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) - && (gdbarch->register_bytes == -1)) - fprintf_unfiltered (log, "\n\tregister_bytes"); /* Skip verify of register_byte, invalid_p == 0 */ /* Skip verify of register_raw_size, invalid_p == 0 */ /* Skip verify of deprecated_max_register_raw_size, has predicate */ @@ -3286,9 +3278,6 @@ int gdbarch_register_size (struct gdbarch *gdbarch) { gdb_assert (gdbarch != NULL); - if (gdbarch->register_size == -1) - internal_error (__FILE__, __LINE__, - "gdbarch: gdbarch_register_size invalid"); if (gdbarch_debug >= 2) fprintf_unfiltered (gdb_stdlog, "gdbarch_register_size called\n"); return gdbarch->register_size; @@ -3305,9 +3294,6 @@ int gdbarch_register_bytes (struct gdbarch *gdbarch) { gdb_assert (gdbarch != NULL); - if (gdbarch->register_bytes == -1) - internal_error (__FILE__, __LINE__, - "gdbarch: gdbarch_register_bytes invalid"); if (gdbarch_debug >= 2) fprintf_unfiltered (gdb_stdlog, "gdbarch_register_bytes called\n"); return gdbarch->register_bytes; diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index f95e70936b..f781cc94b8 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -726,22 +726,18 @@ extern void set_gdbarch_register_size (struct gdbarch *gdbarch, int register_siz #if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (REGISTER_SIZE) #error "Non multi-arch definition of REGISTER_SIZE" #endif -#if GDB_MULTI_ARCH -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (REGISTER_SIZE) +#if !defined (REGISTER_SIZE) #define REGISTER_SIZE (gdbarch_register_size (current_gdbarch)) #endif -#endif extern int gdbarch_register_bytes (struct gdbarch *gdbarch); extern void set_gdbarch_register_bytes (struct gdbarch *gdbarch, int register_bytes); #if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (REGISTER_BYTES) #error "Non multi-arch definition of REGISTER_BYTES" #endif -#if GDB_MULTI_ARCH -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (REGISTER_BYTES) +#if !defined (REGISTER_BYTES) #define REGISTER_BYTES (gdbarch_register_bytes (current_gdbarch)) #endif -#endif /* Default (function) for non- multi-arch platforms. */ #if (!GDB_MULTI_ARCH) && !defined (REGISTER_BYTE) diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index 9b059d2f54..193d52a204 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -472,8 +472,8 @@ f:2:DWARF_REG_TO_REGNUM:int:dwarf_reg_to_regnum:int dwarf_regnr:dwarf_regnr:::no f:2:SDB_REG_TO_REGNUM:int:sdb_reg_to_regnum:int sdb_regnr:sdb_regnr:::no_op_reg_to_regnum::0 f:2:DWARF2_REG_TO_REGNUM:int:dwarf2_reg_to_regnum:int dwarf2_regnr:dwarf2_regnr:::no_op_reg_to_regnum::0 f:2:REGISTER_NAME:const char *:register_name:int regnr:regnr:::legacy_register_name::0 -v:2:REGISTER_SIZE:int:register_size::::0:-1 -v:2:REGISTER_BYTES:int:register_bytes::::0:-1 +v::REGISTER_SIZE:int:register_size +v::REGISTER_BYTES:int:register_bytes f:2:REGISTER_BYTE:int:register_byte:int reg_nr:reg_nr::generic_register_byte:generic_register_byte::0 # The methods REGISTER_VIRTUAL_TYPE, MAX_REGISTER_RAW_SIZE, # MAX_REGISTER_VIRTUAL_SIZE, MAX_REGISTER_RAW_SIZE,