This is the mail archive of the
mailing list for the GDB project.
[PATCH] MIPS: Fix breakpoints on frameless functions
- From: "Maciej W. Rozycki" <macro at codesourcery dot com>
- To: <gdb-patches at sourceware dot org>
- Date: Wed, 23 Nov 2011 20:16:33 +0000
- Subject: [PATCH] MIPS: Fix breakpoints on frameless functions
There's a piece of code in the standard MIPS prologue scanner that
accumulates an adjustment to be made to the address of the end of the
prologue sequence if some immediate load instructions turn out not to be
related to an SP adjustment sequence. The problem is the adjustment is
made to the address even if these instructions are beyond the end of the
prologue. As a result, the address is decremented too much, perhaps even
before the beginning of the function handled. A notable problem seen by
the user if that happens is that a breakpoint is misplaced. This only
happens if the function has no frame (no SP manipulation has been seen).
Fixed thus. Regression-tested with mips-sde-elf and mips-linux-gnu
successfully. OK to apply?
2011-11-23 Maciej W. Rozycki <firstname.lastname@example.org>
* mips-tdep.c (mips32_scan_prologue): Only update the immediate
load adjustment if still within the prologue.
--- gdb-fsf-trunk-quilt.orig/gdb/mips-tdep.c 2011-11-23 02:43:17.315559888 +0000
+++ gdb-fsf-trunk-quilt/gdb/mips-tdep.c 2011-11-23 02:43:20.955595369 +0000
@@ -2273,7 +2273,8 @@ mips32_scan_prologue (struct gdbarch *gd
|| high_word == 0x3408 /* ori $t0,$zero,n */
- load_immediate_bytes += MIPS_INSN32_SIZE; /* FIXME! */
+ if (end_prologue_addr == 0)
+ load_immediate_bytes += MIPS_INSN32_SIZE; /* FIXME! */