aboutsummaryrefslogtreecommitdiff
path: root/gdb/remote.c
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2000-08-24 10:48:22 +0000
committerAndrew Cagney <cagney@redhat.com>2000-08-24 10:48:22 +0000
commite1b09194cb4a30d662749d98b0e80ee9222ab090 (patch)
tree31b81291b030774869b6a5951871d3f4c3e11e5b /gdb/remote.c
parent6dd8c765d3c328fb2b86fcf2afa9efaf9a235470 (diff)
downloadgdb-e1b09194cb4a30d662749d98b0e80ee9222ab090.zip
gdb-e1b09194cb4a30d662749d98b0e80ee9222ab090.tar.gz
gdb-e1b09194cb4a30d662749d98b0e80ee9222ab090.tar.bz2
2000-08-20 Michael Chastain <chastain@redhat.com>
* remote.c (read_frame): Handle SERIAL_TIMEOUT while reading checksum.
Diffstat (limited to 'gdb/remote.c')
-rw-r--r--gdb/remote.c17
1 files changed, 15 insertions, 2 deletions
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;