aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorMaciej W. Rozycki <macro@linux-mips.org>2011-12-08 19:03:24 +0000
committerMaciej W. Rozycki <macro@linux-mips.org>2011-12-08 19:03:24 +0000
commit280711e76caf982f48261a75b7b67c0029d4764a (patch)
treee0eb3666551cd2ab9e0d44145a9265aa77de1c56 /gdb
parent4c2051c6c94ae19b0f2ded3a2244ecbd4bfb11e4 (diff)
downloadgdb-280711e76caf982f48261a75b7b67c0029d4764a.zip
gdb-280711e76caf982f48261a75b7b67c0029d4764a.tar.gz
gdb-280711e76caf982f48261a75b7b67c0029d4764a.tar.bz2
* mips-tdep.c (mips_skip_mips16_trampoline_code): Sign-extend
address chunks retrieved from decoded lui/addiu pairs.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/mips-tdep.c11
2 files changed, 13 insertions, 4 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 2fb4758..209f7b9 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+2011-12-08 Maciej W. Rozycki <macro@mips.com>
+ Maciej W. Rozycki <macro@codesourcery.com>
+
+ * mips-tdep.c (mips_skip_mips16_trampoline_code): Sign-extend
+ address chunks retrieved from decoded lui/addiu pairs.
+
2011-12-08 Maciej W. Rozycki <macro@codesourcery.com>
* mips-tdep.c (extended_offset): Correct calculation.
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index 0f9a4ab..0b950f2 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -5356,7 +5356,6 @@ mips_skip_mips16_trampoline_code (struct frame_info *frame, CORE_ADDR pc)
address from those two instructions. */
CORE_ADDR target_pc = get_frame_register_signed (frame, 2);
- ULONGEST inst;
int i;
/* See if the name of the target function is __fn_stub_*. */
@@ -5373,11 +5372,15 @@ mips_skip_mips16_trampoline_code (struct frame_info *frame, CORE_ADDR pc)
instructions. FIXME. */
for (i = 0, pc = 0; i < 20; i++, target_pc += MIPS_INSN32_SIZE)
{
- inst = mips_fetch_instruction (gdbarch, target_pc);
+ ULONGEST inst = mips_fetch_instruction (gdbarch, target_pc);
+ CORE_ADDR addr = inst;
+
if ((inst & 0xffff0000) == 0x3c010000) /* lui $at */
- pc = (inst << 16) & 0xffff0000; /* high word */
+ pc = (((addr & 0xffff) ^ 0x8000) - 0x8000) << 16;
+ /* high word */
else if ((inst & 0xffff0000) == 0x24210000) /* addiu $at */
- return pc | (inst & 0xffff); /* low word */
+ return pc + ((addr & 0xffff) ^ 0x8000) - 0x8000;
+ /* low word */
}
/* Couldn't find the lui/addui pair, so return stub address. */