all repos — mgba @ 0ba7451e3a0a5b6a1d88a39c79bd13f462ee1a4b

mGBA Game Boy Advance Emulator

Install SIGINT signal handler for debugger
Jeffrey Pfau jeffrey@endrift.com
Thu, 18 Apr 2013 01:52:46 -0700
commit

0ba7451e3a0a5b6a1d88a39c79bd13f462ee1a4b

parent

0b468a9db8e7b89c7da1786a4c360d55db049bb8

1 files changed, 11 insertions(+), 0 deletions(-)

jump to
M src/debugger/debugger.csrc/debugger/debugger.c

@@ -30,6 +30,8 @@ };

static const char* ERROR_MISSING_ARGS = "Arguments missing"; +static struct ARMDebugger* _activeDebugger; + typedef void (DebuggerComamnd)(struct ARMDebugger*, struct DebugVector*); static void _breakInto(struct ARMDebugger*, struct DebugVector*);

@@ -43,6 +45,8 @@ static void _readByte(struct ARMDebugger*, struct DebugVector*);

static void _readHalfword(struct ARMDebugger*, struct DebugVector*); static void _readWord(struct ARMDebugger*, struct DebugVector*); static void _setBreakpoint(struct ARMDebugger*, struct DebugVector*); + +static void _breakIntoDefault(int signal); struct { const char* name;

@@ -215,6 +219,11 @@ printf("Hit breakpoint\n");

break; } } +} + +static void _breakIntoDefault(int signal) { + (void)(signal); + _activeDebugger->state = DEBUGGER_PAUSED; } enum _DVParseState {

@@ -523,6 +532,8 @@ debugger->cpu = cpu;

debugger->state = DEBUGGER_PAUSED; debugger->lastCommand = 0; debugger->breakpoints = 0; + _activeDebugger = debugger; + signal(SIGINT, _breakIntoDefault); } void ARMDebuggerRun(struct ARMDebugger* debugger) {