From 6c67424af97b64df86c9e27602c2b32834284136 Mon Sep 17 00:00:00 2001 From: Nav Date: Sun, 6 Oct 2024 18:06:58 +0100 Subject: [PATCH] On RISC-V activation, clear any triggers that were left over from a previous debug session --- .../Protocols/RiscVDebugSpec/DebugTranslator.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/DebugToolDrivers/Protocols/RiscVDebugSpec/DebugTranslator.cpp b/src/DebugToolDrivers/Protocols/RiscVDebugSpec/DebugTranslator.cpp index 62e35636..bb6e5c58 100644 --- a/src/DebugToolDrivers/Protocols/RiscVDebugSpec/DebugTranslator.cpp +++ b/src/DebugToolDrivers/Protocols/RiscVDebugSpec/DebugTranslator.cpp @@ -97,6 +97,11 @@ namespace DebugToolDrivers::Protocols::RiscVDebugSpec this->reset(); this->triggerDescriptorsByIndex = this->discoverTriggers(); + if (!this->triggerDescriptorsByIndex.empty()) { + // Clear any left-over triggers from the previous debug session + this->clearAllBreakpoints(); + } + auto debugControlStatusRegister = this->readDebugControlStatusRegister(); debugControlStatusRegister.breakUMode = true; debugControlStatusRegister.breakSMode = true;