MCPcopy Create free account
hub / github.com/F-Stack/f-stack / kdb_cpu_set_singlestep

Function kdb_cpu_set_singlestep

freebsd/arm/arm/debug_monitor.c:270–303  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

268}
269
270void
271kdb_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
305void
306kdb_cpu_clear_singlestep(void)

Callers

nothing calls this directly

Calls 7

dbg_capableFunction · 0.85
db_get_valueFunction · 0.85
dbg_setup_breakpointFunction · 0.85
next_instr_addressFunction · 0.85
dbg_wb_read_regFunction · 0.70
dbg_wb_write_regFunction · 0.70
branch_takenFunction · 0.70

Tested by

no test coverage detected