From 61a0d0227a46112b2b93b84506b937f1c6eca7ab Mon Sep 17 00:00:00 2001 From: Geoffrey Noer Date: Thu, 21 Aug 1997 23:10:34 +0000 Subject: Thu Aug 21 14:56:04 1997 Geoffrey Noer * 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. --- gdb/ser-ocd.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'gdb/ser-ocd.c') 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 */ } -- cgit v1.1