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

@@ -117,7 +117,7 @@ static void gdb_sig_halted(struct connection *connection);
/* number of gdb connections, mainly to suppress gdb related debugging spam
* in helper/log.c when no gdb connections are actually active */
int gdb_actual_connections;
static int gdb_actual_connections;
/* set if we are sending a memory map to gdb
* via qXfer:memory-map:read packet */
@@ -4105,3 +4105,8 @@ void gdb_service_free(void)
free(gdb_port);
free(gdb_port_next);
}
int gdb_get_actual_connections(void)
{
return gdb_actual_connections;
}