is dtrace usable?

John Baldwin jhb at freebsd.org
Tue Mar 9 13:53:12 UTC 2010


On Tuesday 09 March 2010 3:27:09 am Alexander Leidinger wrote:
> Quoting John Baldwin <jhb at freebsd.org> (from Mon, 8 Mar 2010 10:00:12 -0500):
> 
> > On Saturday 06 March 2010 11:00:12 am Robert Watson wrote:
> >> On Sat, 6 Mar 2010, Alexander Leidinger wrote:
> >>
> >> >> Take a look at the DTrace configuration information here:
> >> >>
> >> >>    http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/dtrace.html
> >> >
> >> > I've just reread it (despite the fact that I already used it). Some
> >> > comments:
> >> >
> >> > Last time I tried, I didn't see any problems by adding
> >> >  makeoptions     WITH_CTF=yes
> >> > to the kernel config instead of doing
> >> >  make WITH_CTF=1 kernel
> >> >
> >> > Did I miss something, and if not, shouldn't we tell about the
> >> > makeoptions part instead (a kernel rebuild later will not cause
> >> > trouble when someone forgets to do the WITH_CTF part as it is already
> >> > in the kernel makefile)?
> >>
> >> I'll leave John to answer this one, CC line broadended.
> >
> > I would be very surprised if 'makeoptions WITH_CTF=yes' worked.  The many
> > times I and others have tried it it did not work.  Do you have a log of your
> > build showing the ctfconvert and ctfmerge command lines?
> 
> I do not have a log around, it has been a while since I did something  
> with dtrace (a year ago) and I can not remember that I always added  
> WITH_CTF on a build (but it was about SDT probes, not FBT probes, in  
> case it matters).
> 
> I had a look again, WITH_CTF=yes is one of the first lines in the  
> Makefile, and /usr/share/mk/sys.mk has "if !defined(WITH_CTF)". "make  
> -V WITH_CTF" shows "yes", but "make -V NO_CTF" shows "1". This is  
> strange, isn't it? I would expect that NO_CTF is undefined. Is this a  
> bug in make, or a bug in the man page (neither in the description of  
> the different kinds of variables, nor in the description of "defined"  
> is something mentioned explaining this behavior).

It is defined behavior.  From the 2nd and 3rd paragraphs of the make(1)
manual page:

     First of all, the initial list of specifications will be read from the
     system makefile, sys.mk, unless inhibited with the -r option.  The stan-
     dard sys.mk as shipped with FreeBSD also handles make.conf(5), the
     default path to which can be altered via the make variable __MAKE_CONF.

     Then the first of BSDmakefile, makefile, and Makefile that can be found
     in the current directory, object directory (see .OBJDIR), or search path
     (see the -I option) will be read for the main list of dependency specifi-
     cations.  A different makefile or list of them can be supplied via the -f
     option(s).  Finally, if the file .depend can be found in any of the
     aforesaid locations, it will also be read (see mkdep(1)).

From this you can see that sys.mk is included and parsed before 'Makefile',
so the WITH_CTF=yes is not set until after sys.mk has been parsed.

-- 
John Baldwin


More information about the freebsd-stable mailing list