From 45477a3a0e8b269d4f2af52ed6c3bda6cea3cd49 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Thu, 17 Jul 2003 21:59:42 +0000 Subject: 2003-07-17 Joel Sherrill PR 433/tools * mips-stub.c: Patch from C. M. Heard described as: The purpose of the patch is to make the stub ignore all characters except '+' (ack) or '-' (nak) when it has transmitted a packet and expects an acknowledgment. Without the patch, putpacket() will retransmit each time it receives anything other than '+' when expecting an ack, and that, bitter experience has found, frequently results in the stub failing to sync up when initially attaching to gdb. I think that rtems users will notice significant improvement in the of the mips stub if this patch is incorporated in the distribution; certainly I did in my stand-aline environment. I should hasten to add that it is only an improvement and not a 100% cure for synchronization problems because '+' characters can (and do) during as message data, and it's still possible for these to be mistaken as acks. I have no idea how to fix that short of redesigning the gdb-remote protocol. --- c/src/lib/libbsp/mips/shared/gdbstub/ChangeLog | 22 ++++++++++++++++++++++ c/src/lib/libbsp/mips/shared/gdbstub/mips-stub.c | 20 +++++++++++++++++++- 2 files changed, 41 insertions(+), 1 deletion(-) (limited to 'c') diff --git a/c/src/lib/libbsp/mips/shared/gdbstub/ChangeLog b/c/src/lib/libbsp/mips/shared/gdbstub/ChangeLog index b870b2a58a..8a034fb7d4 100644 --- a/c/src/lib/libbsp/mips/shared/gdbstub/ChangeLog +++ b/c/src/lib/libbsp/mips/shared/gdbstub/ChangeLog @@ -1,3 +1,25 @@ +2003-07-17 Joel Sherrill + + PR 433/tools + * mips-stub.c: Patch from C. M. Heard described as: + + The purpose of the patch is to make the stub ignore all + characters except '+' (ack) or '-' (nak) when it has transmitted a + packet and expects an acknowledgment. Without the patch, + putpacket() will retransmit each time it receives anything other + than '+' when expecting an ack, and that, bitter experience has + found, frequently results in the stub failing to sync up when + initially attaching to gdb. + + I think that rtems users will notice significant improvement in + the of the mips stub if this patch is incorporated in the + distribution; certainly I did in my stand-aline environment. I + should hasten to add that it is only an improvement and not a 100% + cure for synchronization problems because '+' characters can (and + do) during as message data, and it's still possible for these to + be mistaken as acks. I have no idea how to fix that short of + redesigning the gdb-remote protocol. + 2002-11-01 Joel Sherrill * mips-stub.c: Removed warnings. diff --git a/c/src/lib/libbsp/mips/shared/gdbstub/mips-stub.c b/c/src/lib/libbsp/mips/shared/gdbstub/mips-stub.c index d0ef76228b..a3ce56ade3 100644 --- a/c/src/lib/libbsp/mips/shared/gdbstub/mips-stub.c +++ b/c/src/lib/libbsp/mips/shared/gdbstub/mips-stub.c @@ -598,6 +598,24 @@ getpacket (char *buffer) } +/* + * Get a positive/negative acknowledgment for a transmitted packet. + */ +static char +getAck (void) +{ + char c; + + do + { + c = getDebugChar (); + } + while ((c != '+') && (c != '-')); + + return c; +} + + /* * Send the packet in buffer and wait for a positive acknowledgement. */ @@ -644,7 +662,7 @@ putpacket (char *buffer) putDebugChar (highhex (checksum)); putDebugChar (lowhex (checksum)); } - while (getDebugChar () != '+'); + while (getAck () != '+'); } -- cgit v1.2.3