This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

how can we decode the output of task_backtrace inside systemtap script ?


hi all,
i'm a newbie of systemtap and i'm a sysdmin;
Some commands like df might hang sometime,so i want to find out the
backtrace of those processes and i found dumpstack.stp in the
examples;
but in this script,the task_backtrace() just show us a string of
addresses without space, which can't be decoded directly by
print_stack()
How can we decode the ouput of task_backtrace() inside the systemtap
script?Any function design for this purpose?
thanks~

#i revise /usr/share/doc/systemtap-doc/examples/process/dumpstack.stp
to illustrate the requirement
root@hit201:/tmp# stap dumpstack.stp ?-x $$
----------print_stack() can decode the output of backtrace()
0xc0216fa0 0xc05c99f4
?0xc0216fa0 : sys_open+0x0/0x40 [kernel]
?0xc05c99f4 : syscall_call+0x7/0xb [kernel]
----------but print_stack() can't decode the output of task_backtrace()
0xc014e8fb0xc014e9bd0xc014ea2c0xc05c99f
?0x14e8fb0
root@hit201:/tmp# cat dumpstack.stp
#!/bin/env stap
probe syscall.open{
?? ?println("----------print_stack() can decode the output of backtrace()")
?? ?println(backtrace())
?? ?print_stack(backtrace())
?? ?exit()
}
probe end {
?? ? ? ?process_pid = target()
?? ? ? ?process_task = pid2task(process_pid)
?? ? ? ?if (process_task) {
?? ? ? ? ? if (task_state(process_task) != 0) { ?// Not TASK_RUNNING
?? ? ? ? ? ? ?println("----------but print_stack() can't decode the
output of task_backtrace()")
?? ? ? ? ? ? ?println(task_backtrace(process_task))
?? ? ? ? ? ? ?print_stack(task_backtrace(process_task))
?? ? ? ? ? } else
?? ? ? ? ? ? ?println("Process is actively running")
?? ? ? ?} else
?? ? ? ? ? ? ?println("No such process")
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]