[PATCH v2 07/11] arm64: debug: split single stepping exception entry

Mark Rutland mark.rutland at arm.com
Wed May 28 08:22:05 PDT 2025


On Tue, May 20, 2025 at 05:29:14PM +0100, Will Deacon wrote:
> On Mon, May 12, 2025 at 06:43:22PM +0100, Ada Couprie Diaz wrote:
> > +	enter_from_user_mode(regs);
> > +	/*
> > +	 * After handling a breakpoint, we suspend the breakpoint
> > +	 * and use single-step to move to the next instruction.
> > +	 * If we have a suspended breakpoint there's nothing more to do:
> > +	 * complete the single-step.
> > +	 */
> > +	if (reinstall_suspended_bps(regs)) {
> > +		local_daif_restore(DAIF_PROCCTX);
> > +		do_softstep(esr, regs);
> > +	}
> > +	exit_to_user_mode(regs);
> 
> I quite like the look of this now, but perhaps we could rename
> reinstall_suspended_bps() and change the return value to make things a
> bit more readable? For example, 'if (!stepped_suspended_breakpt(regs))'
> or something like that? What do you think?

How about:

	if (!try_step_suspended_breakpoints(regs))

... that'd match the naming in do_el0_undef() and do_el1_undef() in
traps.c, where we have try_${HANDLE_POTENTIAL_CASE}() for a few cases,
e.g.

| void do_el0_undef(struct pt_regs *regs, unsigned long esr) 
| {
|         u32 insn;
| 
|         /* check for AArch32 breakpoint instructions */
|         if (!aarch32_break_handler(regs))
|                 return;
| 
|         if (user_insn_read(regs, &insn))
|                 goto out_err;
| 
|         if (try_emulate_mrs(regs, insn))
|                 return;
| 
|         if (try_emulate_armv8_deprecated(regs, insn))
|                 return;
| 
| out_err:
|         force_signal_inject(SIGILL, ILL_ILLOPC, regs->pc, 0);
| }

Mark.



More information about the linux-arm-kernel mailing list