/* 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 */
static int gdb_last_signal(struct target *target)
{
+ LOG_TARGET_DEBUG(target, "Debug reason is: %s",
+ target_debug_reason_str(target->debug_reason));
+
switch (target->debug_reason) {
case DBG_REASON_DBGRQ:
return 0x2; /* SIGINT */
case DBG_REASON_NOTHALTED:
return 0x0; /* no signal... shouldn't happen */
default:
- LOG_USER("undefined debug reason %d - target needs reset",
- target->debug_reason);
+ LOG_USER("undefined debug reason %d (%s) - target needs reset",
+ target->debug_reason,
+ target_debug_reason_str(target->debug_reason));
return 0x0;
}
}
}
if (gdb_connection->ctrl_c) {
+ LOG_TARGET_DEBUG(target, "Responding with signal 2 (SIGINT) to debugger due to Ctrl-C");
signal_var = 0x2;
} else
signal_var = gdb_last_signal(ct);
return ERROR_OK;
}
-static bool gdb_handle_vcont_packet(struct connection *connection, const char *packet, int packet_size)
+static bool gdb_handle_vcont_packet(struct connection *connection, const char *packet,
+ __attribute__((unused)) int packet_size)
{
struct gdb_connection *gdb_connection = connection->priv;
struct target *target = get_target_from_connection(connection);
if (parse[0] == ';') {
++parse;
- --packet_size;
}
/* simple case, a continue packet */
int current_pc = 1;
int64_t thread_id;
parse++;
- packet_size--;
if (parse[0] == ':') {
char *endp;
parse++;
- packet_size--;
thread_id = strtoll(parse, &endp, 16);
if (endp) {
- packet_size -= endp - parse;
parse = endp;
}
} else {
if (parse[0] == ';') {
++parse;
- --packet_size;
if (parse[0] == 'c') {
parse += 1;
free(gdb_port);
free(gdb_port_next);
}
+
+int gdb_get_actual_connections(void)
+{
+ return gdb_actual_connections;
+}