This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[PATCH/i386newframe]: Remove usage of FP_REGNUM
- From: Mark Kettenis <kettenis at chello dot nl>
- To: gdb-patches at sources dot redhat dot com
- Date: Sun, 4 May 2003 12:13:13 +0200 (CEST)
- Subject: [PATCH/i386newframe]: Remove usage of FP_REGNUM
In preperation of merging with mainline and removing it completely.
Checked in.
Index: ChangeLog
from Mark Kettenis <kettenis@gnu.org>
* i386-tdep.c (i386_analyze_frame_setup): Use I386_EBP_REGNUM
instead of FP_REGNUM.
(i386_unwind_dummy_id): Use I386_ESP_REGNUM instead of FP_REGNUM.
Don't mark this function as 64-bit safe.
(i386_save_dummy_frame_tos): Remove function.
(i386_push_dummy_call): Fake the frame pointer here.
(i386_gdbarch_init): Set save_dummy_frame_tos to
generic_save_dummy_frame_tos.
Index: i386-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/i386-tdep.c,v
retrieving revision 1.138.2.1
diff -u -p -r1.138.2.1 i386-tdep.c
--- i386-tdep.c 19 Apr 2003 16:40:13 -0000 1.138.2.1
+++ i386-tdep.c 4 May 2003 10:11:42 -0000
@@ -471,7 +471,7 @@ i386_analyze_frame_setup (CORE_ADDR pc,
{
/* Take into account that we've executed the `pushl %ebp' that
starts this instruction sequence. */
- cache->saved_regs[FP_REGNUM] = 0;
+ cache->saved_regs[I386_EBP_REGNUM] = 0;
cache->sp_offset += 4;
/* If that's all, return now. */
@@ -969,37 +969,17 @@ static const struct frame_base i386_fram
i386_frame_base_address
};
-/* This function is 64-bit safe. */
-
static struct frame_id
i386_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *next_frame)
{
- char buf[8];
+ char buf[4];
CORE_ADDR fp;
- frame_unwind_register (next_frame, FP_REGNUM, buf);
+ frame_unwind_register (next_frame, I386_EBP_REGNUM, buf);
fp = extract_typed_address (buf, builtin_type_void_data_ptr);
return frame_id_build (fp, frame_pc_unwind (next_frame));
}
-
-/* This function is 64-bit safe. */
-
-static void
-i386_save_dummy_frame_tos (CORE_ADDR sp)
-{
- char buf[8];
-
- /* We can't use the saved top-of-stack to find the right dummy frame
- when unwinding, since we can't reconstruct it properly if the
- dummy frame is the innermost frame. To circumvent this, we fake
- a frame pointer here. */
-
- store_typed_address (buf, builtin_type_void_data_ptr, sp);
- regcache_cooked_write (current_regcache, FP_REGNUM, buf);
-
- generic_save_dummy_frame_tos (sp);
-}
/* Figure out where the longjmp will land. Slurp the args out of the
@@ -1073,10 +1053,13 @@ i386_push_dummy_call (struct gdbarch *gd
store_address (buf, 4, dummy_addr);
write_memory (sp, buf, 4);
- /* Finally, update the stack pointer. */
+ /* Finally, update the stack pointer... */
store_address (buf, 4, sp);
regcache_cooked_write (regcache, I386_ESP_REGNUM, buf);
+ /* ...and fake a frame pointer. */
+ regcache_cooked_write (regcache, I386_EBP_REGNUM, buf);
+
return sp;
}
@@ -1732,7 +1715,7 @@ i386_gdbarch_init (struct gdbarch_info i
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_save_dummy_frame_tos (gdbarch, generic_save_dummy_frame_tos);
set_gdbarch_unwind_pc (gdbarch, i386_unwind_pc);