diff --git a/target/riscv/translate.c b/target/riscv/translate.c index b98fd64..affa2d4 100644 --- a/target/riscv/translate.c +++ b/target/riscv/translate.c @@ -1575,7 +1575,11 @@ static void gen_system(DisasContext *ctx, uint32_t opc, int rd, int rs1, gen_set_gpr(rd, dest); /* end tb since we may be changing priv modes, to get mmu_index right */ tcg_gen_movi_tl(cpu_pc, ctx->pc_succ_insn); - tcg_gen_exit_tb(NULL, 0); /* no chaining */ + if (ctx->base.singlestep_enabled) { + gen_exception_debug(); + } else { + tcg_gen_exit_tb(NULL, 0); /* no chaining */ + } ctx->base.is_jmp = DISAS_NORETURN; break; }