debugger_dap: Fail to Initialize if debug symbol file is not available

This commit is contained in:
kichikuou
2021-11-06 12:06:57 +09:00
parent 4832b0ab84
commit fd4c8fb4d3
4 changed files with 12 additions and 5 deletions
+1 -2
View File
@@ -46,9 +46,8 @@ static struct {
void dbg_init(const char *symbols_path, boolean use_dap) {
dbg_impl = use_dap ? &dbg_dap_impl : &dbg_cui_impl;
dbg_impl->init();
dbg_impl->init(symbols_path);
dbg_state = DBG_STOPPED_ENTRY;
symbols = dsym_load(symbols_path);
}
void dbg_quit() {
+2 -1
View File
@@ -323,7 +323,8 @@ static void sigint_handler(int sig_num) {
dbg_state = DBG_STOPPED_INTERRUPT;
}
static void dbg_cui_init(void) {
static void dbg_cui_init(const char *symbols_path) {
symbols = dsym_load(symbols_path);
#ifdef HAVE_SIGACTION
sys_set_signalhandler(SIGINT, sigint_handler);
#endif
+8 -1
View File
@@ -112,6 +112,11 @@ static void emit_output_event(const char *output) {
}
static void cmd_initialize(cJSON *args, cJSON *resp) {
if (!symbols) {
cJSON_AddBoolToObject(resp, "success", false);
cJSON_AddStringToObject(resp, "message", "xsystem35: Cannot load debug symbols");
return;
}
cJSON *body;
cJSON_AddBoolToObject(resp, "success", true);
cJSON_AddItemToObjectCS(resp, "body", body = cJSON_CreateObject());
@@ -555,7 +560,7 @@ static int read_command_thread(void *data) {
return 0;
}
static void dbg_dap_init(void) {
static void dbg_dap_init(const char *symbols_path) {
cmd_queue.mutex = SDL_CreateMutex();
cmd_queue.cond_nonempty = SDL_CreateCond();
@@ -566,6 +571,8 @@ static void dbg_dap_init(void) {
SDL_CreateThread(read_command_thread, "Debugger", NULL);
symbols = dsym_load(symbols_path);
while (!initialized) {
char *msg = cmdq_dequeue();
if (!msg)
+1 -1
View File
@@ -48,7 +48,7 @@ typedef struct {
} StackTrace;
typedef struct {
void (*init)(void);
void (*init)(const char *symbols_path);
void (*quit)(void);
void (*repl)(void);
void (*onsleep)(void);