This is an automated email from Gerrit.

Anton Kolesov (anton.kole...@synopsys.com) just uploaded a new patch set to 
Gerrit, which you can find at http://openocd.zylin.com/1895

-- gerrit

commit ab0f765e2f677e73065b75ffee14473a8c1a9118
Author: Anton Kolesov <anton.kole...@synopsys.com>
Date:   Wed Jan 22 20:18:56 2014 +0400

    gdb_servser: Fix confusing warning when entering noack mode
    
    Comment in gdb_server code mistakingly attributed constant warnings
    about unexpected acknowledgment to the ACK packet sent by GDB when
    establishing connection. However that is not the case, OpenOCD
    gdb_server is handling this packet correctly without an warnings. This
    warning instead was caused by the ACK packet which GDB sends right after
    going into noack mode. Because OpenOCD gdb_server is already in noack
    mode at this state, it emits warning about it. This is a documented GDB
    behavior
    (https://sourceware.org/gdb/onlinedocs/gdb/Packet-Acknowledgment.html)
    so there is no reason to scare users with warnings in this case.
    
    This patch basically introduces two-level noack mode: after receiving
    QStartNoAckMode gdb_server will set noack_mode to 1, then it will
    receive this last ACK packet, but instead of printing a warning,
    noack_mode will be increased to 2. Should there be any other ACK packets
    after that, they will be properly reported by warning. All other code
    that relies on noack_mode checks it for "!= 0", so there will be no
    difference if it is 1 or 2.
    
    Change-Id: I0e9c57fd93293bfe010390db2f3f161528b11d86
    Signed-off-by: Anton Kolesov <anton.kole...@synopsys.com>

diff --git a/src/server/gdb_server.c b/src/server/gdb_server.c
index 91016e4..e13298c 100644
--- a/src/server/gdb_server.c
+++ b/src/server/gdb_server.c
@@ -617,11 +617,21 @@ static int gdb_get_packet_inner(struct connection 
*connection,
                                case '$':
                                        break;
                                case '+':
-                                       /* gdb sends a dummy ack '+' at every 
remote connect - see
-                                        * remote_start_remote (remote.c)
-                                        * in case anyone tries to debug why 
they receive this
-                                        * warning every time */
-                                       LOG_WARNING("acknowledgment received, 
but no packet pending");
+                                       /* According to the GDB documentation
+                                        * 
(https://sourceware.org/gdb/onlinedocs/gdb/Packet-Acknowledgment.html):
+                                        * "gdb sends a final `+` 
acknowledgment of the stub's `OK`
+                                        * response, which can be safely 
ignored by the stub."
+                                        * However OpenOCD server already is in 
noack mode at this
+                                        * point and instead of ignoring this 
it was emitting a
+                                        * warning. This code makes server 
ignore the first ACK
+                                        * that will be received after going 
into noack mode,
+                                        * warning only about subsequent ACK's. 
*/
+                                       if (gdb_con->noack_mode > 1) {
+                                               LOG_WARNING("acknowledgment 
received, but no packet pending");
+                                       } else {
+                                               LOG_DEBUG("Received first 
acknowledgment after entering noack mode. Ignoring it.");
+                                               gdb_con->noack_mode = 2;
+                                       }
                                        break;
                                case '-':
                                        LOG_WARNING("negative acknowledgment, 
but no packet pending");

-- 

------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
OpenOCD-devel mailing list
OpenOCD-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to