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]

Re: How to use tokenize


Hi -

domenico.dileo@unina.it writes:

> [...]
> 		printf("%s \n", probefunc())
> 		while(strlen(address = tokenize(trace," ")) != 0){
> 		     printf("%s  \n", address)
> [...]
> The output is something like
> dnotify
> 0xc011698
> 0xc011698
> [...]
> It seems that the script gets stuck in the while loop.

Yes.  This would work better:

> 		address = tokenize(trace," ")
> 		while(address != "") {
> 		     printf("%s  \n", address)
> 		     address = tokenize(""," ")
> 		}

Note how, within the loop, the first parameter of tokenize() is empty,
so as to resume the previously started tokenization.  (This is hack to
work around the systemtap language's inability to treat an entire
array as a function return 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.

You may like the new backtrace-enumeration functions smakarov 
added in time for systemtap 2.0.  They should make this tokenize
business purely historical.

- FChE


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