On Tue, Oct 28, 2008 at 02:00:23PM -0700, Adam Mitchell wrote:
> I did this on a dev machine.  We won't have /usr/sfw/bin/cpp on prod
> hosts.  Can someone point me to some general instructions on using the
> '-G' option to reuse this compiled dtrace program on another host?

Generally, you can't.  But you could save the output of cpp:

truss -aft exec ./script

Pick out the "cpp" line, which might look like:

4056:  argv: cpp -D__sun -D__unix -D__SVR4 -D__SUNW_D=1 -D__SUNW_D_64
4056:   -D__SunOS_5_11 -D__amd64 -D__SUNW_D_VERSION=0x01006002
4056:   -D__STDC__=0 /dev/fd/4 /dev/fd/5

and transform that into:

tail +2 script | 
    /path/to/gnu/cpp -D__sun -D__unix -D__SVR4 -D__SUNW_D=1 -D__SUNW_D_64 \
    -D__SunOS_5_11 -D__amd64 -D__SUNW_D_VERSION=0x01006002 \
    -D__STDC__=0 /dev/stdin > script.preprocessed

Then, you can just do dtrace -s ./script.preprocessed on any machine of the
same architecture.

Note that if you're targetting a 32-bit Apache, you should compile with
the '-32' argument to dtrace(1M).

Cheers,
- jonathan


> -- 
> This message posted from opensolaris.org
> _______________________________________________
> dtrace-discuss mailing list
> dtrace-discuss@opensolaris.org
_______________________________________________
dtrace-discuss mailing list
dtrace-discuss@opensolaris.org

Reply via email to