From 38e57ba3ba0f907270b57d8b6a17381681a76545 Mon Sep 17 00:00:00 2001 From: Parth Date: Tue, 28 Jul 2026 10:44:50 +0100 Subject: [PATCH] Debug/Trace: stop execution when a timing-before trigger matches MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit End the current processor step after taking the trigger action, preventing an extra debug-ROM or trap-handler instruction from executing before the caller observes the matched instruction’s architectural context. --- riscv/execute.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/riscv/execute.cc b/riscv/execute.cc index 97c90de1..8f30acaa 100644 --- a/riscv/execute.cc +++ b/riscv/execute.cc @@ -346,6 +346,10 @@ void processor_t::step(size_t n) catch (triggers::matched_t& t) { take_trigger_action(t.action, t.address, pc, t.gva); + // End this step at the trigger boundary. In particular, a timing-before + // trigger retires no instruction, so continuing would immediately execute + // from the debug ROM or trap vector to consume the remaining step count. + n = instret; } catch(trap_debug_mode&) {