File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -1102,6 +1102,19 @@ static void riscv_halt_resume(target_s *target, const bool step)
11021102 }
11031103 if (!riscv_csr_write (hart , RV_DCSR | RV_CSR_FORCE_32_BIT , & stepping_config ))
11041104 return ;
1105+ /* Step over coded breakpoints */
1106+ uint32_t dcsr_cause = 0U ;
1107+ riscv_csr_read (hart , RV_DCSR , & dcsr_cause );
1108+ dcsr_cause &= RV_DCSR_CAUSE_MASK ;
1109+ if (dcsr_cause == RV_HALT_CAUSE_EBREAK ) {
1110+ /* Read the instruction to resume on */
1111+ uint32_t program_counter = riscv_pc_read (hart );
1112+ /* If it actually is a breakpoint instruction, update the program counter one past it. */
1113+ if (target_mem32_read32 (target , program_counter ) == RV_EBREAK ) {
1114+ program_counter += 4U ;
1115+ riscv_csr_write (hart , RV_DPC , & program_counter );
1116+ }
1117+ }
11051118 /* Request the hart to resume */
11061119 if (!riscv_dm_write (hart -> dbg_module , RV_DM_CONTROL , hart -> hartsel | RV_DM_CTRL_RESUME_REQ ))
11071120 return ;
You can’t perform that action at this time.
0 commit comments