forked from luck/tmp_suning_uos_patched
kernel: debug: Centralize dbg_[de]activate_sw_breakpoints
During debug trap execution we expect dbg_deactivate_sw_breakpoints() to be paired with an dbg_activate_sw_breakpoint(). Currently although the calls are paired correctly they are needlessly smeared across three different functions. Worse this also results in code to drive polled I/O being called with breakpoints activated which, in turn, needlessly increases the set of functions that will recursively trap if breakpointed. Fix this by moving the activation of breakpoints into the debug core. Reviewed-by: Douglas Anderson <dianders@chromium.org> Link: https://lore.kernel.org/r/20200927211531.1380577-4-daniel.thompson@linaro.org Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
This commit is contained in:
parent
4c4197eda7
commit
771910f719
|
@ -760,6 +760,8 @@ static int kgdb_cpu_enter(struct kgdb_state *ks, struct pt_regs *regs,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dbg_activate_sw_breakpoints();
|
||||||
|
|
||||||
/* Call the I/O driver's post_exception routine */
|
/* Call the I/O driver's post_exception routine */
|
||||||
if (dbg_io_ops->post_exception)
|
if (dbg_io_ops->post_exception)
|
||||||
dbg_io_ops->post_exception();
|
dbg_io_ops->post_exception();
|
||||||
|
|
|
@ -1061,7 +1061,6 @@ int gdb_serial_stub(struct kgdb_state *ks)
|
||||||
error_packet(remcom_out_buffer, -EINVAL);
|
error_packet(remcom_out_buffer, -EINVAL);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
dbg_activate_sw_breakpoints();
|
|
||||||
fallthrough; /* to default processing */
|
fallthrough; /* to default processing */
|
||||||
default:
|
default:
|
||||||
default_handle:
|
default_handle:
|
||||||
|
|
|
@ -147,7 +147,6 @@ int kdb_stub(struct kgdb_state *ks)
|
||||||
return DBG_PASS_EVENT;
|
return DBG_PASS_EVENT;
|
||||||
}
|
}
|
||||||
kdb_bp_install(ks->linux_regs);
|
kdb_bp_install(ks->linux_regs);
|
||||||
dbg_activate_sw_breakpoints();
|
|
||||||
/* Set the exit state to a single step or a continue */
|
/* Set the exit state to a single step or a continue */
|
||||||
if (KDB_STATE(DOING_SS))
|
if (KDB_STATE(DOING_SS))
|
||||||
gdbstub_state(ks, "s");
|
gdbstub_state(ks, "s");
|
||||||
|
@ -167,7 +166,6 @@ int kdb_stub(struct kgdb_state *ks)
|
||||||
* differently vs the gdbstub
|
* differently vs the gdbstub
|
||||||
*/
|
*/
|
||||||
kgdb_single_step = 0;
|
kgdb_single_step = 0;
|
||||||
dbg_deactivate_sw_breakpoints();
|
|
||||||
return DBG_SWITCH_CPU_EVENT;
|
return DBG_SWITCH_CPU_EVENT;
|
||||||
}
|
}
|
||||||
return kgdb_info[ks->cpu].ret_state;
|
return kgdb_info[ks->cpu].ret_state;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user