Fix infinite hang if GDB client kills gdbstub

This commit is contained in:
Ian Chamberlain 2023-03-31 14:06:43 -04:00
parent 83138e0c63
commit 351730d585
No known key found for this signature in database
GPG Key ID: AE5484D09405AA60
1 changed files with 5 additions and 2 deletions

View File

@ -1066,12 +1066,15 @@ void HandlePacket() {
SendSignal(current_thread, latest_signal); SendSignal(current_thread, latest_signal);
break; break;
case 'k': case 'k':
Shutdown(); ToggleServer(false);
// Continue execution so we don't hang forever after shutting down the
// server
Continue();
LOG_INFO(Debug_GDBStub, "killed by gdb"); LOG_INFO(Debug_GDBStub, "killed by gdb");
return; return;
case 'F': case 'F':
if (HandleHioReply(command_buffer, command_length)) { if (HandleHioReply(command_buffer, command_length)) {
// TODO: technically if we were paused when the reply came in, we // TODO: technically if we were paused when the request came in, we
// shouldn't continue here. Could recurse back into HandlePacket() maybe?? // shouldn't continue here. Could recurse back into HandlePacket() maybe??
Continue(); Continue();
} else { } else {