* monitor.c (#include "gdb_wait.h"): Removed.
[platform/upstream/binutils.git] / gdb / remote-nindy.c
index ed89be3..7902e0b 100644 (file)
@@ -1,5 +1,5 @@
 /* Memory-access and commands for remote NINDY process, for GDB.
-   Copyright 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
+   Copyright 1990, 1991, 1992, 1993, 2001 Free Software Foundation, Inc.
    Contributed by Intel Corporation.  Modified from remote.c by Chris Benenati.
 
    GDB is distributed in the hope that it will be useful, but WITHOUT ANY
 #include "command.h"
 #include "floatformat.h"
 
-#include "gdb_wait.h"
 #include <sys/file.h>
 #include <ctype.h>
 #include "serial.h"
 #include "nindy-share/env.h"
 #include "nindy-share/stop.h"
-
-#include "dcache.h"
 #include "remote-utils.h"
 
-static DCACHE *nindy_dcache;
-
 extern int unlink ();
 extern char *getenv ();
 extern char *mktemp ();
@@ -165,7 +160,7 @@ nindy_close (int quitting)
   nindy_serial = NULL;
 
   if (savename)
-    free (savename);
+    xfree (savename);
   savename = 0;
 }
 
@@ -187,7 +182,6 @@ nindy_open (char *name,             /* "/dev/ttyXX", "ttyXX", or "XX": tty to be opened */
   nindy_close (0);
 
   have_regs = regs_changed = 0;
-  nindy_dcache = dcache_init (ninMemGet, ninMemPut);
 
   /* Allow user to interrupt the following -- we could hang if there's
      no NINDY at the other end of the remote tty.  */
@@ -236,14 +230,13 @@ nindy_files_info (void)
                     nindy_initial_brk ? " with initial break" : "");
 }
 \f
-/* Return the number of characters in the buffer before
-   the first DLE character.  */
+/* Return the number of characters in the buffer BUF before
+   the first DLE character.  N is maximum number of characters to
+   consider.  */
 
 static
 int
-non_dle (buf, n)
-     char *buf;                        /* Character buffer; NOT '\0'-terminated */
-     int n;                    /* Number of characters in buffer */
+non_dle (char *buf, int n)
 {
   int i;
 
@@ -265,7 +258,6 @@ nindy_resume (int pid, int step, enum target_signal siggnal)
   if (siggnal != TARGET_SIGNAL_0 && siggnal != stop_signal)
     warning ("Can't send signals to remote NINDY targets.");
 
-  dcache_flush (nindy_dcache);
   if (regs_changed)
     {
       nindy_store_registers (-1);
@@ -292,7 +284,7 @@ clean_up_tty (PTR ptrarg)
 {
   struct clean_up_tty_args *args = (struct clean_up_tty_args *) ptrarg;
   SERIAL_SET_TTY_STATE (args->serial, args->state);
-  free (args->state);
+  xfree (args->state);
   warning ("\n\nYou may need to reset the 80960 and/or reload your program.\n");
 }
 
@@ -306,7 +298,7 @@ static void
 clean_up_int (void)
 {
   SERIAL_SET_TTY_STATE (tty_args.serial, tty_args.state);
-  free (tty_args.state);
+  xfree (tty_args.state);
 
   signal (SIGINT, old_ctrlc);
 #ifdef SIGTSTP
@@ -399,7 +391,7 @@ nindy_wait (int pid, struct target_waitstatus *status)
     }
 
   SERIAL_SET_TTY_STATE (tty_args.serial, tty_args.state);
-  free (tty_args.state);
+  xfree (tty_args.state);
   discard_cleanups (old_cleanups);
 
   if (stop_exit)
@@ -478,20 +470,26 @@ nindy_store_registers (int regno)
 
 /* Copy LEN bytes to or from inferior's memory starting at MEMADDR
    to debugger memory starting at MYADDR.   Copy to inferior if
-   SHOULD_WRITE is nonzero.  Returns the length copied. */
+   SHOULD_WRITE is nonzero.  Returns the length copied.  TARGET is
+   unused.  */
 
 int
-nindy_xfer_inferior_memory (memaddr, myaddr, len, should_write, target)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
-     int should_write;
-     struct target_ops *target;        /* ignored */
+nindy_xfer_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len,
+                           int should_write, 
+                           struct mem_attrib *attrib ATTRIBUTE_UNUSED,
+                           struct target_ops *target ATTRIBUTE_UNUSED)
 {
+  int res;
+
   if (len <= 0)
     return 0;
-  return dcache_xfer_memory (nindy_dcache, memaddr, myaddr, 
-                            len, should_write);
+
+  if (should_write)
+    res = ninMemPut (memaddr, myaddr, len);
+  else
+    res = ninMemGet (memaddr, myaddr, len);
+
+  return res;
 }
 \f
 static void
@@ -606,7 +604,7 @@ nindy_load (char *filename, int from_tty)
                  s->_raw_size,
                  s->vma);
          ninMemPut (s->vma, buffer, s->_raw_size);
-         free (buffer);
+         xfree (buffer);
        }
     }
   bfd_close (file);