aboutsummaryrefslogtreecommitdiff
path: root/src/server
diff options
context:
space:
mode:
authorJan Matyas <matyas@codasip.com>2021-06-03 17:13:41 +0200
committerAntonio Borneo <borneo.antonio@gmail.com>2021-12-03 22:00:19 +0000
commitb1de11616099fe97f3534fa0f268c10dfd6ecf2b (patch)
treec69deda48ff104bd2bd8dba344e3b4d81ff79b5b /src/server
parentf735faa9319af324b94e4257444419c8dfec6592 (diff)
downloadriscv-openocd-b1de11616099fe97f3534fa0f268c10dfd6ecf2b.zip
riscv-openocd-b1de11616099fe97f3534fa0f268c10dfd6ecf2b.tar.gz
riscv-openocd-b1de11616099fe97f3534fa0f268c10dfd6ecf2b.tar.bz2
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 <matyas@codasip.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6288 Reviewed-by: Tim Newsome <tim@sifive.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins
Diffstat (limited to 'src/server')
-rw-r--r--src/server/gdb_server.c11
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;