aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaciej W. Rozycki <macro@linux-mips.org>2012-04-24 19:56:02 +0000
committerMaciej W. Rozycki <macro@linux-mips.org>2012-04-24 19:56:02 +0000
commit6321c22a8c33b07349532156764fecf9a01a2396 (patch)
tree68a508172ea1ab2487091daaa1531c1152496c03
parent742c84f629e7a817e937d651d2b8b32f8bf7716c (diff)
downloadgdb-6321c22a8c33b07349532156764fecf9a01a2396.zip
gdb-6321c22a8c33b07349532156764fecf9a01a2396.tar.gz
gdb-6321c22a8c33b07349532156764fecf9a01a2396.tar.bz2
* mips-tdep.c (mips_about_to_return): Remove dead MIPS16 support
code. Handle JR.HB correctly.
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/mips-tdep.c20
2 files changed, 15 insertions, 10 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 355e82b..14bf934 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
2012-04-24 Maciej W. Rozycki <macro@codesourcery.com>
+ * mips-tdep.c (mips_about_to_return): Remove dead MIPS16 support
+ code. Handle JR.HB correctly.
+
+2012-04-24 Maciej W. Rozycki <macro@codesourcery.com>
+
* mips-tdep.c
(is_mips16_addr, unmake_mips16_addr, make_mips16_addr): Group
with the other MIPS16 helpers.
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index ddc2d8a..8973ff7 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -2763,16 +2763,16 @@ mips_software_single_step (struct frame_info *frame)
static int
mips_about_to_return (struct gdbarch *gdbarch, CORE_ADDR pc)
{
- if (mips_pc_is_mips16 (pc))
- /* This mips16 case isn't necessarily reliable. Sometimes the compiler
- generates a "jr $ra"; other times it generates code to load
- the return address from the stack to an accessible register (such
- as $a3), then a "jr" using that register. This second case
- is almost impossible to distinguish from an indirect jump
- used for switch statements, so we don't even try. */
- return mips_fetch_instruction (gdbarch, pc) == 0xe820; /* jr $ra */
- else
- return mips_fetch_instruction (gdbarch, pc) == 0x3e00008; /* jr $ra */
+ ULONGEST insn;
+ ULONGEST hint;
+
+ /* This used to check for MIPS16, but this piece of code is never
+ called for MIPS16 functions. */
+ gdb_assert (!mips_pc_is_mips16 (pc));
+
+ insn = mips_fetch_instruction (gdbarch, pc);
+ hint = 0x7c0;
+ return (insn & ~hint) == 0x3e00008; /* jr(.hb) $ra */
}