Catch errors when handling unexpected target resets in RiscV driver

This commit is contained in:
Nav
2025-01-27 23:57:35 +00:00
parent 25fd2a3a6a
commit 35e059c1bf

View File

@@ -179,6 +179,7 @@ namespace DebugToolDrivers::Protocols::RiscVDebugSpec
if (statusRegister.anyHaveReset) { if (statusRegister.anyHaveReset) {
Logger::warning("Reset detected at RISC-V hart " + std::to_string(this->selectedHartIndex)); Logger::warning("Reset detected at RISC-V hart " + std::to_string(this->selectedHartIndex));
try {
if (statusRegister.anyRunning) { if (statusRegister.anyRunning) {
this->stop(); this->stop();
} }
@@ -193,6 +194,10 @@ namespace DebugToolDrivers::Protocols::RiscVDebugSpec
if (statusRegister.anyRunning) { if (statusRegister.anyRunning) {
this->run(); this->run();
} }
} catch (const Exceptions::TargetOperationFailure& exception) {
Logger::error("Failed to handle unexpected RISC-V hart reset - error: " + exception.getMessage());
}
} }
return statusRegister.anyRunning return statusRegister.anyRunning