This is an automated email from Gerrit.

Jan Matyas ([email protected]) just uploaded a new patch set to Gerrit, which 
you can find at http://openocd.zylin.com/6288

-- gerrit

commit 3e1d95e8bb97618701aaf573d25d17ebea200a3c
Author: Jan Matyas <[email protected]>
Date:   Thu Jun 3 17:13:41 2021 +0200

    gdb_server: added and improved several debug prints
    
    Added and improved several prints related to the GDB connection
    and various error states that may occur in relation to this
    connection.
    
    Change-Id: I233246190b613cc925b783561cfa3aa5267360fd
    Signed-off-by: Jan Matyas <[email protected]>

diff --git a/src/server/gdb_server.c b/src/server/gdb_server.c
index 00c04e3..e8c804a 100644
--- a/src/server/gdb_server.c
+++ b/src/server/gdb_server.c
@@ -227,6 +227,7 @@ static int gdb_get_char_inner(struct connection 
*connection, int *next_char)
                if (gdb_con->buf_cnt > 0)
                        break;
                if (gdb_con->buf_cnt == 0) {
+                       LOG_DEBUG("GDB connection closed by the remote client");
                        gdb_con->closed = true;
                        return ERROR_SERVER_REMOTE_CLOSED;
                }
@@ -351,8 +352,12 @@ static int gdb_write(struct connection *connection, void 
*data, int len)
        if (gdb_con->closed)
                return ERROR_SERVER_REMOTE_CLOSED;
 
-       if (connection_write(connection, data, len) == len)
+       if (connection_write(connection, data, len) == len) {
+               LOG_DEBUG("GDB socket marked as closed, cannot write to it.");
                return ERROR_OK;
+       }
+
+       LOG_WARNING("Error writing to GDB socket. Dropping the connection.");
        gdb_con->closed = true;
        return ERROR_SERVER_REMOTE_CLOSED;
 }
@@ -1319,7 +1324,7 @@ static int gdb_get_register_packet(struct connection 
*connection,
                return gdb_error(connection, retval);
 
        if (reg_list_size <= reg_num) {
-               LOG_ERROR("gdb requested a non-existing register");
+               LOG_ERROR("gdb requested a non-existing register (reg_num=%d)", 
reg_num);
                return ERROR_SERVER_REMOTE_CLOSED;
        }
 
@@ -1381,7 +1386,7 @@ static int gdb_set_register_packet(struct connection 
*connection,
        }
 
        if (reg_list_size <= reg_num) {
-               LOG_ERROR("gdb requested a non-existing register");
+               LOG_ERROR("gdb requested a non-existing register (reg_num=%d)", 
reg_num);
                free(bin_buf);
                free(reg_list);
                return ERROR_SERVER_REMOTE_CLOSED;

-- 

Reply via email to