Nik Clayton
2006-Jul-19 16:31 UTC
[dtrace-discuss] Adding USDT probes to static functions. Possible?
Hi, Can DTrace be used to instrument functions that are declared static? I imagine not, based on my recent experiences. Specifically, I''ve just started adding USDT probes to Sendmail. See the commits at http://jc.ngo.org.uk/svnweb/jc/revision?rev=1057 http://jc.ngo.org.uk/svnweb/jc/revision?rev=1058 for the simple changes (yes, I know these need to be protected with "#if DTRACE ... #endif" or similar in the long term). If you look at the changes in r1058 (the second link), specifically the changes to queue.c:gatherq(), you''ll note that I had to remove the ''static'' keyword. Without that change, I get this error when linking. [... lots of build output elided ...] dtrace -G -s provider.d {lots of .o files} cc -o sendmail {bunch of .o files, including provider.o} Undefined first referenced symbol in file gatherq provider.o ld: fatal: Symbol referencing errors. No output written to sendmail Given C linkage rules I think I understand why that''s happening. Is there a way around it? N PS: If you''re interested in the more general "adding USDT probes to Sendmail" bit of this you can follow along at http://jc.ngo.org.uk/blog/. Patches and comments more than welcome (especially if it acts as an inducement to Sun to let me keep the box... :-) )
Matty
2006-Jul-19 17:20 UTC
[dtrace-discuss] Adding USDT probes to static functions. Possible?
On Wed, 19 Jul 2006, Nik Clayton wrote:> Can DTrace be used to instrument functions that are declared static?It sure can, though the foundation required to make this work is only available in Nevada. If you want some additional details on SDT probes in static functions, check out Adam''s post: http://www.opensolaris.org/jive/thread.jspa?messageID=23815崇 Thanks, - Ryan -- UNIX Administrator http://prefetch.net
Bryan Cantrill
2006-Jul-19 17:48 UTC
[dtrace-discuss] Adding USDT probes to static functions. Possible?
> On Wed, 19 Jul 2006, Nik Clayton wrote: > > >Can DTrace be used to instrument functions that are declared static? > > It sure can, though the foundation required to make this work is only > available in Nevada.Just to be clear, that''s "Nevada, the current Solaris release under development" not "Nevada, the infamous western US state." Given that there is quite a bit that''s "only available in Nevada" (either one), I thought this was worth calling out... ;) Because it''s been in Nevada for a while (since Build 32), you can also get this functionality in Solaris Express 6/06, any recent OpenSolaris build, or the latest Nexenta Alpha (Alpha 5, based on OpenSolaris Build 40), Belenix (based on OpenSolaris ~Build 42) or SchilliX (based on OpenSolaris Build 35)... - Bryan -------------------------------------------------------------------------- Bryan Cantrill, Solaris Kernel Development. http://blogs.sun.com/bmc
Adam Leventhal
2006-Jul-19 17:57 UTC
[dtrace-discuss] Adding USDT probes to static functions. Possible?
On Wed, Jul 19, 2006 at 10:48:14AM -0700, Bryan Cantrill wrote:> Because it''s been in Nevada for a while (since Build 32), you can also get > this functionality in Solaris Express 6/06, any recent OpenSolaris build, > or the latest Nexenta Alpha (Alpha 5, based on OpenSolaris Build 40), > Belenix (based on OpenSolaris ~Build 42) or SchilliX (based on OpenSolaris > Build 35)...It will also be in a Solaris 10 update, and USDT providers created on the releases Bryan mentioned above will work just fine on Solaris 10 FCS (as long as you don''t use the new is-enabled probes). Adam -- Adam Leventhal, Solaris Kernel Development http://blogs.sun.com/ahl
Nik Clayton
2006-Jul-21 16:14 UTC
[dtrace-discuss] Adding USDT probes to static functions. Possible?
Bryan Cantrill wrote:>> On Wed, 19 Jul 2006, Nik Clayton wrote: >>> Can DTrace be used to instrument functions that are declared static? >> It sure can, though the foundation required to make this work is only >> available in Nevada. > > Just to be clear, that''s "Nevada, the current Solaris release under > development" not "Nevada, the infamous western US state." Given that > there is quite a bit that''s "only available in Nevada" (either one), I > thought this was worth calling out... ;) > > Because it''s been in Nevada for a while (since Build 32), you can also get > this functionality in Solaris Express 6/06, any recent OpenSolaris build, > or the latest Nexenta Alpha (Alpha 5, based on OpenSolaris Build 40), > Belenix (based on OpenSolaris ~Build 42) or SchilliX (based on OpenSolaris > Build 35)...[ I realise this is rapidly getting off topic for the dtrace list ] Is Solaris Express something I can update an existing Solaris installation to without a complete reinstall? Since the download site wants me to download CD ISO images and boot from them, I imagine so. If that''s the case then I''ll schedule that for a couple of weeks time, when I''m planning on reimaging the box anyway. However, if it''s just a large collection of packages I''ll do the download and install them much sooner. Thanks. N
Casper.Dik at Sun.COM
2006-Jul-21 17:07 UTC
[dtrace-discuss] Adding USDT probes to static functions. Possible?
>Is Solaris Express something I can update an existing Solaris >installation to without a complete reinstall?Upgrade (this replaces all of the Solaris bits with newer bits but keeps the configuration intact.>Since the download site wants me to download CD ISO images and boot from >them, I imagine so.Even using the install images you can upgrade. If you have some spare space (say about the size of "/") then you can also investigate live upgrade which allows you to go back. Casper
Nik Clayton
2006-Jul-21 19:14 UTC
[dtrace-discuss] Adding USDT probes to static functions. Possible?
Casper, Casper.Dik at Sun.COM wrote:>> Is Solaris Express something I can update an existing Solaris >> installation to without a complete reinstall? > > Upgrade (this replaces all of the Solaris bits with newer bits > but keeps the configuration intact. > >> Since the download site wants me to download CD ISO images and boot from >> them, I imagine so. > > Even using the install images you can upgrade. > > If you have some spare space (say about the size of "/") then you > can also investigate live upgrade which allows you to go back.Perfect. Many thanks for that. N