| 268 | } |
| 269 | |
| 270 | void |
| 271 | kdb_cpu_set_singlestep(void) |
| 272 | { |
| 273 | db_expr_t inst; |
| 274 | db_addr_t pc, brpc; |
| 275 | uint32_t wcr; |
| 276 | u_int i; |
| 277 | |
| 278 | if (!dbg_capable()) |
| 279 | return; |
| 280 | |
| 281 | /* |
| 282 | * Disable watchpoints, e.g. stepping over watched instruction will |
| 283 | * trigger break exception instead of single-step exception and locks |
| 284 | * CPU on that instruction for ever. |
| 285 | */ |
| 286 | for (i = 0; i < dbg_watchpoint_num; i++) { |
| 287 | wcr = dbg_wb_read_reg(DBG_REG_BASE_WCR, i); |
| 288 | if ((wcr & DBG_WB_CTRL_E) != 0) { |
| 289 | dbg_wb_write_reg(DBG_REG_BASE_WCR, i, |
| 290 | (wcr & ~DBG_WB_CTRL_E)); |
| 291 | } |
| 292 | } |
| 293 | |
| 294 | pc = PC_REGS(); |
| 295 | |
| 296 | inst = db_get_value(pc, sizeof(pc), FALSE); |
| 297 | if (inst_branch(inst) || inst_call(inst) || inst_return(inst)) { |
| 298 | brpc = branch_taken(inst, pc); |
| 299 | dbg_setup_breakpoint(brpc, INSN_SIZE, DBG_BKPT_BT_SLOT); |
| 300 | } |
| 301 | pc = next_instr_address(pc, 0); |
| 302 | dbg_setup_breakpoint(pc, INSN_SIZE, DBG_BKPT_BNT_SLOT); |
| 303 | } |
| 304 | |
| 305 | void |
| 306 | kdb_cpu_clear_singlestep(void) |
nothing calls this directly
no test coverage detected