Fixed bug with GDB debug server not allowing any time for the TargetController to wake up.
This commit is contained in:
@@ -152,10 +152,28 @@ namespace Bloom::DebugServer::Gdb
|
||||
* service it.
|
||||
*/
|
||||
if (!this->targetControllerConsole.isTargetControllerInService()) {
|
||||
// The TargetController is suspended - allow it some time to wake up
|
||||
|
||||
/*
|
||||
* At first, it may seem like there is a possibility that we may miss the
|
||||
* TargetControllerStateChanged event here. But this is nothing to worry about because
|
||||
* this->eventListener is already listening for TargetControllerStateChanged events, so if an event
|
||||
* does fire in between the call to isTargetControllerInService() (above) and waitForEvent() (below),
|
||||
* then waitForEvent() will return immediately with the event.
|
||||
*/
|
||||
const auto targetControllerStateChangedEvent = this->eventListener.waitForEvent<
|
||||
Events::TargetControllerStateChanged
|
||||
>(std::chrono::milliseconds(10000));
|
||||
|
||||
if (
|
||||
!targetControllerStateChangedEvent.has_value()
|
||||
|| targetControllerStateChangedEvent->get()->state != TargetControllerState::ACTIVE
|
||||
) {
|
||||
this->terminateActiveDebugSession();
|
||||
throw DebugSessionAborted("TargetController not in service");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
auto commandPacket = this->waitForCommandPacket();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user