aboutsummaryrefslogtreecommitdiff
path: root/gdb/ns32k-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/ns32k-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/ns32k-tdep.c')
-rw-r--r--gdb/ns32k-tdep.c74
1 files changed, 74 insertions, 0 deletions
diff --git a/gdb/ns32k-tdep.c b/gdb/ns32k-tdep.c
index 775e8af..7946521 100644
--- a/gdb/ns32k-tdep.c
+++ b/gdb/ns32k-tdep.c
@@ -64,6 +64,80 @@ umax_skip_prologue (pc)
return pc;
}
+/* Return number of args passed to a frame.
+ Can return -1, meaning no way to tell. */
+
+int
+merlin_frame_num_args (fi)
+ struct frame_info *fi;
+{
+ int numargs;
+ CORE_ADDR pc;
+ int insn;
+ int addr_mode;
+ int width;
+
+ pc = FRAME_SAVED_PC (fi);
+ insn = read_memory_integer (pc,2);
+ addr_mode = (insn >> 11) & 0x1f;
+ insn = insn & 0x7ff;
+ if ((insn & 0x7fc) == 0x57c
+ && addr_mode == 0x14) /* immediate */
+ {
+ if (insn == 0x57c) /* adjspb */
+ width = 1;
+ else if (insn == 0x57d) /* adjspw */
+ width = 2;
+ else if (insn == 0x57f) /* adjspd */
+ width = 4;
+ numargs = read_memory_integer (pc+2,width);
+ if (width > 1)
+ flip_bytes (&numargs, width);
+ numargs = - sign_extend (numargs, width*8) / 4;
+ }
+ else
+ numargs = -1;
+ return numargs;
+}
+
+int
+umax_frame_num_args (fi)
+ struct frame_info *fi;
+{
+ int numargs;
+ CORE_ADDR pc;
+ CORE_ADDR enter_addr;
+ unsigned int insn;
+ unsigned int addr_mode;
+ int width;
+
+ numargs = -1;
+ enter_addr = ns32k_get_enter_addr ((fi)->pc);
+ if (enter_addr > 0)
+ {
+ pc = ((enter_addr == 1)
+ ? SAVED_PC_AFTER_CALL (fi)
+ : FRAME_SAVED_PC (fi));
+ insn = read_memory_integer (pc,2);
+ addr_mode = (insn >> 11) & 0x1f;
+ insn = insn & 0x7ff;
+ if ((insn & 0x7fc) == 0x57c
+ && addr_mode == 0x14) /* immediate */
+ {
+ if (insn == 0x57c) /* adjspb */
+ width = 1;
+ else if (insn == 0x57d) /* adjspw */
+ width = 2;
+ else if (insn == 0x57f) /* adjspd */
+ width = 4;
+ numargs = read_memory_integer (pc+2,width);
+ if (width > 1)
+ flip_bytes (&numargs, width);
+ numargs = - sign_extend (numargs, width*8) / 4;
+ }
+ }
+ return numargs;
+}
sign_extend (value, bits)