gdb_server: fix a comment in gdb_new_connection() 69/6769/3
authorAntonio Borneo <borneo.antonio@gmail.com>
Sat, 4 Dec 2021 17:38:56 +0000 (18:38 +0100)
committerAntonio Borneo <borneo.antonio@gmail.com>
Sat, 18 Dec 2021 17:26:36 +0000 (17:26 +0000)
On 2008-03-05, before git's age, commit 6d9501467441 adds a
comment about unobserved ACK supposedly sent by GDB at connection.

The ACK is sent since GDB 3.95 (1999-05-04), but a bug introduced
in GDB 6.5 (2006-06-21) and fixed in GDB 7.0 (2009-10-06) makes
GDB sending the query for "supported packets" before sending the
ACK. Due to the bug, the author of the commit failed to see the
ACK.

Change-Id: I574a8013e7d159d1c71087af83b7c2ce92be86bd
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6769
Tested-by: jenkins
src/server/gdb_server.c

index 0d2d1ae2c307eb18ec3321e59c18b31b65d70e75..7c853730f7ac75f055f6b761880fa8f79db2d126 100644 (file)
@@ -1006,16 +1006,19 @@ static int gdb_new_connection(struct connection *connection)
        breakpoint_clear_target(target);
        watchpoint_clear_target(target);
 
-       /* remove the initial ACK from the incoming buffer */
+       /* Since version 3.95 (gdb-19990504), with the exclusion of 6.5~6.8, GDB
+        * sends an ACK at connection with the following comment in its source code:
+        * "Ack any packet which the remote side has already sent."
+        * LLDB does the same since the first gdb-remote implementation.
+        * Remove the initial ACK from the incoming buffer.
+        */
        retval = gdb_get_char(connection, &initial_ack);
        if (retval != ERROR_OK)
                return retval;
 
-       /* FIX!!!??? would we actually ever receive a + here???
-        * Not observed.
-        */
        if (initial_ack != '+')
                gdb_putback_char(connection, initial_ack);
+
        target_call_event_callbacks(target, TARGET_EVENT_GDB_ATTACH);
 
        if (target->rtos) {

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)