I''ve read the manual, the blog posting, and the wiki, but I still don''t understand exactly what happens when I run dtrace -G. This matters because I am trying to integrate USDT support into a somewhat complex build system. As near as I can tell, "dtrace -G -s provider.d -o provider.o obj1.o obj2.o ... objn.o" does at least two things: 1. Produce a provider.o file 2. Rewrite all the probe sites in objk.o One question I have is whether these things are actually independent. Does provider.o depend in any way on the contents of the object files, or is the same provider.o generated regardless? In step 2, are all dtrace probe sites rewritten, or only the ones for the providers defined in provider.d? What is the correct way to handle a .o file that has probes defined in more than one provider.d file? A related question is: Would I get the same result from running "dtrace -G -s provider.d -o provider.o objk.o" for k=1..n? Any enlightenment would be appreciated. Thanks. joe
Adam Leventhal
2009-May-13 01:32 UTC
[dtrace-discuss] USDT: what does dtrace -G really do?
On Tue, May 12, 2009 at 12:20:07PM -0700, Joe Pallas wrote:> I''ve read the manual, the blog posting, and the wiki, but I still don''t > understand exactly what happens when I run dtrace -G. This matters because > I am trying to integrate USDT support into a somewhat complex build system. > > As near as I can tell, "dtrace -G -s provider.d -o provider.o obj1.o obj2.o > ... objn.o" does at least two things: > > 1. Produce a provider.o file > 2. Rewrite all the probe sites in objk.oYes, that''s right though conceptually they happen in the other order.> One question I have is whether these things are actually independent. Does > provider.o depend in any way on the contents of the object files, or is the > same provider.o generated regardless?The two are related. The stuff in provider.o is derived from the provider.d file as well as the probe sites as they are in the object files you pass in. Those probe sites are recorded in the provider.o file. If you examine that file with nm, you can see relocations to the functions that contain your probe invocations.> In step 2, are all dtrace probe sites rewritten, or only the ones for the > providers defined in provider.d? What is the correct way to handle a .o > file that has probes defined in more than one provider.d file?I suggest you put all providers in a single file. I suspect your build will fail if there are probes not specified in the provider.d file.> A related question is: Would I get the same result from running "dtrace -G > -s provider.d -o provider.o objk.o" for k=1..n?It would not. You may be able to generate a bunch of providerk.o files and link them together, but I wouldn''t be surprised if something failed there.> Any enlightenment would be appreciated. Thanks.Hope that''s at least clarifying. Adam -- Adam Leventhal, Fishworks http://blogs.sun.com/ahl