Handled GDB exceptions in TargetExecutionStopped event handler, to prevent them from propagating to the DebugServerComponent::run() and causing Bloom to shutdown.

This commit is contained in:
Nav
2022-04-16 21:21:29 +01:00
parent 3f368b10e7
commit b05b3454e9

View File

@@ -304,11 +304,30 @@ namespace Bloom::DebugServer::Gdb
} }
void GdbRspDebugServer::onTargetExecutionStopped(const Events::TargetExecutionStopped&) { void GdbRspDebugServer::onTargetExecutionStopped(const Events::TargetExecutionStopped&) {
try {
if (this->activeDebugSession.has_value() && this->activeDebugSession->waitingForBreak) { if (this->activeDebugSession.has_value() && this->activeDebugSession->waitingForBreak) {
this->activeDebugSession->connection.writePacket( this->activeDebugSession->connection.writePacket(
ResponsePackets::TargetStopped(Signal::TRAP) ResponsePackets::TargetStopped(Signal::TRAP)
); );
this->activeDebugSession->waitingForBreak = false; this->activeDebugSession->waitingForBreak = false;
} }
} catch (const ClientDisconnected&) {
Logger::info("GDB RSP client disconnected");
this->terminateActiveDebugSession();
return;
} catch (const ClientCommunicationError& exception) {
Logger::error(
"GDB RSP client communication error - " + exception.getMessage() + " - closing connection"
);
this->terminateActiveDebugSession();
return;
} catch (const DebugServerInterrupted&) {
// Server was interrupted
Logger::debug("GDB RSP interrupted");
return;
}
} }
} }