blackmagic-debug / blackmagic

In application debugger for ARM Cortex microcontrollers.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to recover from loss-of-target without `abort()`

xobs opened this issue · comments

It is not possible to recover from the loss of a target.

When a target is lost, an exception is raised. The target list is then freed:

blackmagic/src/main.c

Lines 87 to 92 in e4da644

if (e.type) {
gdb_putpacketz("EFF");
target_list_free();
gdb_outf("Uncaught exception: %s\n", e.msg);
morse("TARGET LOST.", true);
}

The problem comes from the fact that target_list_free() is not contained within a try {} block. If there is still a target attached it will attempt to do various things such as resetting breakpoints on the target which no longer exists which will raise another exception and cause a reboot.