How to use tokenize
domenico.dileo@unina.it
domenico.dileo@unina.it
Fri Oct 5 17:27:00 GMT 2012
Hello,
I want to split the string returned by backtrace with tokenize.
Thus, I wrote the following code
function print_stacktrace(subsystem, when){
#stacktrace is invoked either function
# (probe) is called or when it is returning
# when can assume 2 values:
# c, call (stacktrace when function is called)
# r, return (stacktrace when function returns)
trace = backtrace()
printf("%s \n", probefunc())
while(strlen(address = tokenize(trace," ")) != 0){
printf("%s \n", address)
}
}
probe kernel.function("*@mm/*.c").call{
print_stacktrace("MM", "c")
}
probe kernel.function("*@mm/*.c").return{
print_stacktrace("MM", "r")
}
The output is something like
dnotify
0xc011698
0xc011698
0xc011698
...
0xc011698
It seems that the script gets stuck in the while loop.
in other words, at the first iterations tokenize returns
0xc011698 this value is assigned to address.
To the second iteration tokenize doesn't return a value
and address is still equal to the previous value.
I know that in stap there are function like "print_stack",
I don't need them because I have to submit the stack
trace to other elaborations.
Domenico Di Leo, PhD student, Universit? degli Studi di Napoli Federico II
Ph: +39 081 676770
Fax: +39 081 676574
Web: http://wpage.unina.it/domenico.dileo
More information about the Systemtap
mailing list