mirror of
https://github.com/kichikuou/xsystem35-sdl2.git
synced 2026-10-07 06:07:57 +03:00
Add support for Debug Adapter Protocol
If -debug_dap flag is given, xsystem35 speaks the Debug Adapter Protocol (https://microsoft.github.io/debug-adapter-protocol/) via stdin/stdout. This enables xsystem35 to work as a backend of VS Code's Debugger (and possibly other debuggers that support DAP).
This commit is contained in:
+17
-2
@@ -315,7 +315,7 @@ static void sigint_handler(int sig_num) {
|
||||
dbg_state = DBG_STOPPED_INTERRUPT;
|
||||
}
|
||||
|
||||
void dbg_cui_init(void) {
|
||||
static void dbg_cui_init(void) {
|
||||
#ifdef HAVE_SIGACTION
|
||||
sys_set_signalhandler(SIGINT, sigint_handler);
|
||||
#endif
|
||||
@@ -325,6 +325,9 @@ void dbg_cui_init(void) {
|
||||
#endif
|
||||
}
|
||||
|
||||
static void dbg_cui_quit(void) {
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
const char *name;
|
||||
const char *alias;
|
||||
@@ -379,7 +382,7 @@ static CommandResult cmd_help(void) {
|
||||
return CONTINUE_REPL;
|
||||
}
|
||||
|
||||
void dbg_cui_repl(void) {
|
||||
static void dbg_cui_repl(void) {
|
||||
if (dbg_state == DBG_STOPPED_BREAKPOINT) {
|
||||
Breakpoint *bp = dbg_find_breakpoint(nact->current_page, nact->current_addr);
|
||||
if (bp)
|
||||
@@ -408,3 +411,15 @@ void dbg_cui_repl(void) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void dbg_cui_onsleep(void) {
|
||||
if (dbg_state == DBG_STOPPED_INTERRUPT)
|
||||
dbg_main();
|
||||
}
|
||||
|
||||
DebuggerImpl dbg_cui_impl = {
|
||||
.init = dbg_cui_init,
|
||||
.quit = dbg_cui_quit,
|
||||
.repl = dbg_cui_repl,
|
||||
.onsleep = dbg_cui_onsleep,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user