server: gdb: export gdb_actual_connections through a function

The internal variable 'gdb_actual_connections' is used by log and
by semihosting to determine if there are active GDB connections.

Keep the variable local in server's code and only export its value
through a dedicated function.

This solves the issue detected by 'parse' of the variable defined
as global but not declared in any include file.

Change-Id: I6e14f4cb1097787404094636f8a2a291340222dd
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7673
Tested-by: jenkins
This commit is contained in:
Antonio Borneo
2023-05-06 21:59:31 +02:00
parent 7fa29dc519
commit d5c177cd3d
4 changed files with 17 additions and 12 deletions

View File

@@ -19,6 +19,7 @@
#include "command.h"
#include "replacements.h"
#include "time_support.h"
#include <server/gdb_server.h>
#include <server/server.h>
#include <stdarg.h>
@@ -399,9 +400,7 @@ char *alloc_printf(const char *format, ...)
static void gdb_timeout_warning(int64_t delta_time)
{
extern int gdb_actual_connections;
if (gdb_actual_connections)
if (gdb_get_actual_connections())
LOG_WARNING("keep_alive() was not invoked in the "
"%d ms timelimit. GDB alive packet not "
"sent! (%" PRId64 " ms). Workaround: increase "