gdb_server: add debug signal reason prints

Added debug prints to show what is the target debug reason. Also added
debug print for Ctrl-C response. This is useful for troubleshooting and
log analysis.

Change-Id: I055936257d989efe7255656198a8d73a367fcd15
Signed-off-by: Marek Vrbka <marek.vrbka@codasip.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7720
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
This commit is contained in:
Marek Vrbka
2023-05-29 14:41:34 +02:00
committed by Antonio Borneo
parent 370bf43fb1
commit 0854c83076
3 changed files with 35 additions and 2 deletions

View File

@@ -145,6 +145,9 @@ static char gdb_running_type;
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 */
@@ -159,8 +162,9 @@ static int gdb_last_signal(struct target *target)
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;
}
}
@@ -798,6 +802,7 @@ static void gdb_signal_reply(struct target *target, struct connection *connectio
}
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);