]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - gdb/i386-tdep.c
2003-06-13 Andrew Cagney <cagney@redhat.com>
[thirdparty/binutils-gdb.git] / gdb / i386-tdep.c
index 80f69e09d7959890de4e00fb63709dbe5fa93b23..467f686a12374395e1d993091656b07f0b383ad8 100644 (file)
@@ -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));
 }
 \f
@@ -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);