aboutsummaryrefslogtreecommitdiff
path: root/gdb/m68k-tdep.c
diff options
context:
space:
mode:
authorJason Molenda <jmolenda@apple.com>1999-05-25 18:09:09 +0000
committerJason Molenda <jmolenda@apple.com>1999-05-25 18:09:09 +0000
commit392a587b0562bfd8561bc15ad2625a4f49f461f0 (patch)
tree933e0970b7845c901c7ea3e128fa9cb0dcf9fe14 /gdb/m68k-tdep.c
parent751d21b5b946a4a451552fbac692b14abea3d816 (diff)
downloadgdb-392a587b0562bfd8561bc15ad2625a4f49f461f0.zip
gdb-392a587b0562bfd8561bc15ad2625a4f49f461f0.tar.gz
gdb-392a587b0562bfd8561bc15ad2625a4f49f461f0.tar.bz2
import gdb-1999-05-25 snapshot
Diffstat (limited to 'gdb/m68k-tdep.c')
-rw-r--r--gdb/m68k-tdep.c71
1 files changed, 71 insertions, 0 deletions
diff --git a/gdb/m68k-tdep.c b/gdb/m68k-tdep.c
index 56e5552..769ffe8 100644
--- a/gdb/m68k-tdep.c
+++ b/gdb/m68k-tdep.c
@@ -72,6 +72,77 @@ isi_skip_prologue (pc)
return pc;
}
+/* Return number of args passed to a frame.
+ Can return -1, meaning no way to tell. */
+
+int
+isi_frame_num_args (fi)
+ struct frame_info *fi;
+{
+ int val;
+ CORE_ADDR pc = FRAME_SAVED_PC (fi);
+ int insn = 0177777 & read_memory_integer (pc, 2);
+ val = 0;
+ if (insn == 0047757 || insn == 0157374) /* lea W(sp),sp or addaw #W,sp */
+ val = read_memory_integer (pc + 2, 2);
+ else if ((insn & 0170777) == 0050217 /* addql #N, sp */
+ || (insn & 0170777) == 0050117) /* addqw */
+ {
+ val = (insn >> 9) & 7;
+ if (val == 0)
+ val = 8;
+ }
+ else if (insn == 0157774) /* addal #WW, sp */
+ val = read_memory_integer (pc + 2, 4);
+ val >>= 2;
+ return val;
+}
+
+int
+delta68_frame_num_args (fi)
+ struct frame_info *fi;
+{
+ int val;
+ CORE_ADDR pc = FRAME_SAVED_PC (fi);
+ int insn = 0177777 & read_memory_integer (pc, 2);
+ val = 0;
+ if (insn == 0047757 || insn == 0157374) /* lea W(sp),sp or addaw #W,sp */
+ val = read_memory_integer (pc + 2, 2);
+ else if ((insn & 0170777) == 0050217 /* addql #N, sp */
+ || (insn & 0170777) == 0050117) /* addqw */
+ {
+ val = (insn >> 9) & 7;
+ if (val == 0)
+ val = 8;
+ }
+ else if (insn == 0157774) /* addal #WW, sp */
+ val = read_memory_integer (pc + 2, 4);
+ val >>= 2;
+ return val;
+}
+
+int
+news_frame_num_args (fi)
+ struct frame_info *fi;
+{
+ int val;
+ CORE_ADDR pc = FRAME_SAVED_PC (fi);
+ int insn = 0177777 & read_memory_integer (pc, 2);
+ val = 0;
+ if (insn == 0047757 || insn == 0157374) /* lea W(sp),sp or addaw #W,sp */
+ val = read_memory_integer (pc + 2, 2);
+ else if ((insn & 0170777) == 0050217 /* addql #N, sp */
+ || (insn & 0170777) == 0050117) /* addqw */
+ {
+ val = (insn >> 9) & 7;
+ if (val == 0)
+ val = 8;
+ }
+ else if (insn == 0157774) /* addal #WW, sp */
+ val = read_memory_integer (pc + 2, 4);
+ val >>= 2;
+ return val;
+}
/* Push an empty stack frame, to record the current PC, etc. */