[prev in list] [next in list] [prev in thread] [next in thread] 

List:       opensolaris-dtrace-discuss
Subject:    Re: [dtrace-discuss] sub-function
From:       "James C. McPherson" <James.McPherson () Sun ! COM>
Date:       2008-07-08 13:05:42
Message-ID: 48736626.6000109 () Sun ! COM
[Download RAW message or body]

Nigel S wrote:
> I'm a newbie as dtrace, but couldn't find an answer to this by searching
> :
> 
> For example, I have function "lsearch" which is called in many different
> places. It's also called by "composemessage".
> 
> I have been able to successfully create a script which show the return
> values of "lsearch". Now what I would like to do, is for it to only show
> the return value of "lsearch" when it's called by "composemessage".

Hi Nigel,
perhaps something like this might work for you:



===========================================================
#!/usr/sbin/dtrace

pid$target::*composemessage*:entry
{
	self->composed = 1;
}

pid$target::*lsearch*:entry
/self->composed/
{
	ustack(10);
}

pid$target::*lsearch*:return
/self->composed/
{
	printf("returning %d", arg1);
	self->composed = 0;
}
===========================================================


You should have a look in the DTrace manual for info about
predicates.


hth,
James C. McPherson
--
Senior Kernel Software Engineer, Solaris
Sun Microsystems
http://blogs.sun.com/jmcp	http://www.jmcp.homeunix.com/blog
_______________________________________________
dtrace-discuss mailing list
dtrace-discuss@opensolaris.org
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic