gdb/gdb-x86-onstack.patch

37 lines
1.2 KiB
Diff
Executable File

--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -2326,6 +2326,24 @@ i386_16_byte_align_p (struct type *type)
return 0;
}
+/* Implementation for set_gdbarch_push_dummy_code. */
+
+static CORE_ADDR
+i386_push_dummy_code (struct gdbarch *gdbarch, CORE_ADDR sp, CORE_ADDR funaddr,
+ struct value **args, int nargs, struct type *value_type,
+ CORE_ADDR *real_pc, CORE_ADDR *bp_addr,
+ struct regcache *regcache)
+{
+ int bplen;
+ CORE_ADDR bppc = sp;
+
+ gdbarch_breakpoint_from_pc (gdbarch, &bppc, &bplen);
+ *bp_addr = sp - bplen;
+ *real_pc = funaddr;
+
+ return *bp_addr;
+}
+
static CORE_ADDR
i386_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
struct regcache *regcache, CORE_ADDR bp_addr, int nargs,
@@ -7372,6 +7390,8 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_get_longjmp_target (gdbarch, i386_get_longjmp_target);
/* Call dummy code. */
+ set_gdbarch_call_dummy_location (gdbarch, ON_STACK);
+ set_gdbarch_push_dummy_code (gdbarch, i386_push_dummy_code);
set_gdbarch_push_dummy_call (gdbarch, i386_push_dummy_call);
set_gdbarch_frame_align (gdbarch, i386_frame_align);