* 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 Ulrich Weigand <uweigand@de.ibm.com>
+
+ * 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 <maxim2405@gmail.com>
* buildsym.c (start_subfile): Handle absolute pathnames
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)
{
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. */
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);
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;
}
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)
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;
1, /* char_signed */
0, /* read_pc */
0, /* write_pc */
- 0, /* read_sp */
0, /* virtual_frame_pointer */
0, /* pseudo_register_read */
0, /* pseudo_register_write */
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 */
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",
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)
{
#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. */
#
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.
}
}
-/* 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;
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
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. */
/* 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. */
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 *
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);