From: Maciej W. Rozycki Date: Mon, 11 Jun 2012 10:11:14 +0000 (+0000) Subject: * mips-tdep.c (mips_push_dummy_code): Handle microMIPS code. X-Git-Tag: sid-snapshot-20120701~229 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2e81047f911b9181987439ec157dc3ed1e567393;p=thirdparty%2Fbinutils-gdb.git * mips-tdep.c (mips_push_dummy_code): Handle microMIPS code. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 15b457c5a3a..8480c7841f3 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,7 @@ +2012-06-11 Maciej W. Rozycki + + * mips-tdep.c (mips_push_dummy_code): Handle microMIPS code. + 2012-06-09 Siva Chandra Reddy * valarith.c (binop_types_user_defined_p): Fix a typo. diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index 4c000e72514..0439989ee2b 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -4197,11 +4197,18 @@ mips_push_dummy_code (struct gdbarch *gdbarch, CORE_ADDR sp, CORE_ADDR *real_pc, CORE_ADDR *bp_addr, struct regcache *regcache) { - CORE_ADDR nop_addr; static gdb_byte nop_insn[] = { 0, 0, 0, 0 }; + CORE_ADDR nop_addr; + CORE_ADDR bp_slot; /* Reserve enough room on the stack for our breakpoint instruction. */ - *bp_addr = sp - sizeof (nop_insn); + bp_slot = sp - sizeof (nop_insn); + + /* Return to microMIPS mode if calling microMIPS code to avoid + triggering an address error exception on processors that only + support microMIPS execution. */ + *bp_addr = (mips_pc_is_micromips (gdbarch, funaddr) + ? make_compact_addr (bp_slot) : bp_slot); /* The breakpoint layer automatically adjusts the address of breakpoints inserted in a branch delay slot. With enough @@ -4210,7 +4217,7 @@ 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. */ - nop_addr = *bp_addr - sizeof (nop_insn); + nop_addr = bp_slot - sizeof (nop_insn); write_memory (nop_addr, nop_insn, sizeof (nop_insn)); sp = mips_frame_align (gdbarch, nop_addr);