Fixed bug with GDB debug server not allowing any time for the TargetController to wake up.
This commit is contained in:
@@ -152,8 +152,26 @@ namespace Bloom::DebugServer::Gdb
|
|||||||
* service it.
|
* service it.
|
||||||
*/
|
*/
|
||||||
if (!this->targetControllerConsole.isTargetControllerInService()) {
|
if (!this->targetControllerConsole.isTargetControllerInService()) {
|
||||||
this->terminateActiveDebugSession();
|
// The TargetController is suspended - allow it some time to wake up
|
||||||
throw DebugSessionAborted("TargetController not in service");
|
|
||||||
|
/*
|
||||||
|
* 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");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user