From e7505b3e61cf1e8f46b8ae1916d7da9ce1a1d7ce Mon Sep 17 00:00:00 2001 From: YenHaoChen Date: Thu, 4 May 2023 08:11:32 +0800 Subject: [PATCH] triggers: icount: not to decrease on firing icount trigger with Debug Mode action The icount decreases on firing beakpoint action but not on entering Debug Mode action. Reference: https://github.com/riscv/riscv-debug-spec/issues/842 --- riscv/triggers.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/riscv/triggers.cc b/riscv/triggers.cc index 07cd6bf765..9e2a495ff5 100644 --- a/riscv/triggers.cc +++ b/riscv/triggers.cc @@ -299,7 +299,7 @@ std::optional icount_t::detect_icount_match(processor_t * const ret = match_result_t(TIMING_BEFORE, action); } - if (count >= 1) { + if (count >= 1 && (ret == std::nullopt || action != MCONTROL_ACTION_DEBUG_MODE)) { if (count == 1) pending = 1; count = count - 1;