From 30244cd87c0b05f16c0919b0a5ab12c821f49bed Mon Sep 17 00:00:00 2001 From: Ulrich Weigand Date: Mon, 14 May 2007 15:17:00 +0000 Subject: [PATCH] * gdbarch.sh (read_sp): Remove. * gdbarch.c, gdbarch.h: Regenerate. * frame.c (frame_sp_unwind): Do not call TARGET_READ_SP. * avr-tdep.c (avr_read_sp): Remove. (avr_unwind_sp): New function. (avr_gdbarch_init): Install unwind_sp instead of read_sp callback. * mips-tdep.c (mips_read_sp): Remove. (mips_unwind_sp): New function. (mips_gdbarch_init): Install unwind_sp instead of read_sp callback. * score-tdep.c (score_read_unsigned_register): Remove. (score_read_sp): Remove. (score_unwind_sp): New function. (score_gdbarch_init): Install unwind_sp instead of read_sp callback. --- gdb/ChangeLog | 17 +++++++++++++++++ gdb/avr-tdep.c | 21 +++++++++++---------- gdb/frame.c | 4 ---- gdb/gdbarch.c | 45 --------------------------------------------- gdb/gdbarch.h | 27 --------------------------- gdb/gdbarch.sh | 2 -- gdb/mips-tdep.c | 15 +++++++-------- gdb/score-tdep.c | 18 +++++------------- 8 files changed, 40 insertions(+), 109 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index af1cb80f7b6..2861743fdde 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,20 @@ +2007-05-14 Ulrich Weigand + + * gdbarch.sh (read_sp): Remove. + * gdbarch.c, gdbarch.h: Regenerate. + * frame.c (frame_sp_unwind): Do not call TARGET_READ_SP. + + * avr-tdep.c (avr_read_sp): Remove. + (avr_unwind_sp): New function. + (avr_gdbarch_init): Install unwind_sp instead of read_sp callback. + * mips-tdep.c (mips_read_sp): Remove. + (mips_unwind_sp): New function. + (mips_gdbarch_init): Install unwind_sp instead of read_sp callback. + * score-tdep.c (score_read_unsigned_register): Remove. + (score_read_sp): Remove. + (score_unwind_sp): New function. + (score_gdbarch_init): Install unwind_sp instead of read_sp callback. + 2007-05-14 Maxim Grigoriev * buildsym.c (start_subfile): Handle absolute pathnames diff --git a/gdb/avr-tdep.c b/gdb/avr-tdep.c index 9f0793e2fbc..d07245942e3 100644 --- a/gdb/avr-tdep.c +++ b/gdb/avr-tdep.c @@ -337,15 +337,6 @@ avr_write_pc (CORE_ADDR val, ptid_t ptid) inferior_ptid = save_ptid; } -static CORE_ADDR -avr_read_sp (void) -{ - ULONGEST sp; - - regcache_cooked_read_unsigned (current_regcache, AVR_SP_REGNUM, &sp); - return (avr_make_saddr (sp)); -} - static int avr_scan_arg_moves (int vpc, unsigned char *prologue) { @@ -943,6 +934,16 @@ avr_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame) return avr_make_iaddr (pc); } +static CORE_ADDR +avr_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame) +{ + ULONGEST sp; + + frame_unwind_unsigned_register (next_frame, AVR_SP_REGNUM, &sp); + + return avr_make_saddr (sp); +} + /* Given a GDB frame, determine the address of the calling function's frame. This will be used to create a new GDB frame struct. */ @@ -1274,7 +1275,6 @@ avr_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_read_pc (gdbarch, avr_read_pc); set_gdbarch_write_pc (gdbarch, avr_write_pc); - set_gdbarch_read_sp (gdbarch, avr_read_sp); set_gdbarch_num_regs (gdbarch, AVR_NUM_REGS); @@ -1303,6 +1303,7 @@ avr_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_unwind_dummy_id (gdbarch, avr_unwind_dummy_id); set_gdbarch_unwind_pc (gdbarch, avr_unwind_pc); + set_gdbarch_unwind_sp (gdbarch, avr_unwind_sp); return gdbarch; } diff --git a/gdb/frame.c b/gdb/frame.c index 2c62d441a6b..d066a49b738 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -1712,10 +1712,6 @@ frame_sp_unwind (struct frame_info *next_frame) frame inner-most address. */ if (gdbarch_unwind_sp_p (current_gdbarch)) return gdbarch_unwind_sp (current_gdbarch, next_frame); - /* Things are looking grim. If it's the inner-most frame and there - is a TARGET_READ_SP, then that can be used. */ - if (next_frame->level < 0 && TARGET_READ_SP_P ()) - return TARGET_READ_SP (); /* Now things are really are grim. Hope that the value returned by the SP_REGNUM register is meaningful. */ if (SP_REGNUM >= 0) diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index 8c19f9150c7..154aa4a8a84 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -148,7 +148,6 @@ struct gdbarch int char_signed; gdbarch_read_pc_ftype *read_pc; gdbarch_write_pc_ftype *write_pc; - gdbarch_read_sp_ftype *read_sp; gdbarch_virtual_frame_pointer_ftype *virtual_frame_pointer; gdbarch_pseudo_register_read_ftype *pseudo_register_read; gdbarch_pseudo_register_write_ftype *pseudo_register_write; @@ -275,7 +274,6 @@ struct gdbarch startup_gdbarch = 1, /* char_signed */ 0, /* read_pc */ 0, /* write_pc */ - 0, /* read_sp */ 0, /* virtual_frame_pointer */ 0, /* pseudo_register_read */ 0, /* pseudo_register_write */ @@ -531,7 +529,6 @@ verify_gdbarch (struct gdbarch *current_gdbarch) current_gdbarch->char_signed = 1; /* Skip verify of read_pc, has predicate */ /* Skip verify of write_pc, invalid_p == 0 */ - /* Skip verify of read_sp, has predicate */ /* Skip verify of virtual_frame_pointer, invalid_p == 0 */ /* Skip verify of pseudo_register_read, has predicate */ /* Skip verify of pseudo_register_write, has predicate */ @@ -1332,24 +1329,6 @@ gdbarch_dump (struct gdbarch *current_gdbarch, struct ui_file *file) fprintf_unfiltered (file, "gdbarch_dump: read_pc = <0x%lx>\n", (long) current_gdbarch->read_pc); -#ifdef TARGET_READ_SP_P - fprintf_unfiltered (file, - "gdbarch_dump: %s # %s\n", - "TARGET_READ_SP_P()", - XSTRING (TARGET_READ_SP_P ())); -#endif - fprintf_unfiltered (file, - "gdbarch_dump: gdbarch_read_sp_p() = %d\n", - gdbarch_read_sp_p (current_gdbarch)); -#ifdef TARGET_READ_SP - fprintf_unfiltered (file, - "gdbarch_dump: %s # %s\n", - "TARGET_READ_SP()", - XSTRING (TARGET_READ_SP ())); -#endif - fprintf_unfiltered (file, - "gdbarch_dump: read_sp = <0x%lx>\n", - (long) current_gdbarch->read_sp); #ifdef REGISTER_BYTES_OK_P fprintf_unfiltered (file, "gdbarch_dump: %s # %s\n", @@ -1909,30 +1888,6 @@ set_gdbarch_write_pc (struct gdbarch *gdbarch, gdbarch->write_pc = write_pc; } -int -gdbarch_read_sp_p (struct gdbarch *gdbarch) -{ - gdb_assert (gdbarch != NULL); - return gdbarch->read_sp != NULL; -} - -CORE_ADDR -gdbarch_read_sp (struct gdbarch *gdbarch) -{ - gdb_assert (gdbarch != NULL); - gdb_assert (gdbarch->read_sp != NULL); - if (gdbarch_debug >= 2) - fprintf_unfiltered (gdb_stdlog, "gdbarch_read_sp called\n"); - return gdbarch->read_sp (); -} - -void -set_gdbarch_read_sp (struct gdbarch *gdbarch, - gdbarch_read_sp_ftype read_sp) -{ - gdbarch->read_sp = read_sp; -} - void gdbarch_virtual_frame_pointer (struct gdbarch *gdbarch, CORE_ADDR pc, int *frame_regnum, LONGEST *frame_offset) { diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index 7efcabc2cf7..02557bb44a9 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -287,33 +287,6 @@ extern void set_gdbarch_write_pc (struct gdbarch *gdbarch, gdbarch_write_pc_ftyp #define TARGET_WRITE_PC(val, ptid) (gdbarch_write_pc (current_gdbarch, val, ptid)) #endif -/* UNWIND_SP is a direct replacement for TARGET_READ_SP. */ - -#if defined (TARGET_READ_SP) -/* Legacy for systems yet to multi-arch TARGET_READ_SP */ -#if !defined (TARGET_READ_SP_P) -#define TARGET_READ_SP_P() (1) -#endif -#endif - -extern int gdbarch_read_sp_p (struct gdbarch *gdbarch); -#if !defined (GDB_TM_FILE) && defined (TARGET_READ_SP_P) -#error "Non multi-arch definition of TARGET_READ_SP" -#endif -#if !defined (TARGET_READ_SP_P) -#define TARGET_READ_SP_P() (gdbarch_read_sp_p (current_gdbarch)) -#endif - -typedef CORE_ADDR (gdbarch_read_sp_ftype) (void); -extern CORE_ADDR gdbarch_read_sp (struct gdbarch *gdbarch); -extern void set_gdbarch_read_sp (struct gdbarch *gdbarch, gdbarch_read_sp_ftype *read_sp); -#if !defined (GDB_TM_FILE) && defined (TARGET_READ_SP) -#error "Non multi-arch definition of TARGET_READ_SP" -#endif -#if !defined (TARGET_READ_SP) -#define TARGET_READ_SP() (gdbarch_read_sp (current_gdbarch)) -#endif - /* Function for getting target's idea of a frame pointer. FIXME: GDB's whole scheme for dealing with "frames" and "frame pointers" needs a serious shakedown. */ diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index b7720443c66..b865c570c55 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -421,8 +421,6 @@ v:TARGET_CHAR_SIGNED:int:char_signed:::1:-1:1 # F:TARGET_READ_PC:CORE_ADDR:read_pc:ptid_t ptid:ptid f:TARGET_WRITE_PC:void:write_pc:CORE_ADDR val, ptid_t ptid:val, ptid:0:generic_target_write_pc::0 -# UNWIND_SP is a direct replacement for TARGET_READ_SP. -F:TARGET_READ_SP:CORE_ADDR:read_sp:void # Function for getting target's idea of a frame pointer. FIXME: GDB's # whole scheme for dealing with "frames" and "frame pointers" needs a # serious shakedown. diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index a291aa523a0..759c21f8e16 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -746,13 +746,6 @@ mips_register_type (struct gdbarch *gdbarch, int regnum) } } -/* TARGET_READ_SP -- Remove useless bits from the stack pointer. */ - -static CORE_ADDR -mips_read_sp (void) -{ - return read_signed_register (MIPS_SP_REGNUM); -} /* Should the upper word of 64-bit addresses be zeroed? */ enum auto_boolean mask_address_var = AUTO_BOOLEAN_AUTO; @@ -838,6 +831,12 @@ mips_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame) NUM_REGS + mips_regnum (gdbarch)->pc); } +static CORE_ADDR +mips_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame) +{ + return frame_unwind_register_signed (next_frame, NUM_REGS + MIPS_SP_REGNUM); +} + /* Assuming NEXT_FRAME->prev is a dummy, return the frame ID of that dummy frame. The frame ID's base needs to match the TOS value saved by save_dummy_frame_tos(), and the PC match the dummy frame's @@ -5104,7 +5103,6 @@ mips_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_read_pc (gdbarch, mips_read_pc); set_gdbarch_write_pc (gdbarch, mips_write_pc); - set_gdbarch_read_sp (gdbarch, mips_read_sp); /* Add/remove bits from an address. The MIPS needs be careful to ensure that all 32 bit addresses are sign extended to 64 bits. */ @@ -5112,6 +5110,7 @@ mips_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* Unwind the frame. */ set_gdbarch_unwind_pc (gdbarch, mips_unwind_pc); + set_gdbarch_unwind_sp (gdbarch, mips_unwind_sp); set_gdbarch_unwind_dummy_id (gdbarch, mips_unwind_dummy_id); /* Map debug register numbers onto internal register numbers. */ diff --git a/gdb/score-tdep.c b/gdb/score-tdep.c index d739333a70e..aeb8fdcc7ec 100644 --- a/gdb/score-tdep.c +++ b/gdb/score-tdep.c @@ -190,24 +190,16 @@ score_register_type (struct gdbarch *gdbarch, int regnum) return builtin_type_uint32; } -static LONGEST -score_read_unsigned_register (int regnum) -{ - LONGEST val; - regcache_cooked_read_unsigned (current_regcache, regnum, &val); - return val; -} - static CORE_ADDR -score_read_sp (void) +score_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame) { - return score_read_unsigned_register (SCORE_SP_REGNUM); + return frame_unwind_register_unsigned (next_frame, SCORE_PC_REGNUM); } static CORE_ADDR -score_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame) +score_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame) { - return frame_unwind_register_unsigned (next_frame, SCORE_PC_REGNUM); + return frame_unwind_register_unsigned (next_frame, SCORE_SP_REGNUM); } static const char * @@ -880,8 +872,8 @@ score_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_register_type (gdbarch, score_register_type); set_gdbarch_frame_align (gdbarch, score_frame_align); set_gdbarch_inner_than (gdbarch, core_addr_lessthan); - set_gdbarch_read_sp (gdbarch, score_read_sp); set_gdbarch_unwind_pc (gdbarch, score_unwind_pc); + set_gdbarch_unwind_sp (gdbarch, score_unwind_sp); set_gdbarch_print_insn (gdbarch, score_print_insn); set_gdbarch_skip_prologue (gdbarch, score_skip_prologue); set_gdbarch_in_function_epilogue_p (gdbarch, score_in_function_epilogue_p); -- 2.30.2