Debugger: Fix interrupt after continue from GDB stub

GDB and LLDB will send a ctrl-c character (\x03) to the stub
to interrupt it after a continue where it doesn't stop on its own.

E.g.
```
void foo() {
  foo2();      // Continue from here.
  while (1) {} // Loops here until ctrl-c in the debugger.
}
```

mGBA had code to handle the ctrl-c but because in _continue
we set the paused status after calling mDebuggerModuleSetNeedsCallback,
the callback was never set so nothing was looking for new messages
while we were running. We should instead set the paused state then call
mDebuggerModuleSetNeedsCallback.

mDebuggerModuleSetNeedsCallback calls mDebuggerUpdatePaused, and all
other calls to mDebuggerUpdatePaused update the paused state before
that call so this matches existing usage of that too.

With this fix, after the continue _gdbStubPoll is called periodically
and will pick up the ctrl-c as it comes in (_gdbStubWait is used when
we are stopped in the debugger).

This fixes ctrl-c to interrupt when using lldb and gdb.
This commit is contained in:
David Spickett 2023-10-04 16:05:40 +01:00 committed by Vicki Pfau
parent 46f59df10a
commit ef7edba159
1 changed files with 1 additions and 1 deletions

View File

@ -247,9 +247,9 @@ static void _writeHostInfo(struct GDBStub* stub) {
}
static void _continue(struct GDBStub* stub, const char* message) {
mDebuggerModuleSetNeedsCallback(&stub->d);
stub->untilPoll = GDB_STUB_INTERVAL;
stub->d.isPaused = false;
mDebuggerModuleSetNeedsCallback(&stub->d);
// TODO: parse message
UNUSED(message);
}