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
This commit is contained in:
parent
f735faa931
commit
b1de116160
|
@ -227,6 +227,7 @@ static int gdb_get_char_inner(struct connection *connection, int *next_char)
|
||||||
if (gdb_con->buf_cnt > 0)
|
if (gdb_con->buf_cnt > 0)
|
||||||
break;
|
break;
|
||||||
if (gdb_con->buf_cnt == 0) {
|
if (gdb_con->buf_cnt == 0) {
|
||||||
|
LOG_DEBUG("GDB connection closed by the remote client");
|
||||||
gdb_con->closed = true;
|
gdb_con->closed = true;
|
||||||
return ERROR_SERVER_REMOTE_CLOSED;
|
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)
|
static int gdb_write(struct connection *connection, void *data, int len)
|
||||||
{
|
{
|
||||||
struct gdb_connection *gdb_con = connection->priv;
|
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;
|
return ERROR_SERVER_REMOTE_CLOSED;
|
||||||
|
}
|
||||||
|
|
||||||
if (connection_write(connection, data, len) == len)
|
if (connection_write(connection, data, len) == len)
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
|
|
||||||
|
LOG_WARNING("Error writing to GDB socket. Dropping the connection.");
|
||||||
gdb_con->closed = true;
|
gdb_con->closed = true;
|
||||||
return ERROR_SERVER_REMOTE_CLOSED;
|
return ERROR_SERVER_REMOTE_CLOSED;
|
||||||
}
|
}
|
||||||
|
@ -1351,7 +1356,7 @@ static int gdb_get_register_packet(struct connection *connection,
|
||||||
return gdb_error(connection, retval);
|
return gdb_error(connection, retval);
|
||||||
|
|
||||||
if (reg_list_size <= reg_num) {
|
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;
|
return ERROR_SERVER_REMOTE_CLOSED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1413,7 +1418,7 @@ static int gdb_set_register_packet(struct connection *connection,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (reg_list_size <= reg_num) {
|
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(bin_buf);
|
||||||
free(reg_list);
|
free(reg_list);
|
||||||
return ERROR_SERVER_REMOTE_CLOSED;
|
return ERROR_SERVER_REMOTE_CLOSED;
|
||||||
|
|
Loading…
Reference in New Issue