+2003-06-13 Andrew Cagney <cagney@redhat.com>
+
+ * infcall.c (call_function_by_hand): When UNWIND_DUMMY_ID is
+ available, do not use the FP register, and always save the TOS.
+ * dummy-frame.c (dummy_frame_this_id): Do not assert
+ SAVE_DUMMY_FRAME_TOS.
+ * i386-tdep.c (i386_save_dummy_frame_tos): Delete function.
+ (i386_gdbarch_init): Do not set save_dummy_frame_tos.
+ (i386_push_dummy_call): Add 8 to the returned SP.
+ * frame.c (legacy_frame_p): Do not require SAVE_DUMMY_FRAME_TOS.
+ * d10v-tdep.c (d10v_unwind_dummy_id): Use d10v_unwind_sp.
+ (d10v_gdbarch_init): Do not set save_dummy_frame_tos.
+ * x86-64-tdep.c (x86_64_save_dummy_frame_tos): Delete function.
+ (x86_64_push_dummy_call): Return "sp + 16".
+ (x86_64_init_abi): Do not set save_dummy_frame_tos.
+ * alpha-tdep.c (alpha_gdbarch_init): Do not set
+ save_dummy_frame_tos.
+
2003-06-13 Jim Blandy <jimb@redhat.com>
* frv-tdep.c (frv_use_struct_convention): Delete static
/* Methods for saving / extracting a dummy frame's ID. */
set_gdbarch_unwind_dummy_id (gdbarch, alpha_unwind_dummy_id);
- set_gdbarch_save_dummy_frame_tos (gdbarch, generic_save_dummy_frame_tos);
/* Return the unwound PC value. */
set_gdbarch_unwind_pc (gdbarch, alpha_unwind_pc);
static struct frame_id
d10v_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *next_frame)
{
- ULONGEST base;
- frame_unwind_unsigned_register (next_frame, D10V_SP_REGNUM, &base);
- return frame_id_build (d10v_make_daddr (base), frame_pc_unwind (next_frame));
+ return frame_id_build (d10v_unwind_sp (gdbarch, next_frame),
+ frame_pc_unwind (next_frame));
}
static gdbarch_init_ftype d10v_gdbarch_init;
frame_unwind_append_predicate (gdbarch, d10v_frame_p);
frame_base_set_default (gdbarch, &d10v_frame_base);
- /* Methods for saving / extracting a dummy frame's ID. */
+ /* Methods for saving / extracting a dummy frame's ID. The ID's
+ stack address must match the SP value returned by
+ PUSH_DUMMY_CALL, and saved by generic_save_dummy_frame_tos. */
set_gdbarch_unwind_dummy_id (gdbarch, d10v_unwind_dummy_id);
- set_gdbarch_save_dummy_frame_tos (gdbarch, generic_save_dummy_frame_tos);
/* Return the unwound PC value. */
set_gdbarch_unwind_pc (gdbarch, d10v_unwind_pc);
just asking for trouble. */
if (gdbarch_unwind_dummy_id_p (current_gdbarch))
{
- /* Assume call_function_by_hand(), via SAVE_DUMMY_FRAME_TOS,
- previously saved the dummy frame's ID. Things only work if
- the two return the same value. */
- gdb_assert (SAVE_DUMMY_FRAME_TOS_P ());
/* Use an architecture specific method to extract the prev's
dummy ID from the next frame. Note that this method uses
frame_register_unwind to obtain the register values needed to
|| DEPRECATED_INIT_FRAME_PC_FIRST_P ()
|| DEPRECATED_INIT_EXTRA_FRAME_INFO_P ()
|| DEPRECATED_FRAME_CHAIN_P ()
- || !gdbarch_unwind_dummy_id_p (current_gdbarch)
- || !SAVE_DUMMY_FRAME_TOS_P ());
+ || !gdbarch_unwind_dummy_id_p (current_gdbarch));
}
extern initialize_file_ftype _initialize_frame; /* -Wmissing-prototypes */
if (cache->base == 0)
return;
+ /* See the end of i386_push_dummy_call. */
(*this_id) = frame_id_build (cache->base + 8, cache->pc);
}
struct i386_frame_cache *cache =
i386_sigtramp_frame_cache (next_frame, this_cache);
+ /* See the end of i386_push_dummy_call. */
(*this_id) = frame_id_build (cache->base + 8, frame_pc_unwind (next_frame));
}
i386_frame_base_address
};
-static void
-i386_save_dummy_frame_tos (CORE_ADDR sp)
-{
- generic_save_dummy_frame_tos (sp + 8);
-}
-
static struct frame_id
i386_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *next_frame)
{
frame_unwind_register (next_frame, I386_EBP_REGNUM, buf);
fp = extract_unsigned_integer (buf, 4);
+ /* See the end of i386_push_dummy_call. */
return frame_id_build (fp + 8, frame_pc_unwind (next_frame));
}
\f
/* ...and fake a frame pointer. */
regcache_cooked_write (regcache, I386_EBP_REGNUM, buf);
- return sp;
+ /* MarkK wrote: This "+ 8" is all over the place:
+ (i386_frame_this_id, i386_sigtramp_frame_this_id,
+ i386_unwind_dummy_id). It's there, since all frame unwinders for
+ a given target have to agree (within a certain margin) on the
+ defenition of the stack address of a frame. Otherwise
+ frame_id_inner() won't work correctly. Since DWARF2/GCC uses the
+ stack address *before* the function call as a frame's CFA. On
+ the i386, when %ebp is used as a frame pointer, the offset
+ between the contents %ebp and the CFA as defined by GCC. */
+ return sp + 8;
}
/* These registers are used for returning integers (and on some
set_gdbarch_print_insn (gdbarch, i386_print_insn);
set_gdbarch_unwind_dummy_id (gdbarch, i386_unwind_dummy_id);
- set_gdbarch_save_dummy_frame_tos (gdbarch, i386_save_dummy_frame_tos);
set_gdbarch_unwind_pc (gdbarch, i386_unwind_pc);
if (DEPRECATED_DUMMY_WRITE_SP_P ())
DEPRECATED_DUMMY_WRITE_SP (sp);
- if (SAVE_DUMMY_FRAME_TOS_P ())
+ if (gdbarch_unwind_dummy_id_p (current_gdbarch))
+ {
+ /* Sanity. The exact same SP value is returned by
+ PUSH_DUMMY_CALL, saved as the dummy-frame TOS, and used by
+ unwind_dummy_id to form the frame ID's stack address. */
+ gdb_assert (DEPRECATED_USE_GENERIC_DUMMY_FRAMES);
+ generic_save_dummy_frame_tos (sp);
+ }
+ else if (SAVE_DUMMY_FRAME_TOS_P ())
SAVE_DUMMY_FRAME_TOS (sp);
/* Now proceed, having reached the desired place. */
set_momentary_breakpoint. We need to give the breakpoint a
frame ID so that the breakpoint code can correctly re-identify
the dummy breakpoint. */
- /* The assumption here is that push_dummy_call() returned the
- stack part of the frame ID. Unfortunatly, many older
- architectures were, via a convoluted mess, relying on the
- poorly defined and greatly overloaded DEPRECATED_TARGET_READ_FP
- or DEPRECATED_FP_REGNUM to supply the value. */
- if (DEPRECATED_TARGET_READ_FP_P ())
- frame = frame_id_build (DEPRECATED_TARGET_READ_FP (), sal.pc);
- else if (DEPRECATED_FP_REGNUM >= 0)
- frame = frame_id_build (read_register (DEPRECATED_FP_REGNUM), sal.pc);
+ if (gdbarch_unwind_dummy_id_p (current_gdbarch))
+ {
+ /* Sanity. The exact same SP value is returned by
+ PUSH_DUMMY_CALL, saved as the dummy-frame TOS, and used by
+ unwind_dummy_id to form the frame ID's stack address. */
+ gdb_assert (DEPRECATED_USE_GENERIC_DUMMY_FRAMES);
+ frame = frame_id_build (sp, sal.pc);
+ }
else
- frame = frame_id_build (sp, sal.pc);
+ {
+ /* The assumption here is that push_dummy_call() returned the
+ stack part of the frame ID. Unfortunatly, many older
+ architectures were, via a convoluted mess, relying on the
+ poorly defined and greatly overloaded
+ DEPRECATED_TARGET_READ_FP or DEPRECATED_FP_REGNUM to supply
+ the value. */
+ if (DEPRECATED_TARGET_READ_FP_P ())
+ frame = frame_id_build (DEPRECATED_TARGET_READ_FP (), sal.pc);
+ else if (DEPRECATED_FP_REGNUM >= 0)
+ frame = frame_id_build (read_register (DEPRECATED_FP_REGNUM), sal.pc);
+ else
+ frame = frame_id_build (sp, sal.pc);
+ }
bpt = set_momentary_breakpoint (sal, frame, bp_call_dummy);
bpt->disposition = disp_del;
}
/* ...and fake a frame pointer. */
regcache_cooked_write (regcache, X86_64_RBP_REGNUM, buf);
- return sp;
+ return sp + 16;
}
\f
x86_64_frame_base_address
};
-static void
-x86_64_save_dummy_frame_tos (CORE_ADDR sp)
-{
- generic_save_dummy_frame_tos (sp + 16);
-}
-
static struct frame_id
x86_64_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *next_frame)
{
set_gdbarch_num_pseudo_regs (gdbarch, 0);
set_gdbarch_unwind_dummy_id (gdbarch, x86_64_unwind_dummy_id);
- set_gdbarch_save_dummy_frame_tos (gdbarch, x86_64_save_dummy_frame_tos);
/* FIXME: kettenis/20021026: This is ELF-specific. Fine for now,
since all supported x86-64 targets are ELF, but that might change