FreeBSD 9.0-RC1 and DTrace Userland Probes

Matt Davis mattdavis9 at gmail.com
Thu Oct 27 04:23:31 UTC 2011


I upgraded my box so that I can rock the userland DTrace probes.  I have been
following the example at: http://wiki.freebsd.org/DTrace/userland

When I am ready to build my test probe, I run 'make' as the example shows.  The
result of that is the following:

cc -O2 -pipe -fno-omit-frame-pointer  -std=gnu99 -fstack-protector  -c test.c
cc -O2 -pipe -fno-omit-frame-pointer  -std=gnu99 -fstack-protector   -o test
test.o 
test.o: In function `main':
test.c:(.text+0x29): undefined reference to `__dtrace_prober___probe__before'
test.c:(.text+0x45): undefined reference to `__dtrace_prober___probe__after'
*** Error code 1

Same idea as the example, but I just changed the names around.  Well, so I
thought I would be smart and compile just the object file with:
dtrace -G -s prober.d

And that stalls.  `truss` is showing that dtrace is stalling after a mmap, with
what looks to be a valid returned address.

/* provider.d */
provider prober {
    probe probe__before(char *);
    probe probe__after(char *);
};

/* test.c */
#include <unistd.h>
#include <sys/time.h>
#include "provider.h"

int main(void)
{
    struct timeval tv;
    for ( ;; )
    {
        sleep(1);
        PROBER_PROBE_BEFORE("foo");
        gettimeofday(&tv, NULL);
        PROBER_PROBE_AFTER("bar");
    }
    return 0;
}

Any insight would be wonderful.
Thanks!

-Matt


More information about the freebsd-questions mailing list