From: OpenOCD-Gerrit <ope...@us...> - 2021-12-03 22:00:44
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via b1de11616099fe97f3534fa0f268c10dfd6ecf2b (commit) from f735faa9319af324b94e4257444419c8dfec6592 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit b1de11616099fe97f3534fa0f268c10dfd6ecf2b Author: Jan Matyas <ma...@co...> 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 <ma...@co...> Reviewed-on: https://review.openocd.org/c/openocd/+/6288 Reviewed-by: Tim Newsome <ti...@si...> Reviewed-by: Antonio Borneo <bor...@gm...> Tested-by: jenkins diff --git a/src/server/gdb_server.c b/src/server/gdb_server.c index a16b4ccbe..0d2d1ae2c 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; ----------------------------------------------------------------------- Summary of changes: src/server/gdb_server.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) hooks/post-receive -- Main OpenOCD repository |