aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntonio Borneo <borneo.antonio@gmail.com>2024-02-25 23:03:27 +0100
committerAntonio Borneo <borneo.antonio@gmail.com>2024-03-24 13:40:27 +0000
commit35e4c4616f5a924313e85290f56f84f7a8534801 (patch)
treea4f831896c169e992cce57c799512bb6fa24cef4
parent0c0243228cb958b7c12c2e5a81c84d35734fce25 (diff)
downloadriscv-openocd-35e4c4616f5a924313e85290f56f84f7a8534801.zip
riscv-openocd-35e4c4616f5a924313e85290f56f84f7a8534801.tar.gz
riscv-openocd-35e4c4616f5a924313e85290f56f84f7a8534801.tar.bz2
gdb_server: drop useless check in gdb_keep_client_alive()
OpenOCD can send it's log to gdb, and gdb replies with 'OK'. Calls to LOG_XXX() are also present in the code that communicates with gdb. This can cause infinite nested calls. OpenOCD uses the flag 'gdb_con->busy' to protect the communication with gdb and prevent nested calls. There is no reason to check for 'gdb_con->busy' in the code for keep-alive, as keep_alive() is never called in this gdb server; the flag would eventually be set if the current keep_alive() will send something to gdb. Drop the flag 'gdb_con->busy' in gdb_keep_client_alive(). While there, document the use of 'gdb_con->busy'. Change-Id: I1ea20bf96abb5d2f1fcdba1e3861df257c396bb6 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/8166 Tested-by: jenkins
-rw-r--r--src/server/gdb_server.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/server/gdb_server.c b/src/server/gdb_server.c
index 00e43cf..c1ee4aa 100644
--- a/src/server/gdb_server.c
+++ b/src/server/gdb_server.c
@@ -73,6 +73,8 @@ struct gdb_connection {
enum target_state frontend_state;
struct image *vflash_image;
bool closed;
+ /* set to prevent re-entrance from log messages during gdb_get_packet()
+ * and gdb_put_packet(). */
bool busy;
int noack_mode;
/* set flag to true if you want the next stepi to return immediately.
@@ -3794,11 +3796,6 @@ static void gdb_keep_client_alive(struct connection *connection)
{
struct gdb_connection *gdb_con = connection->priv;
- if (gdb_con->busy) {
- /* do not send packets, retry asap */
- return;
- }
-
switch (gdb_con->output_flag) {
case GDB_OUTPUT_NO:
/* no need for keep-alive */