From e1b09194cb4a30d662749d98b0e80ee9222ab090 Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Thu, 24 Aug 2000 10:48:22 +0000 Subject: 2000-08-20 Michael Chastain * remote.c (read_frame): Handle SERIAL_TIMEOUT while reading checksum. --- gdb/ChangeLog | 5 +++++ gdb/remote.c | 17 +++++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 8ec20e0..1cc9633 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2000-08-20 Michael Chastain + + * remote.c (read_frame): Handle SERIAL_TIMEOUT while reading + checksum. + 2000-08-23 Kevin Buettner * dstread.c (dst_symfile_offsets): Protoize. diff --git a/gdb/remote.c b/gdb/remote.c index 66a14fa..9a6e2f9 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -3871,12 +3871,25 @@ read_frame (char *buf, case '#': { unsigned char pktcsum; + int check_0 = 0; + int check_1 = 0; buf[bc] = '\0'; - pktcsum = fromhex (readchar (remote_timeout)) << 4; - pktcsum |= fromhex (readchar (remote_timeout)); + check_0 = readchar (remote_timeout); + if (check_0 >= 0) + check_1 = readchar (remote_timeout); + + if (check_0 == SERIAL_TIMEOUT || check_1 == SERIAL_TIMEOUT) + { + if (remote_debug) + fputs_filtered ("Timeout in checksum, retrying\n", gdb_stdlog); + return -1; + } + else if (check_0 < 0 || check_1 < 0) + error ("Communication error in checksum"); + pktcsum = (fromhex (check_0) << 4) | fromhex (check_1); if (csum == pktcsum) return bc; -- cgit v1.1