kernel read fault using task_state()

David Smith dsmith@redhat.com
Wed Aug 12 14:05:00 GMT 2009


On 08/12/2009 08:36 AM, Frits Hoogland wrote:
> in order to get information about the execution of a process, I've
> made a little systemtap program:
> 
> probe begin{
>        printf("Start of profile of pid: %d\n", target() )
> }
> probe timer.profile {
>        printf("pid: %d , state: %d ", target(), task_state(target()) )
> }

Unfortunately, your script has an error.  target() returns a pid.
task_state() takes a task pointer.  Your timer.profile function should
look like this:

probe timer.profile {
	printf("pid: %d, state: %d\n", target(), task_state(pid2task(target())))
}

To avoid the pid2task lookup, you could cache the target's task in a
global variable in your begin probe.

-- 
David Smith
dsmith@redhat.com
Red Hat
http://www.redhat.com
256.217.0141 (direct)
256.837.0057 (fax)



More information about the Systemtap mailing list