mirror of https://github.com/mgba-emu/mgba.git
Install SIGINT signal handler for debugger
This commit is contained in:
parent
0b468a9db8
commit
0ba7451e3a
|
@ -30,6 +30,8 @@ struct DebugBreakpoint {
|
|||
|
||||
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*);
|
||||
|
@ -44,6 +46,8 @@ 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;
|
||||
DebuggerComamnd* command;
|
||||
|
@ -217,6 +221,11 @@ static void _checkBreakpoints(struct ARMDebugger* debugger) {
|
|||
}
|
||||
}
|
||||
|
||||
static void _breakIntoDefault(int signal) {
|
||||
(void)(signal);
|
||||
_activeDebugger->state = DEBUGGER_PAUSED;
|
||||
}
|
||||
|
||||
enum _DVParseState {
|
||||
PARSE_ERROR = -1,
|
||||
PARSE_ROOT = 0,
|
||||
|
@ -523,6 +532,8 @@ void ARMDebuggerInit(struct ARMDebugger* debugger, struct ARMCore* cpu) {
|
|||
debugger->state = DEBUGGER_PAUSED;
|
||||
debugger->lastCommand = 0;
|
||||
debugger->breakpoints = 0;
|
||||
_activeDebugger = debugger;
|
||||
signal(SIGINT, _breakIntoDefault);
|
||||
}
|
||||
|
||||
void ARMDebuggerRun(struct ARMDebugger* debugger) {
|
||||
|
|
Loading…
Reference in New Issue