On Wed, Sep 12, 2007 at 06:28:06PM -0700, Roland McGrath wrote: > Hi. Can you help me understand why arch/powerpc/kernel/traps.c's > single_step_exception and emulate_single_step functions clear the trace > flags (MSR_SE et al) on every trace trap? > > The users of this bit that I know in any detail are ptrace and kprobes. > It looks to me like kprobes does not expect MSR_SE to be cleared > automatically, though I am not entirely certain.
On powerpc, since single_step_exception() explicitly resets MSR_SE, kprobes doesn't reset it again. However, in the post_handler, if we see the MSR_SE bit set, its deemed that some other user explicitly wants to singlestep and kprobes returns NOTIFY_DONE so the user who set the bit can be notified. This also plays nicely if someone is stepping through the code using xmon. Ananth