Added event listener for thread state changed events from the DebugServer, within Insight.

This covers cases where the DebugServer has unexpectedly shutdown and Insight should follow.
This commit is contained in:
Nav
2021-07-04 00:32:05 +01:00
parent ac64d04c5d
commit 5a8f54a229
2 changed files with 19 additions and 0 deletions

View File

@@ -45,6 +45,10 @@ void Insight::startup() {
std::bind(&Insight::onTargetControllerThreadStateChangedEvent, this, std::placeholders::_1)
);
this->eventListener->registerCallbackForEventType<Events::DebugServerThreadStateChanged>(
std::bind(&Insight::onDebugServerThreadStateChangedEvent, this, std::placeholders::_1)
);
auto targetDescriptor = this->targetControllerConsole.getTargetDescriptor();
#ifndef BLOOM_DEBUG_BUILD
@@ -132,3 +136,10 @@ void Insight::onTargetControllerThreadStateChangedEvent(const Events::TargetCont
this->shutdown();
}
}
void Insight::onDebugServerThreadStateChangedEvent(const Events::DebugServerThreadStateChanged& event) {
if (event.getState() == ThreadState::STOPPED) {
// Something horrible has happened with the DebugServer
this->shutdown();
}
}