summaryrefslogtreecommitdiff
path: root/gdb/i386-tdep.c
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2003-06-13 20:37:28 +0000
committerAndrew Cagney <cagney@redhat.com>2003-06-13 20:37:28 +0000
commit581bb087ee5ee07c89061a6425fa43ea8a84bbf9 (patch)
treecce7ecad1f0d77082b551f27cbce787c67083057 /gdb/i386-tdep.c
parentf31d5b87bbc9490afda97596e951f5c53d6f9cbe (diff)
downloadgdb-581bb087ee5ee07c89061a6425fa43ea8a84bbf9.tar.gz
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.
Diffstat (limited to 'gdb/i386-tdep.c')
-rw-r--r--gdb/i386-tdep.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index 80f69e09d79..467f686a123 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -751,6 +751,7 @@ i386_frame_this_id (struct frame_info *next_frame, void **this_cache,
if (cache->base == 0)
return;
+ /* See the end of i386_push_dummy_call. */
(*this_id) = frame_id_build (cache->base + 8, cache->pc);
}
@@ -902,6 +903,7 @@ i386_sigtramp_frame_this_id (struct frame_info *next_frame, void **this_cache,
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));
}
@@ -960,12 +962,6 @@ static const struct frame_base i386_frame_base =
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)
{
@@ -975,6 +971,7 @@ 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));
}
@@ -1058,7 +1055,16 @@ i386_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr,
/* ...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
@@ -1716,7 +1722,6 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
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);