aboutsummaryrefslogtreecommitdiff
path: root/gdb/moxie-tdep.c
diff options
context:
space:
mode:
authorAnthony Green <green@redhat.com>2009-09-10 21:12:25 +0000
committerAnthony Green <green@redhat.com>2009-09-10 21:12:25 +0000
commitce0bf48891e83c4aa7137bd66a6dd547d55e0ea1 (patch)
tree94de252207b373c438ce286c6b76b483b7e75fd2 /gdb/moxie-tdep.c
parent0d772ac9df1e83b8587b78eda700510a043666c6 (diff)
downloadgdb-ce0bf48891e83c4aa7137bd66a6dd547d55e0ea1.zip
gdb-ce0bf48891e83c4aa7137bd66a6dd547d55e0ea1.tar.gz
gdb-ce0bf48891e83c4aa7137bd66a6dd547d55e0ea1.tar.bz2
Recognize new moxie prologues
Diffstat (limited to 'gdb/moxie-tdep.c')
-rw-r--r--gdb/moxie-tdep.c40
1 files changed, 27 insertions, 13 deletions
diff --git a/gdb/moxie-tdep.c b/gdb/moxie-tdep.c
index 7faa378..80fecf8 100644
--- a/gdb/moxie-tdep.c
+++ b/gdb/moxie-tdep.c
@@ -174,23 +174,37 @@ moxie_analyze_prologue (CORE_ADDR start_addr, CORE_ADDR end_addr,
cache->saved_regs[regnum] = cache->framesize;
next_addr += 2;
}
+ }
- /* Optional stack allocation for args and local vars <= 4
- byte. */
- else if (inst == 0x01f0) /* ldi.l $r12, X */
- {
- offset = read_memory_integer (next_addr + 2, 4, byte_order);
- inst2 = read_memory_unsigned_integer (next_addr + 6, 2, byte_order);
+ inst = read_memory_unsigned_integer (next_addr, 2, byte_order);
- if (inst2 == 0x051f) /* add.l $sp, $r12 */
- {
- cache->framesize += offset;
- }
+ /* Optional stack allocation for args and local vars <= 4
+ byte. */
+ if (inst == 0x0170) /* ldi.l $r5, X */
+ {
+ offset = read_memory_integer (next_addr + 2, 4, byte_order);
+ inst2 = read_memory_unsigned_integer (next_addr + 6, 2, byte_order);
+
+ if (inst2 == 0x0517) /* add.l $sp, $r5 */
+ {
+ cache->framesize += offset;
+ }
+
+ return (next_addr + 8);
+ }
+ else if ((inst & 0xff00) == 0x91) /* dec $sp, X */
+ {
+ cache->framesize += (inst & 0x00ff);
+ next_addr += 2;
- return (next_addr + 8);
+ while (next_addr < end_addr)
+ {
+ inst = read_memory_unsigned_integer (next_addr, 2, byte_order);
+ if ((inst & 0xff00) != 0x91) /* no more dec $sp, X */
+ break;
+ cache->framesize += (inst & 0x00ff);
+ next_addr += 2;
}
- else /* This is not a prologue instruction. */
- break;
}
return next_addr;