Enter debugger REPL on middle-button click

This is effective only if --debug command line flag is specified.
This commit is contained in:
kichikuou
2023-01-02 21:10:58 +09:00
parent ca982221f7
commit 64a92a2ffa
4 changed files with 9 additions and 5 deletions
+1
View File
@@ -46,6 +46,7 @@ struct dbg_cmd {
};
extern bool dbg_enabled;
extern bool dbg_start_in_debugger;
extern unsigned dbg_current_frame;
void dbg_init(void);
+1
View File
@@ -37,6 +37,7 @@
#include "xsystem4.h"
bool dbg_enabled = true;
bool dbg_start_in_debugger = false;
unsigned dbg_current_frame = 0;
static jmp_buf dbg_continuation;
+5
View File
@@ -23,6 +23,7 @@
#include "input.h"
#include "scene.h"
#include "vm.h"
#include "debugger.h"
#ifndef M_PI
#define M_PI (3.14159265358979323846)
@@ -217,6 +218,10 @@ static void mouse_event(SDL_MouseButtonEvent *e)
enum sact_keycode code = sdl_to_sact_button(e->button);
if (code)
key_state[code] = e->state == SDL_PRESSED;
#ifdef DEBUGGER_ENABLED
if (e->button == SDL_BUTTON_MIDDLE && e->state == SDL_PRESSED && dbg_start_in_debugger)
dbg_repl();
#endif
}
#define JOYAXIS_DEADZONE 13500
+2 -5
View File
@@ -402,9 +402,6 @@ int main(int argc, char *argv[])
char *ainfile;
int err = AIN_SUCCESS;
bool audit = false;
#ifdef DEBUGGER_ENABLED
bool start_in_debugger = false;
#endif
char *font_mincho = NULL;
char *font_gothic = NULL;
@@ -482,7 +479,7 @@ int main(int argc, char *argv[])
dbg_enabled = false;
break;
case LOPT_DEBUG:
start_in_debugger = true;
dbg_start_in_debugger = true;
break;
#endif
}
@@ -548,7 +545,7 @@ int main(int argc, char *argv[])
#ifdef DEBUGGER_ENABLED
dbg_init();
if (start_in_debugger)
if (dbg_start_in_debugger)
dbg_repl();
#endif