* mips-tdep.c (mips_push_dummy_code): Handle microMIPS code.

This commit is contained in:
Maciej W. Rozycki 2012-06-11 10:11:14 +00:00
parent c7a8dbf91f
commit 2e81047f91
2 changed files with 14 additions and 3 deletions

View File

@ -1,3 +1,7 @@
2012-06-11 Maciej W. Rozycki <macro@codesourcery.com>
* mips-tdep.c (mips_push_dummy_code): Handle microMIPS code.
2012-06-09 Siva Chandra Reddy <sivachandra@google.com>
* valarith.c (binop_types_user_defined_p): Fix a typo.

View File

@ -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);