This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: How to use tokenize
- From: fche at redhat dot com (Frank Ch. Eigler)
- To: domenico dot dileo at unina dot it
- Cc: "systemtap at sourceware dot org" <systemtap at sourceware dot org>
- Date: Fri, 05 Oct 2012 22:19:58 -0400
- Subject: Re: How to use tokenize
- References: <20121005192736.14225czk75ca7zbc@inbox.unina.it>
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