2001-05-10 Elena Zannoni <ezannoni@redhat.com>
[deliverable/binutils-gdb.git] / gdb / ns32k-tdep.c
index c4cab6215510392e9c105f2a4cd47b46f9dbe292..825247fbdf3d4af1264548fa07b6dba2fe77319c 100644 (file)
@@ -21,6 +21,9 @@
 
 #include "defs.h"
 #include "frame.h"
+#include "gdbcore.h"
+
+static int sign_extend (int value, int bits);
 
 void
 _initialize_ns32k_tdep (void)
@@ -31,22 +34,22 @@ _initialize_ns32k_tdep (void)
 /* Advance PC across any function entry prologue instructions
    to reach some "real" code.  */
 
-CORE_ADDR
-merlin_skip_prologue (CORE_ADDR pc)
-{
-  register int op = read_memory_integer (pc, 1);
-  if (op == 0x82)
-    {
-      op = read_memory_integer (pc + 2, 1);
-      if ((op & 0x80) == 0)
-       pc += 3;
-      else if ((op & 0xc0) == 0x80)
-       pc += 4;
-      else
-       pc += 6;
-    }
-  return pc;
-}
+/* OBSOLETE CORE_ADDR */
+/* OBSOLETE merlin_skip_prologue (CORE_ADDR pc) */
+/* OBSOLETE { */
+/* OBSOLETE   register int op = read_memory_integer (pc, 1); */
+/* OBSOLETE   if (op == 0x82) */
+/* OBSOLETE     { */
+/* OBSOLETE       op = read_memory_integer (pc + 2, 1); */
+/* OBSOLETE       if ((op & 0x80) == 0) */
+/* OBSOLETE    pc += 3; */
+/* OBSOLETE       else if ((op & 0xc0) == 0x80) */
+/* OBSOLETE    pc += 4; */
+/* OBSOLETE       else */
+/* OBSOLETE    pc += 6; */
+/* OBSOLETE     } */
+/* OBSOLETE   return pc; */
+/* OBSOLETE } */
 
 CORE_ADDR
 umax_skip_prologue (CORE_ADDR pc)
@@ -68,44 +71,46 @@ umax_skip_prologue (CORE_ADDR pc)
 /* Return number of args passed to a frame.
    Can return -1, meaning no way to tell.  */
 
-int
-merlin_frame_num_args (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;
-}
-
+/* OBSOLETE int */
+/* OBSOLETE merlin_frame_num_args (struct frame_info *fi) */
+/* OBSOLETE { */
+/* OBSOLETE   int numargs; */
+/* OBSOLETE   CORE_ADDR pc; */
+/* OBSOLETE   int insn; */
+/* OBSOLETE   int addr_mode; */
+/* OBSOLETE   int width; */
+/* OBSOLETE  */
+/* OBSOLETE   pc = FRAME_SAVED_PC (fi); */
+/* OBSOLETE   insn = read_memory_integer (pc, 2); */
+/* OBSOLETE   addr_mode = (insn >> 11) & 0x1f; */
+/* OBSOLETE   insn = insn & 0x7ff; */
+/* OBSOLETE   if ((insn & 0x7fc) == 0x57c */
+/* OBSOLETE       && addr_mode == 0x14)         *//* immediate */
+/* OBSOLETE     { */
+/* OBSOLETE       if (insn == 0x57c)    *//* adjspb */
+/* OBSOLETE    width = 1; */
+/* OBSOLETE       else if (insn == 0x57d)       *//* adjspw */
+/* OBSOLETE    width = 2; */
+/* OBSOLETE       else if (insn == 0x57f)       *//* adjspd */
+/* OBSOLETE    width = 4; */
+/* OBSOLETE       else */
+/* OBSOLETE    internal_error (__FILE__, __LINE__, "bad else"); */
+/* OBSOLETE       numargs = read_memory_integer (pc + 2, width); */
+/* OBSOLETE       if (width > 1) */
+/* OBSOLETE    flip_bytes (&numargs, width); */
+/* OBSOLETE       numargs = -sign_extend (numargs, width * 8) / 4; */
+/* OBSOLETE     } */
+/* OBSOLETE   else */
+/* OBSOLETE     numargs = -1; */
+/* OBSOLETE   return numargs; */
+/* OBSOLETE } */
 
 /* Return number of args passed to a frame.
    Can return -1, meaning no way to tell.
    Encore's C compiler often reuses same area on stack for args,
    so this will often not work properly.  If the arg names
    are known, it's likely most of them will be printed. */
+
 int
 umax_frame_num_args (struct frame_info *fi)
 {
@@ -135,6 +140,8 @@ umax_frame_num_args (struct frame_info *fi)
            width = 2;
          else if (insn == 0x57f)       /* adjspd */
            width = 4;
+         else
+           internal_error (__FILE__, __LINE__, "bad else");
          numargs = read_memory_integer (pc + 2, width);
          if (width > 1)
            flip_bytes (&numargs, width);
@@ -144,7 +151,7 @@ umax_frame_num_args (struct frame_info *fi)
   return numargs;
 }
 
-
+static int
 sign_extend (int value, int bits)
 {
   value = value & ((1 << bits) - 1);
@@ -154,9 +161,10 @@ sign_extend (int value, int bits)
 }
 
 void
-flip_bytes (char *ptr, int count)
+flip_bytes (void *p, int count)
 {
   char tmp;
+  char *ptr = 0;
 
   while (count > 0)
     {
This page took 0.027529 seconds and 4 git commands to generate.