This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: trace function argument
- From: Ananth N Mavinakayanahalli <ananth at in dot ibm dot com>
- To: Christian Kaiser <kaiser at dolphinics dot com>
- Cc: systemtap at sourceware dot org
- Date: Tue, 16 Jun 2009 14:45:22 +0530
- Subject: Re: trace function argument
- References: <4A376113.30109@dolphinics.com>
- Reply-to: ananth at in dot ibm dot com
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) }'
With debuginfoless kernels, you can do pretty much what you cite with
DTrace above.
Ananth