Skip to content

Commit

Permalink
gdb_server: drop useless check in gdb_keep_client_alive()
Browse files Browse the repository at this point in the history
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
  • Loading branch information
borneoa committed Mar 24, 2024
1 parent 0c02432 commit 35e4c46
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/server/gdb_server.c
Expand Up @@ -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.
Expand Down Expand Up @@ -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 */
Expand Down

0 comments on commit 35e4c46

Please sign in to comment.