#include "command.h"
#include "replacements.h"
#include "time_support.h"
+#include <server/gdb_server.h>
#include <server/server.h>
#include <stdarg.h>
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 "
/* 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 */
free(gdb_port);
free(gdb_port_next);
}
+
+int gdb_get_actual_connections(void)
+{
+ return gdb_actual_connections;
+}
struct image;
struct reg;
#include <target/target.h>
+#include <server/server.h>
#define GDB_BUFFER_SIZE 16384
int gdb_put_packet(struct connection *connection, char *buffer, int len);
+int gdb_get_actual_connections(void);
+
static inline struct target *get_target_from_connection(struct connection *connection)
{
struct gdb_service *gdb_service = connection->service->priv;
#include <helper/binarybuffer.h>
#include <helper/log.h>
+#include <server/gdb_server.h>
#include <sys/stat.h>
/**
static int semihosting_common_fileio_end(struct target *target, int result,
int fileio_errno, bool ctrl_c);
-/* Attempts to include gdb_server.h failed. */
-extern int gdb_actual_connections;
-
/**
* Initialize common semihosting support.
*
int code = semihosting_get_field(target, 1, fields);
if (type == ADP_STOPPED_APPLICATION_EXIT) {
- if (!gdb_actual_connections)
+ if (!gdb_get_actual_connections())
exit(code);
else {
fprintf(stderr,
}
} else {
if (semihosting->param == ADP_STOPPED_APPLICATION_EXIT) {
- if (!gdb_actual_connections)
+ if (!gdb_get_actual_connections())
exit(0);
else {
fprintf(stderr,
} else if (semihosting->param == ADP_STOPPED_RUN_TIME_ERROR) {
/* Chosen more or less arbitrarily to have a nicer message,
* otherwise all other return the same exit code 1. */
- if (!gdb_actual_connections)
+ if (!gdb_get_actual_connections())
exit(1);
else {
fprintf(stderr,
"semihosting: *** application exited with error ***\n");
}
} else {
- if (!gdb_actual_connections)
+ if (!gdb_get_actual_connections())
exit(1);
else {
fprintf(stderr,
int code = semihosting_get_field(target, 1, fields);
if (type == ADP_STOPPED_APPLICATION_EXIT) {
- if (!gdb_actual_connections)
+ if (!gdb_get_actual_connections())
exit(code);
else {
fprintf(stderr,