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: trace function argument


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


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