gdb_main: Implemented a notification to GDB that the "process" has exited when the user runs a new bus scan while attached to a target

This commit is contained in:
dragonmux 2022-07-20 23:23:04 +01:00 committed by Piotr Esden-Tempski
parent c0b5f89148
commit e2f07b359a
1 changed files with 10 additions and 0 deletions

View File

@ -63,6 +63,7 @@ static char pbuf[BUF_SIZE + 1U];
static target *cur_target;
static target *last_target;
static bool gdb_needs_detach_notify = false;
static void handle_q_packet(char *packet, size_t len);
static void handle_v_packet(char *packet, size_t len);
@ -73,8 +74,10 @@ static void gdb_target_destroy_callback(struct target_controller *tc, target *t)
{
(void)tc;
if (cur_target == t) {
gdb_put_notificationz("%Stop:W00");
gdb_out("You are now detached from the previous target.\n");
cur_target = NULL;
gdb_needs_detach_notify = true;
}
if (last_target == t)
@ -650,6 +653,13 @@ static void handle_v_packet(char *packet, const size_t plen)
gdb_putpacketz(target_flash_done(cur_target) ? "EFF" : "OK");
flash_mode = 0;
} else if (!strcmp(packet, "vStopped")) {
if (gdb_needs_detach_notify) {
gdb_putpacketz("W00");
gdb_needs_detach_notify = false;
} else
gdb_putpacketz("OK");
} else {
DEBUG_GDB("*** Unsupported packet: %s\n", packet);
gdb_putpacket("", 0);