Replaced static TargetController state object access with new GetState command
This corrects a bug where the DebugServer checks if the TargetController is in service just before it's about to suspend. The DebugServer then attempts to start a new debug session, only for the TargetController to go into a suspended state. A fatal error occurs and a shutdown follows. This bug is only apparent when the user stops and starts debug sessions very quickly, with releasePostDebugSession set to true.
This commit is contained in:
@@ -23,6 +23,7 @@ namespace Bloom::TargetController
|
||||
using Commands::CommandIdType;
|
||||
|
||||
using Commands::Command;
|
||||
using Commands::GetState;
|
||||
using Commands::GetTargetDescriptor;
|
||||
using Commands::GetTargetState;
|
||||
using Commands::StopTargetExecution;
|
||||
@@ -109,10 +110,6 @@ namespace Bloom::TargetController
|
||||
this->shutdown();
|
||||
}
|
||||
|
||||
TargetControllerState TargetControllerComponent::getState() {
|
||||
return TargetControllerComponent::state;
|
||||
}
|
||||
|
||||
void TargetControllerComponent::registerCommand(std::unique_ptr<Command> command) {
|
||||
auto commandQueueLock = TargetControllerComponent::commandQueue.acquireLock();
|
||||
TargetControllerComponent::commandQueue.getValue().push(std::move(command));
|
||||
@@ -171,6 +168,9 @@ namespace Bloom::TargetController
|
||||
TargetControllerComponent::checkUdevRules();
|
||||
|
||||
// Register command handlers
|
||||
this->registerCommandHandler<GetState>(
|
||||
std::bind(&TargetControllerComponent::handleGetState, this, std::placeholders::_1)
|
||||
);
|
||||
|
||||
this->registerCommandHandler<GetTargetDescriptor>(
|
||||
std::bind(&TargetControllerComponent::handleGetTargetDescriptor, this, std::placeholders::_1)
|
||||
@@ -761,6 +761,10 @@ namespace Bloom::TargetController
|
||||
}
|
||||
}
|
||||
|
||||
std::unique_ptr<Responses::State> TargetControllerComponent::handleGetState(GetState& command) {
|
||||
return std::make_unique<Responses::State>(this->state);
|
||||
}
|
||||
|
||||
std::unique_ptr<Responses::TargetDescriptor> TargetControllerComponent::handleGetTargetDescriptor(
|
||||
GetTargetDescriptor& command
|
||||
) {
|
||||
|
||||
Reference in New Issue
Block a user