+/* A default frame sniffer which always accepts the frame. Used by
+ fallback prologue unwinders. */
+
+int
+default_frame_sniffer (const struct frame_unwind *self,
+ struct frame_info *this_frame,
+ void **this_prologue_cache)
+{
+ return 1;
+}
+
+/* The default frame unwinder stop_reason callback. */
+
+enum unwind_stop_reason
+default_frame_unwind_stop_reason (struct frame_info *this_frame,
+ void **this_cache)
+{
+ struct frame_id this_id = get_frame_id (this_frame);
+
+ if (frame_id_eq (this_id, outer_frame_id))
+ return UNWIND_OUTERMOST;
+ else
+ return UNWIND_NO_REASON;
+}
+
+/* See frame-unwind.h. */
+
+CORE_ADDR
+default_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
+{
+ int pc_regnum = gdbarch_pc_regnum (gdbarch);
+ CORE_ADDR pc = frame_unwind_register_unsigned (next_frame, pc_regnum);
+ pc = gdbarch_addr_bits_remove (gdbarch, pc);
+ return pc;
+}
+
+/* See frame-unwind.h. */
+
+CORE_ADDR
+default_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
+{
+ int sp_regnum = gdbarch_sp_regnum (gdbarch);
+ return frame_unwind_register_unsigned (next_frame, sp_regnum);
+}
+
+/* Helper functions for value-based register unwinding. These return
+ a (possibly lazy) value of the appropriate type. */
+
+/* Return a value which indicates that FRAME did not save REGNUM. */
+
+struct value *
+frame_unwind_got_optimized (struct frame_info *frame, int regnum)
+{
+ struct gdbarch *gdbarch = frame_unwind_arch (frame);
+ struct type *type = register_type (gdbarch, regnum);
+ struct value *val;
+
+ /* Return an lval_register value, so that we print it as
+ "<not saved>". */
+ val = allocate_value_lazy (type);
+ set_value_lazy (val, 0);
+ mark_value_bytes_optimized_out (val, 0, TYPE_LENGTH (type));
+ VALUE_LVAL (val) = lval_register;
+ VALUE_REGNUM (val) = regnum;
+ VALUE_NEXT_FRAME_ID (val)
+ = get_frame_id (get_next_frame_sentinel_okay (frame));
+ return val;
+}
+
+/* Return a value which indicates that FRAME copied REGNUM into
+ register NEW_REGNUM. */
+
+struct value *
+frame_unwind_got_register (struct frame_info *frame,
+ int regnum, int new_regnum)
+{
+ return value_of_register_lazy (frame, new_regnum);
+}
+
+/* Return a value which indicates that FRAME saved REGNUM in memory at
+ ADDR. */
+
+struct value *
+frame_unwind_got_memory (struct frame_info *frame, int regnum, CORE_ADDR addr)
+{
+ struct gdbarch *gdbarch = frame_unwind_arch (frame);
+ struct value *v = value_at_lazy (register_type (gdbarch, regnum), addr);
+
+ set_value_stack (v, 1);
+ return v;
+}
+
+/* Return a value which indicates that FRAME's saved version of
+ REGNUM has a known constant (computed) value of VAL. */
+
+struct value *
+frame_unwind_got_constant (struct frame_info *frame, int regnum,
+ ULONGEST val)
+{
+ struct gdbarch *gdbarch = frame_unwind_arch (frame);
+ enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
+ struct value *reg_val;
+
+ reg_val = value_zero (register_type (gdbarch, regnum), not_lval);
+ store_unsigned_integer (value_contents_writeable (reg_val),
+ register_size (gdbarch, regnum), byte_order, val);
+ return reg_val;
+}
+
+struct value *
+frame_unwind_got_bytes (struct frame_info *frame, int regnum, gdb_byte *buf)
+{
+ struct gdbarch *gdbarch = frame_unwind_arch (frame);
+ struct value *reg_val;
+
+ reg_val = value_zero (register_type (gdbarch, regnum), not_lval);
+ memcpy (value_contents_raw (reg_val), buf, register_size (gdbarch, regnum));
+ return reg_val;
+}
+
+/* Return a value which indicates that FRAME's saved version of REGNUM
+ has a known constant (computed) value of ADDR. Convert the
+ CORE_ADDR to a target address if necessary. */
+
+struct value *
+frame_unwind_got_address (struct frame_info *frame, int regnum,
+ CORE_ADDR addr)
+{
+ struct gdbarch *gdbarch = frame_unwind_arch (frame);
+ struct value *reg_val;
+
+ reg_val = value_zero (register_type (gdbarch, regnum), not_lval);
+ pack_long (value_contents_writeable (reg_val),
+ register_type (gdbarch, regnum), addr);
+ return reg_val;
+}