Allow PPC users to select which PPC/RS6000 variant they're debugging
[deliverable/binutils-gdb.git] / gdb / ser-ocd.c
index ad9ba0cd213fc9b5c88a20f562cf76c737d5917b..971f84e049c451e69e3b276714795125a7cebb0d 100644 (file)
@@ -62,8 +62,10 @@ ocd_open (scb, name)
       if (dll_do_command == NULL)
        error ("Can't find do_command function in Wigglers.dll");
     }
-#endif
-
+#else
+  /* No wiggler DLLs on Unix yet, fail.  */
+  error ("Wiggler library not available for this type of host.");
+#endif /* _WIN32 */
   return 0;
 }
 
@@ -81,21 +83,26 @@ ocd_raw (scb)
   /* Always in raw mode */
 }
 
-/* We need a buffer to store responses from the Wigglers.dll */
-#define WIGGLER_BUFF_SIZE 512
-unsigned char from_wiggler_buffer[WIGGLER_BUFF_SIZE];
-unsigned char * wiggler_buffer_ptr;    /* curr spot in buffer */
-
 static void
 ocd_readremote ()
 {
 }
 
+/* We need a buffer to store responses from the Wigglers.dll */
+#define WIGGLER_BUFF_SIZE 512
+unsigned char from_wiggler_buffer[WIGGLER_BUFF_SIZE];
+unsigned char * wiggler_buffer_ptr;    /* curr spot in buffer */
+
 static int
 ocd_readchar (scb, timeout)
      serial_t scb;
      int timeout;
 {
+  /* Catch attempts at reading past the end of the buffer */
+  if (wiggler_buffer_ptr >
+              (from_wiggler_buffer + (sizeof (char *) * WIGGLER_BUFF_SIZE)))
+    error ("ocd_readchar asked to read past the end of the buffer!");
+
   return (int) *wiggler_buffer_ptr++; /* return curr char and increment ptr */
 }
 
@@ -159,7 +166,7 @@ ocd_write (scb, str, len)
 {
   char c;
 
-#ifdef __CYGWIN32__ 
+#ifdef _WIN32 
   /* send packet to Wigglers.dll and store response so we can give it to
        remote-wiggler.c when get_packet is run */
   dll_do_command (str, from_wiggler_buffer);
@@ -192,6 +199,7 @@ static struct serial_ops ocd_ops =
   ocd_print_tty_state,
   ocd_noflush_set_tty_state,
   ocd_setbaudrate,
+  ocd_noop,            /* wait for output to drain */
 };
 
 void
This page took 0.025268 seconds and 4 git commands to generate.