aboutsummaryrefslogtreecommitdiff
path: root/gdb/ser-ocd.c
diff options
context:
space:
mode:
authorGeoffrey Noer <noer@cygnus>1997-08-21 23:10:34 +0000
committerGeoffrey Noer <noer@cygnus>1997-08-21 23:10:34 +0000
commit61a0d0227a46112b2b93b84506b937f1c6eca7ab (patch)
treebcad77955cf7d0388057527c91aca0eaa119b711 /gdb/ser-ocd.c
parentf483cb11c89c720da94839211f61338f3bd93fd6 (diff)
downloadgdb-61a0d0227a46112b2b93b84506b937f1c6eca7ab.zip
gdb-61a0d0227a46112b2b93b84506b937f1c6eca7ab.tar.gz
gdb-61a0d0227a46112b2b93b84506b937f1c6eca7ab.tar.bz2
Thu Aug 21 14:56:04 1997 Geoffrey Noer <noer@cygnus.com>
* ppc-bdm.c (bdm_ppc_wait): stop printfing ecr, der * ocd.c: initialize remote_timeout (ocd_wait): while looping, call ocd_do_command with OCD_AYT (ocd_get_packet): remove find_packet goto. If there isn't an 0x55 at the start, something is quite wrong so error out instead of advancing in the packet and trying again. If checksum is invalid, print error message instead of trying again. * ser-ocd.c (ocd_readchar): error if we attempt to read past the end of the from_wiggler_buffer.
Diffstat (limited to 'gdb/ser-ocd.c')
-rw-r--r--gdb/ser-ocd.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/gdb/ser-ocd.c b/gdb/ser-ocd.c
index 4008a87..08239bb 100644
--- a/gdb/ser-ocd.c
+++ b/gdb/ser-ocd.c
@@ -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 */
}