mirror of
https://github.com/kichikuou/xsystem35-sdl2.git
synced 2026-09-22 22:48:08 +03:00
debugger_dap: Ask frontend to restart xsystem35 on sysReset command
This commit is contained in:
+2
-2
@@ -51,9 +51,9 @@ void dbg_init(const char *symbols_path, boolean use_dap) {
|
||||
dbg_impl->init(symbols_path);
|
||||
}
|
||||
|
||||
void dbg_quit() {
|
||||
void dbg_quit(bool restart) {
|
||||
if (dbg_impl)
|
||||
dbg_impl->quit();
|
||||
dbg_impl->quit(restart);
|
||||
}
|
||||
|
||||
int dbg_lookup_var(const char *name) {
|
||||
|
||||
+2
-2
@@ -42,7 +42,7 @@ extern DebuggerState dbg_state;
|
||||
|
||||
#define dbg_trapped() (dbg_state != DBG_RUNNING)
|
||||
void dbg_init(const char *symbols_path, boolean use_dap);
|
||||
void dbg_quit();
|
||||
void dbg_quit(bool restart);
|
||||
void dbg_main(void);
|
||||
void dbg_onsleep(void);
|
||||
BYTE dbg_handle_breakpoint(int page, int addr);
|
||||
@@ -52,7 +52,7 @@ boolean dbg_console_vprintf(int lv, const char *format, va_list ap);
|
||||
|
||||
#define dbg_trapped() false
|
||||
#define dbg_init(symbols_path, use_dap)
|
||||
#define dbg_quit()
|
||||
#define dbg_quit(restart)
|
||||
#define dbg_main()
|
||||
#define dbg_onsleep()
|
||||
#define dbg_handle_breakpoint(page, addr) BREAKPOINT
|
||||
|
||||
+1
-1
@@ -348,7 +348,7 @@ static void dbg_cui_init(const char *symbols_path) {
|
||||
dbg_state = DBG_STOPPED_ENTRY;
|
||||
}
|
||||
|
||||
static void dbg_cui_quit(void) {
|
||||
static void dbg_cui_quit(bool restart) {
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
|
||||
+10
-4
@@ -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) {
|
||||
|
||||
@@ -50,7 +50,7 @@ typedef struct {
|
||||
|
||||
typedef struct {
|
||||
void (*init)(const char *symbols_path);
|
||||
void (*quit)(void);
|
||||
void (*quit)(bool restart);
|
||||
void (*repl)(void);
|
||||
void (*onsleep)(void);
|
||||
void (*console_output)(int lv, const char *output);
|
||||
|
||||
+2
-2
@@ -237,7 +237,7 @@ static void sys35_init() {
|
||||
}
|
||||
|
||||
static void sys35_remove() {
|
||||
dbg_quit();
|
||||
dbg_quit(false);
|
||||
mus_exit();
|
||||
ags_remove();
|
||||
#ifdef ENABLE_GTK
|
||||
@@ -251,7 +251,7 @@ void sys_reset() {
|
||||
#ifdef ENABLE_GTK
|
||||
s39ini_remove();
|
||||
#endif
|
||||
|
||||
dbg_quit(true); // This may exit().
|
||||
execvp(saved_argv[0], saved_argv);
|
||||
sys_error("exec fail");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user