Do not expose the native itrigger translation-block state while
a hart is already in Debug Mode, because trigger matching is
architecturally disabled there.

Hiding the TB flag avoids stale itrigger state leaking into ROM
execution and keeps translated code aligned with the active
debug context.

Signed-off-by: Chao Liu <[email protected]>
---
 target/riscv/tcg/tcg-cpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/riscv/tcg/tcg-cpu.c b/target/riscv/tcg/tcg-cpu.c
index 4674ff3e3c..43d764fd59 100644
--- a/target/riscv/tcg/tcg-cpu.c
+++ b/target/riscv/tcg/tcg-cpu.c
@@ -180,7 +180,7 @@ static TCGTBCPUState riscv_get_tb_cpu_state(CPUState *cs)
              ? EXT_STATUS_DIRTY : EXT_STATUS_DISABLED;
     }
 
-    if (cpu->cfg.ext_sdtrig && !icount_enabled()) {
+    if (cpu->cfg.ext_sdtrig && !env->debug_mode && !icount_enabled()) {
         flags = FIELD_DP32(flags, TB_FLAGS, ITRIGGER, env->itrigger_enabled);
     }
 #endif
-- 
2.53.0


Reply via email to