diff options
-rw-r--r-- | src/server/gdb_server.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/server/gdb_server.c b/src/server/gdb_server.c index a16b4cc..0d2d1ae 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; } @@ -348,11 +349,15 @@ static int gdb_putback_char(struct connection *connection, int last_char) static int gdb_write(struct connection *connection, void *data, int len) { struct gdb_connection *gdb_con = connection->priv; - if (gdb_con->closed) + if (gdb_con->closed) { + LOG_DEBUG("GDB socket marked as closed, cannot write to it."); return ERROR_SERVER_REMOTE_CLOSED; + } if (connection_write(connection, data, len) == len) return ERROR_OK; + + LOG_WARNING("Error writing to GDB socket. Dropping the connection."); gdb_con->closed = true; return ERROR_SERVER_REMOTE_CLOSED; } @@ -1351,7 +1356,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; } @@ -1413,7 +1418,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; |