Thu May 21 13:14:25 1998 John Metzler <jmetzler@cygnus.com>
[deliverable/binutils-gdb.git] / gdb / ser-ocd.c
index 4008a876f4144cc784816e3db827f08452d02e50..7ef17967c4d8e5d01b1b86ad3a5d150b68d4d200 100644 (file)
@@ -81,21 +81,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 */
 }
 
@@ -192,6 +197,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.02487 seconds and 4 git commands to generate.