krishnan parthasarathi - Sun Microsystems - Bangalore India
2009-Jul-23 06:18 UTC
[dtrace-discuss] [osol-discuss] Printing process variable
Hi Akhil, You can print variables inside a funtion using dtrace only if there is a dtrace probe ''exposing'' it. If this is an application for which you have source, then you could add USDT probes in it. See http://blogs.sun.com/barts/entry/putting_user_defined_dtrace_probe for adding probes into your application. I am CCing dtrace-discuss at opensolaris.org to this mail, as it is a more appropriate alias for your question. HTH, Krishnan On 07/23/09 10:41, Akhil Jain wrote:> Hi All, > > Just want to know is there any way I can print variables used inside a function using dtrace ? > > > Thanks > Akhil >
Chad Mynhier
2009-Jul-23 10:18 UTC
[dtrace-discuss] [osol-discuss] Printing process variable
Actually, this isn''t exactly true. There are two things you can do with the pid provider that allow you to inspect the value of variables inside functions in certain cases: you can instrument any individual instruction, and you can access register values via the uregs[] array. As long as you can read assembly well enough to figure out when the value of that variable is in a register, you can grab that value. There''s a blog entry about this here: http://www.forsythesunsolutions.com/node/122 The method is a bit fragile, given that it uses a function offset probe, and the offset may change. It''s also not terribly general, as it doesn''t give you access to any variable. But it might be useful. Chad On Thu, Jul 23, 2009 at 2:18 AM, krishnan parthasarathi - Sun Microsystems - Bangalore India<Krishnan.Parthasarathi at sun.com> wrote:> Hi Akhil, > You can print variables inside a funtion using dtrace only if there is a > dtrace probe ''exposing'' it. If this is an application for which you have > source, then you could add USDT probes in it. See > http://blogs.sun.com/barts/entry/putting_user_defined_dtrace_probe for > adding probes into your application. > > I am CCing dtrace-discuss at opensolaris.org to this mail, as it is a more > appropriate alias for your question. > > HTH, > Krishnan > > On 07/23/09 10:41, Akhil Jain wrote: >> >> Hi All, >> >> Just want to know is there any way I can print variables used inside a >> function using dtrace ? >> >> Thanks >> Akhil >> > > _______________________________________________ > dtrace-discuss mailing list > dtrace-discuss at opensolaris.org >