2001-07-26 Elena Zannoni <ezannoni@redhat.com>
[deliverable/binutils-gdb.git] / gdb / remote-rdp.c
index 1c9b3c385032abba1bd3358b941fa5b31095330a..22f5b3e4fd4cd06f88300110483cc2ff4a2875ac 100644 (file)
 #include "gdb_string.h"
 #include "gdbcore.h"
 #include "regcache.h"
+#include "serial.h"
 
 #ifdef HAVE_TIME_H
 #include <time.h>
 #endif
 
 extern struct target_ops remote_rdp_ops;
-static serial_t io;
+static struct serial *io;
 static host_callback *callback = &default_callback;
 
 struct
@@ -179,7 +180,7 @@ remote_rdp_xfer_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len,
 static unsigned char
 get_byte (void)
 {
-  int c = SERIAL_READCHAR (io, timeout);
+  int c = serial_readchar (io, timeout);
 
   if (remote_debug)
     fprintf_unfiltered (gdb_stdlog, "[%02x]\n", c);
@@ -216,7 +217,7 @@ put_byte (char val)
 {
   if (remote_debug)
     fprintf_unfiltered (gdb_stdlog, "(%02x)\n", val);
-  SERIAL_WRITE (io, &val, 1);
+  serial_write (io, &val, 1);
 }
 
 static void
@@ -232,7 +233,7 @@ put_word (int val)
   if (remote_debug)
     fprintf_unfiltered (gdb_stdlog, "(%04x)", val);
 
-  SERIAL_WRITE (io, b, 4);
+  serial_write (io, b, 4);
 }
 
 
@@ -263,8 +264,8 @@ rdp_init (int cold, int tty)
       int restype;
       QUIT;
 
-      SERIAL_FLUSH_INPUT (io);
-      SERIAL_FLUSH_OUTPUT (io);
+      serial_flush_input (io);
+      serial_flush_output (io);
 
       if (tty)
        printf_unfiltered ("Trying to connect at %d baud.\n", baudtry);
@@ -276,7 +277,7 @@ rdp_init (int cold, int tty)
       if (cold)
        {
          put_byte (RDP_RESET);
-         while ((restype = SERIAL_READCHAR (io, 1)) > 0)
+         while ((restype = serial_readchar (io, 1)) > 0)
            {
              switch (restype)
                {
@@ -303,7 +304,7 @@ rdp_init (int cold, int tty)
       put_byte (type | RDP_OPEN_TYPE_RETURN_SEX);
       put_word (0);
 
-      while (!sync && (restype = SERIAL_READCHAR (io, 1)) > 0)
+      while (!sync && (restype = serial_readchar (io, 1)) > 0)
        {
          if (remote_debug)
            fprintf_unfiltered (gdb_stdlog, "[%02x]\n", restype);
@@ -314,13 +315,13 @@ rdp_init (int cold, int tty)
              break;
 
            case RDP_RESET:
-             while ((restype = SERIAL_READCHAR (io, 1)) == RDP_RESET)
+             while ((restype = serial_readchar (io, 1)) == RDP_RESET)
                ;
              do
                {
                  printf_unfiltered ("%c", isgraph (restype) ? restype : ' ');
                }
-             while ((restype = SERIAL_READCHAR (io, 1)) > 0);
+             while ((restype = serial_readchar (io, 1)) > 0);
 
              if (tty)
                {
@@ -338,7 +339,7 @@ rdp_init (int cold, int tty)
 
            case RDP_RES_VALUE:
              {
-               int resval = SERIAL_READCHAR (io, 1);
+               int resval = serial_readchar (io, 1);
 
                if (remote_debug)
                  fprintf_unfiltered (gdb_stdlog, "[%02x]\n", resval);
@@ -458,13 +459,13 @@ send_rdp (char *template,...)
          pc = va_arg (alist, char *);
          val = va_arg (alist, int);
          dst = buf;
-         SERIAL_WRITE (io, pc, val);
+         serial_write (io, pc, val);
          break;
        case '-':
          /* Send whats in the queue */
          if (dst != buf)
            {
-             SERIAL_WRITE (io, buf, dst - buf);
+             serial_write (io, buf, dst - buf);
              dst = buf;
            }
          break;
@@ -699,7 +700,7 @@ rdp_set_command_line (char *command, char *args)
   if (commandline != NULL)
     xfree (commandline);
 
-  xasprintf (&commandline, %s %s", command, args);
+  xasprintf (&commandline, "%s %s", command, args);
 }
 
 static void
@@ -994,12 +995,12 @@ rdp_execute_finish (void)
   while (running)
     {
       int res;
-      res = SERIAL_READCHAR (io, 1);
+      res = serial_readchar (io, 1);
       while (res == SERIAL_TIMEOUT)
        {
          QUIT;
          printf_filtered ("Waiting for target..\n");
-         res = SERIAL_READCHAR (io, 1);
+         res = serial_readchar (io, 1);
        }
 
       switch (res)
@@ -1110,12 +1111,12 @@ remote_rdp_open (char *args, int from_tty)
 
   target_preopen (from_tty);
 
-  io = SERIAL_OPEN (args);
+  io = serial_open (args);
 
   if (!io)
     perror_with_name (args);
 
-  SERIAL_RAW (io);
+  serial_raw (io);
 
   rdp_init (1, from_tty);
 
@@ -1173,7 +1174,7 @@ remote_rdp_close (int quitting)
 {
   callback->shutdown (callback);
   if (io)
-    SERIAL_CLOSE (io);
+    serial_close (io);
   io = 0;
 }
 
@@ -1183,7 +1184,7 @@ remote_rdp_close (int quitting)
    to the target, or zero for no signal.  */
 
 static void
-remote_rdp_resume (int pid, int step, enum target_signal siggnal)
+remote_rdp_resume (ptid_t ptid, int step, enum target_signal siggnal)
 {
   if (step)
     rdp_step ();
@@ -1195,8 +1196,8 @@ remote_rdp_resume (int pid, int step, enum target_signal siggnal)
    or -1 in case of error; store status through argument pointer STATUS,
    just as `wait' would.  */
 
-static int
-remote_rdp_wait (int pid, struct target_waitstatus *status)
+static ptid_t
+remote_rdp_wait (ptid_t ptid, struct target_waitstatus *status)
 {
   switch (ds.rdi_stopped_status)
     {
@@ -1222,7 +1223,7 @@ remote_rdp_wait (int pid, struct target_waitstatus *status)
 #endif
     }
 
-  return inferior_pid;
+  return inferior_ptid;
 }
 
 /* Get ready to modify the registers array.  On machines which store
@@ -1348,7 +1349,7 @@ remote_rdp_create_inferior (char *exec_file, char *allargs, char **env)
   /* This gives us a chance to set up the command line */
   rdp_set_command_line (exec_file, allargs);
 
-  inferior_pid = 42;
+  inferior_ptid = pid_to_ptid (42);
   insert_breakpoints ();       /* Needed to get correct instruction in cache */
 
   /*
@@ -1433,7 +1434,6 @@ init_remote_rdp_ops (void)
   remote_rdp_ops.to_thread_alive = 0;
   remote_rdp_ops.to_stop = 0;
   remote_rdp_ops.to_pid_to_exec_file = NULL;
-  remote_rdp_ops.to_core_file_to_sym_file = NULL;
   remote_rdp_ops.to_stratum = process_stratum;
   remote_rdp_ops.DONT_USE = NULL;
   remote_rdp_ops.to_has_all_memory = 1;
This page took 0.02713 seconds and 4 git commands to generate.