Skip to content

Commit 771910f

Browse files
author
Daniel Thompson
committed
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Daniel Thompson <[email protected]>
1 parent 4c4197e commit 771910f

File tree

3 files changed

+2
-3
lines changed

3 files changed

+2
-3
lines changed

kernel/debug/debug_core.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -760,6 +760,8 @@ static int kgdb_cpu_enter(struct kgdb_state *ks, struct pt_regs *regs,
760760
}
761761
}
762762

763+
dbg_activate_sw_breakpoints();
764+
763765
/* Call the I/O driver's post_exception routine */
764766
if (dbg_io_ops->post_exception)
765767
dbg_io_ops->post_exception();

kernel/debug/gdbstub.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1061,7 +1061,6 @@ int gdb_serial_stub(struct kgdb_state *ks)
10611061
error_packet(remcom_out_buffer, -EINVAL);
10621062
break;
10631063
}
1064-
dbg_activate_sw_breakpoints();
10651064
fallthrough; /* to default processing */
10661065
default:
10671066
default_handle:

kernel/debug/kdb/kdb_debugger.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,6 @@ int kdb_stub(struct kgdb_state *ks)
147147
return DBG_PASS_EVENT;
148148
}
149149
kdb_bp_install(ks->linux_regs);
150-
dbg_activate_sw_breakpoints();
151150
/* Set the exit state to a single step or a continue */
152151
if (KDB_STATE(DOING_SS))
153152
gdbstub_state(ks, "s");
@@ -167,7 +166,6 @@ int kdb_stub(struct kgdb_state *ks)
167166
* differently vs the gdbstub
168167
*/
169168
kgdb_single_step = 0;
170-
dbg_deactivate_sw_breakpoints();
171169
return DBG_SWITCH_CPU_EVENT;
172170
}
173171
return kgdb_info[ks->cpu].ret_state;

0 commit comments

Comments
 (0)