mirror of https://github.com/mgba-emu/mgba.git
Debugger: Add callback for updating while the runloop is suspended; use for GDB
This commit is contained in:
parent
e8f8dd429e
commit
5418bb066f
1
CHANGES
1
CHANGES
|
@ -47,6 +47,7 @@ Other fixes:
|
||||||
Misc:
|
Misc:
|
||||||
- Core: Suspend runloop when a core crashes
|
- Core: Suspend runloop when a core crashes
|
||||||
- Debugger: Save and restore CLI history
|
- Debugger: Save and restore CLI history
|
||||||
|
- Debugger: GDB now works while the game is paused
|
||||||
- GB Video: Add default SGB border
|
- GB Video: Add default SGB border
|
||||||
- GBA: Automatically skip BIOS if ROM has invalid logo
|
- GBA: Automatically skip BIOS if ROM has invalid logo
|
||||||
- GBA: Refine multiboot detection (fixes mgba.io/i/2192)
|
- GBA: Refine multiboot detection (fixes mgba.io/i/2192)
|
||||||
|
|
|
@ -140,6 +140,7 @@ struct mDebugger {
|
||||||
void (*deinit)(struct mDebugger*);
|
void (*deinit)(struct mDebugger*);
|
||||||
|
|
||||||
void (*paused)(struct mDebugger*);
|
void (*paused)(struct mDebugger*);
|
||||||
|
void (*update)(struct mDebugger*);
|
||||||
void (*entered)(struct mDebugger*, enum mDebuggerEntryReason, struct mDebuggerEntryInfo*);
|
void (*entered)(struct mDebugger*, enum mDebuggerEntryReason, struct mDebuggerEntryInfo*);
|
||||||
void (*custom)(struct mDebugger*);
|
void (*custom)(struct mDebugger*);
|
||||||
};
|
};
|
||||||
|
|
|
@ -250,7 +250,15 @@ static THREAD_ENTRY _mCoreThreadRun(void* context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
while (impl->state >= mTHREAD_MIN_WAITING && impl->state <= mTHREAD_MAX_WAITING) {
|
while (impl->state >= mTHREAD_MIN_WAITING && impl->state <= mTHREAD_MAX_WAITING) {
|
||||||
ConditionWait(&impl->stateCond, &impl->stateMutex);
|
#ifdef USE_DEBUGGERS
|
||||||
|
if (debugger && debugger->update && debugger->state != DEBUGGER_SHUTDOWN) {
|
||||||
|
debugger->update(debugger);
|
||||||
|
ConditionWaitTimed(&impl->stateCond, &impl->stateMutex, 10);
|
||||||
|
} else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
ConditionWait(&impl->stateCond, &impl->stateMutex);
|
||||||
|
}
|
||||||
|
|
||||||
if (impl->sync.audioWait) {
|
if (impl->sync.audioWait) {
|
||||||
MutexUnlock(&impl->stateMutex);
|
MutexUnlock(&impl->stateMutex);
|
||||||
|
|
|
@ -1124,6 +1124,7 @@ void CLIDebuggerCreate(struct CLIDebugger* debugger) {
|
||||||
debugger->d.deinit = _cliDebuggerDeinit;
|
debugger->d.deinit = _cliDebuggerDeinit;
|
||||||
debugger->d.custom = _cliDebuggerCustom;
|
debugger->d.custom = _cliDebuggerCustom;
|
||||||
debugger->d.paused = _commandLine;
|
debugger->d.paused = _commandLine;
|
||||||
|
debugger->d.update = NULL;
|
||||||
debugger->d.entered = _reportEntry;
|
debugger->d.entered = _reportEntry;
|
||||||
debugger->d.type = DEBUGGER_CLI;
|
debugger->d.type = DEBUGGER_CLI;
|
||||||
|
|
||||||
|
|
|
@ -135,6 +135,12 @@ static void _gdbStubWait(struct mDebugger* debugger) {
|
||||||
GDBStubUpdate(stub);
|
GDBStubUpdate(stub);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void _gdbStubUpdate(struct mDebugger* debugger) {
|
||||||
|
struct GDBStub* stub = (struct GDBStub*) debugger;
|
||||||
|
stub->shouldBlock = false;
|
||||||
|
GDBStubUpdate(stub);
|
||||||
|
}
|
||||||
|
|
||||||
static void _ack(struct GDBStub* stub) {
|
static void _ack(struct GDBStub* stub) {
|
||||||
char ack = '+';
|
char ack = '+';
|
||||||
SocketSend(stub->connection, &ack, 1);
|
SocketSend(stub->connection, &ack, 1);
|
||||||
|
@ -758,6 +764,7 @@ void GDBStubCreate(struct GDBStub* stub) {
|
||||||
stub->d.init = 0;
|
stub->d.init = 0;
|
||||||
stub->d.deinit = _gdbStubDeinit;
|
stub->d.deinit = _gdbStubDeinit;
|
||||||
stub->d.paused = _gdbStubWait;
|
stub->d.paused = _gdbStubWait;
|
||||||
|
stub->d.update = _gdbStubUpdate;
|
||||||
stub->d.entered = _gdbStubEntered;
|
stub->d.entered = _gdbStubEntered;
|
||||||
stub->d.custom = _gdbStubPoll;
|
stub->d.custom = _gdbStubPoll;
|
||||||
stub->d.type = DEBUGGER_GDB;
|
stub->d.type = DEBUGGER_GDB;
|
||||||
|
|
Loading…
Reference in New Issue