debugger_dap: Ask frontend to restart xsystem35 on sysReset command

This commit is contained in:
kichikuou
2022-01-01 21:47:14 +09:00
parent 9ad1059ced
commit 3ff022c73e
6 changed files with 18 additions and 12 deletions
+10 -4
View File
@@ -81,10 +81,14 @@ static void emit_initialized_event(void) {
send_json(event);
}
static void emit_terminated_event(void) {
cJSON *event = cJSON_CreateObject();
static void emit_terminated_event(bool restart) {
cJSON *event = cJSON_CreateObject(), *body;
cJSON_AddStringToObject(event, "type", "event");
cJSON_AddStringToObject(event, "event", "terminated");
if (restart) {
cJSON_AddItemToObjectCS(event, "body", body = cJSON_CreateObject());
cJSON_AddBoolToObject(body, "restart", true);
}
send_json(event);
}
@@ -584,8 +588,10 @@ static void dbg_dap_init(const char *path) {
}
}
static void dbg_dap_quit(void) {
emit_terminated_event();
static void dbg_dap_quit(bool restart) {
emit_terminated_event(restart);
if (restart)
exit(0); // The front end will restart xsystem35, so we can just exit.
}
static void dbg_dap_repl(void) {