trace function argument
Christian Kaiser
kaiser@dolphinics.com
Tue Jun 16 09:47:00 GMT 2009
Ananth N Mavinakayanahalli wrote:
> On Tue, Jun 16, 2009 at 11:08:35AM +0200, Christian Kaiser wrote:
>> Hi all,
>>
>> is it possible to get the value of a function argument of a probed
>> function?
>>
>> With dtrace for example, you can do something like:
>> dtrace -n '::some_function:entry/arg0 != 0/{ printf("arg0 is not zero!");
>> }'
>>
>> I have searched the "Beginners Guide", mailinglist, wiki, web, etc. but
>> could not find anything useful.
>
> With SystemTap with debuginfo, you can refer to arguments by name.
>
> probe kernel.function("do_fork")
> {
> if ($clone_flags == 0)
> printf("clone_flags is zero!\n")
> }
>
> Further, to just list arguments, you can use $$parms:
>
> stap -ve 'probe kernel.function("vfs_read") { printf("%s\n", $$parms) }'
Right, both suggestions are working for me. Thanks!
> With debuginfoless kernels, you can do pretty much what you cite with
> DTrace above.
I am not sure if I understand you right. If I can do pretty much the
same, how is it working then? Let's take your example from above. How
can I print out 'clone_flags' with debuginfoless kernels?
Christian
--
Christian Kaiser, Software Engineer, Dolphin Interconnect Solutions
http://www.dolphinics.com
More information about the Systemtap
mailing list