This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: kernel API for in-kernel single stepping
Dave Nomura writes:
> It looks like you have vast experience with single stepping in the
> kernel (sstep.[hc]). In a previous mail you mentioned that there is
> only a "scouts honor" convention with use of the kernel's single step
> trapping mechanism that is followed by the kernel debuggers with only
> one client at a time using the resources. With the various kernel
> debuggers, kprobes, itrace, and maybe others trying to share these
> resources do you think it is time to develop some sort of kernel single
> stepping API? Frank is requesting this API before changing
> SystemTap to support single step traps.
At present kprobes sets the MSR_SE bit in the MSR when it wants to
single-step, and uses the notify_die infrastructure as the way it gets
notified when the single-step trap occurs. It would be reasonable for
other things that want to use single-stepping to do the same, i.e. set
MSR_SE when they want to single-step, and use the notify_die stuff to
get control back when the single-step trap occurs.
In other words the API for single-stepping is just the notify_die
stuff. We don't get very formal or elaborate about APIs in the
kernel, preferring to extend a simple API when a need is shown rather
than designing an elaborate API up front that attempts to cater for
all possible needs.
And yes this is saying that itrace should use notify_die. The
debugger_sstep hook is really only for in-kernel debuggers. If
notify_die is not sufficient for itrace, let me know and we'll work
something else out.
Regards,
Paul.