[dtrace-discuss] USDT probes in Mozilla - can we run dtrace -G
against a shared library
Bart Smaalders
bart.smaalders at Sun.COM
Tue Feb 13 09:19:54 PST 2007
John Rice wrote:
> Hi - we are looking into adding dtrace probes into mozilla.
>
> One of the problems is that this is a large project with lots of shared
> libraries. It would simplify integration of probes if we could just
> build the shared libs with the embedded probes [using appropriate header
> from dtrace -h] and then before we do the final link to create the
> binary, do the dtrace -G to convert all our undef probe symbols into the
> appropriate ignore ones.
>
> Simple test seems to say that we cannot. As a test we took Bart's
> example USDT, split it into two files and generated a shared library for
> it, but could not get dtrace -G to swallow it:
>
> $ make simple_probes.o
> dtrace -G -s simple_probes.d simple1.so
> dtrace: failed to link script simple_probes: an error was encountered
> while processing simple1.so
> make: *** [simple_probes.o] Error 1
>
> Anyone any ideas? Of course may have screwed up on my shared lib
> creation ...
>
> JR
>
> http://blogs.sun.com/barts/entry/putting_user_defined_dtrace_probe
>
The easiest thing to do here is to place each library's
probes in each library separately. Collect all the .o files
that belong in a library into a single .o w/ ld -r and then
use dtrace on it.
I modified the example to put the probes into the shared library;
since there was only a single .o file I use it w/o the ld -r.
- Bart
--
Bart Smaalders Solaris Kernel Performance
barts at cyber.eng.sun.com http://blogs.sun.com/barts
-------------- next part --------------
CFLAGS=-Kpic
CC=cc
DTRACE=dtrace
default: simple
simple_probes.o: simple_probes.d simple1.o
$(DTRACE) -G -s simple_probes.d simple1.o
simple1.so: simple1.o simple_probes.o
$(CC) -o simple1.so -G simple1.o simple_probes.o -ztext -lc
simple: simple.o simple1.so
$(CC) -o simple simple.o -R`pwd` simple1.so
-------------- next part --------------
A non-text attachment was scrubbed...
Name: simple.c
Type: text/x-csrc
Size: 411 bytes
Desc: not available
Url : http://mail.opensolaris.org/pipermail/dtrace-discuss/attachments/20070213/b1e3a4d7/simple.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: simple1.c
Type: text/x-csrc
Size: 2273 bytes
Desc: not available
Url : http://mail.opensolaris.org/pipermail/dtrace-discuss/attachments/20070213/b1e3a4d7/simple1.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: simple_probes.d
Type: text/x-dsrc
Size: 67 bytes
Desc: not available
Url : http://mail.opensolaris.org/pipermail/dtrace-discuss/attachments/20070213/b1e3a4d7/simple_probes.bin
More information about the dtrace-discuss
mailing list