From 0e907377fff968693ff42d3cab61cafa4d50521b Mon Sep 17 00:00:00 2001 From: Joel Brobecker Date: Tue, 8 May 2012 17:57:56 -0400 Subject: [PATCH] More mods to mips ON_STACK function call. --- gdb/mips-tdep.c | 11 ++++++----- 1 files changed, 6 insertions(+), 5 deletions(-) diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index 68ac858..ebf7c48 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -3018,11 +3018,11 @@ mips_push_dummy_code (struct gdbarch *gdbarch, CORE_ADDR sp, CORE_ADDR *real_pc, CORE_ADDR *bp_addr, struct regcache *regcache) { - int bp_len; + CORE_ADDR nop_addr; static gdb_byte nop_insn[] = { 0, 0, 0, 0 }; - *bp_addr = sp; - gdbarch_breakpoint_from_pc (gdbarch, bp_addr, &bp_len); + /* Reserve enough room on the stack for our breakpoint instruction. */ + *bp_addr = sp - sizeof (nop_insn); /* The breakpoint layer automatically adjusts the address of breakpoints inserted in a branch delay slot. With enough @@ -3031,8 +3031,9 @@ mips_push_dummy_code (struct gdbarch *gdbarch, CORE_ADDR sp, trigger the adjustement, and break the function call entirely. So, we reserve those 4 bytes and write a nop instruction to prevent that from happening. */ - write_memory (*bp_addr - bp_len, nop_insn, sizeof (nop_insn)); - sp = mips_frame_align (gdbarch, *bp_addr - 2 * bp_len); + nop_addr = *bp_addr - sizeof (nop_insn); + write_memory (nop_addr, nop_insn, sizeof (nop_insn)); + sp = mips_frame_align (gdbarch, nop_addr); /* Inferior resumes at the function entry point. */ *real_pc = funaddr; -- 1.7.0.4