On Nov 11, 2007, at 9:43 PM, Adam Leventhal wrote:
Something seems at least a bit off with regard to Apple's
implementation of
anonymous tracing:
Now that the Leopard DTrace userland source is posted I can elaborate
on the Mac OS X implementation of anonymous tracing:
First, build and install the following extension (it's called
dtrace_dof.kext and it keeps the compiled form of your dtrace script
on its Info.plist.) --
$ cd dtrace_dof_kext
$ xcodebuild
$ sudo ditto build/Release/dtrace_dof.kext/ /System/Library/Extensions/
dtrace_dof.kext
Now compile your script using the "-A" flag to direct the compiled
bytecodes to the dtrace_dof.kext --
$ sudo dtrace -A -n 'BEGIN { stack(12); }'
dtrace: saved anonymous enabling in /System/Library/Extensions/
dtrace_dof.kext/Contents/Info.plist
dtrace: do 'sudo touch /System/Library/Extensions/' and reboot to
enable changes
Arrange to rebuild Extensions.mkext and friends at next boot --
$ sudo touch /System/Library/Extensions/
Reboot --
$ sudo shutdown -r now
<REBOOTS>
When the machine comes back to life, claim the "anonymous" tracing by
running dtrace with the "-a" flag. --
$ sudo dtrace -a
dtrace: buffer size lowered to 2m
CPU ID FUNCTION:NAME
0 1 :BEGIN
mach`dtrace_probe+0xa74
mach`dtrace_probe+0x1e08
mach`dtrace_init+0x7cc
mach`bsd_autoconf+0x3c
mach`bsd_init+0x638
mach`kernel_bootstrap+0x150
mach`Call_continuation+0x14
0xdeadbeef
^C
Clean out dtrace_dof.kext --
$ sudo dtrace -A
dtrace: removed anonymous enabling in /System/Library/Extensions/
dtrace_dof.kext/Contents/Info.plist
dtrace: do 'sudo touch /System/Library/Extensions/' and reboot to
enable changes
$ sudo touch /System/Library/Extensions/
$ sudo shutdown -r now
<REBOOTS>
You only need to build and install the dtrace_dof.kext once.
SCP
--
Steve Peters
[EMAIL PROTECTED]
_______________________________________________
dtrace-discuss mailing list
[email protected]