For example, I wanted to see why the Android make system went wrong,
Start the tool to track the process command line that starts instantly, and then do what you want to do, such as the MM Build command for Android
Sudo newproc.d
####result######## This is displayed in real time.
2015 Oct 2 20:35:07 54743 <54052> 64b make -C /Users/q/Documents/android_src -f build/core/main.mk all_modules
2015 Oct 2 20:35:07 54743 <54052> 64b /Applications/Xcode.app/Contents/Developer/usr/bin/make -C /Users/q/Documents/android_src -f build/core/main.mk all_modules
2015 Oct 2 20:35:07 54744 <54743> 64b /bin/bash -c uname -sm
2015 Oct 2 20:35:07 54744 <54743> 64b uname -sm
2015 Oct 2 20:35:07 54745 <54743> 64b /bin/bash -c expr 3.81 \>= 3.81
2015 Oct 2 20:35:07 54745 <54743> 64b expr 3.81 >= 3.81
2015 Oct 2 20:35:07 54746 <54743> 64b /bin/bash -c pwd
2015 Oct 2 20:35:07 54747 <54743> 64b /bin/bash -c date +%Y%m%d.%H%M%S
2015 Oct 2 20:35:07 54747 <54743> 64b date +%Y%m%d.%H%M%S
2015 Oct 2 20:35:07 54748 <54743> 64b /bin/bash -c uname -sm
2015 Oct 2 20:35:07 54748 <54743> 64b uname -sm
2015 Oct 2 20:35:07 54749 <54743> 64b /bin/bash -c echo a | sed -E -e ‘s/a/b/‘ 2>/dev/null
2015 Oct 2 20:35:07 54751 <54749> 64b sed -E -e s/a/b/
2015 Oct 2 20:35:07 54752 <54743> 64b /bin/bash -c test -d device && find device -maxdepth 6 -name AndroidProducts.mk
2015 Oct 2 20:35:07 54753 <54752> 64b find device -maxdepth 6 -name AndroidProducts.mk
2015 Oct 2 20:35:07 54754 <54743> 64b /bin/bash -c test -d vendor && find vendor -maxdepth 6 -name AndroidProducts.mk
2015 Oct 2 20:35:07 54755 <54743> 64b /bin/bash -c test -d device && find device -maxdepth 4 -path ‘*/generic/BoardConfig.mk‘
2015 Oct 2 20:35:07 54756 <54755> 64b find device -maxdepth 4 -path */generic/BoardConfig.mk
2015 Oct 2 20:35:07 54757 <54743> 64b /bin/bash -c test -d vendor && find vendor -maxdepth 4 -path ‘*/generic/BoardConfig.mk‘
2015 Oct 2 20:35:07 54758 <54743> 64b /bin/bash -c prebuilts/gcc/darwin-x86/arm/arm-linux-androideabi-4.8/bin/arm-linux-androideabi-gcc -fno-exceptions -Wno-multichar -msoft-float (...)
2015 Oct 2 20:35:07 54758 <54743> 64b prebuilts/gcc/darwin-x86/arm/arm-linux-androideabi-4.8/bin/arm-linux-androideabi-gcc -fno-exceptions -Wno-multichar -msoft -float -ffunction-sections -fdata-sections <...>
2015 Oct 2 20:35:07 54759 <54743> 64b /bin/bash -c prebuilts/gcc/darwin-x86/arm/arm-linux-androideabi-4.8/bin/arm-linux-androideabi-gcc -fno-exceptions -Wno-multichar -msoft-float (...)
2015 Oct 2 20:35:07 54759 <54743> 64b prebuilts/gcc/darwin-x86/arm/arm-linux-androideabi-4.8/bin/arm-linux-androideabi-gcc -fno-exceptions -Wno-multichar -msoft -float -ffunction-sections -fdata-sections <...>
2015 Oct 2 20:35:07 54760 <54743> 64b /bin/bash -c build/core/find-jdk-tools-jar.sh
2015 Oct 2 20:35:07 54760 <54743> 64b /bin/sh build/core/find-jdk-tools-jar.sh
2015 Oct 2 20:35:07 54761 <54760> 64b which javac
2015 Oct 2 20:35:07 54762 <54760> 64b ls -l /usr/bin/javac
2015 Oct 2 20:35:08 54765 <54763> 64b sed -e s/.* -> //
2015 Oct 2 20:35:08 54767 <54760> 64b sed -e s:\(.*\)/bin/javac.*:\1/lib/tools.jar:
2015 Oct 2 20:35:08 54768 <54743> 64b /bin/bash -c java -version 2>&1
2015 Oct 2 20:35:08 54769 <54768> 64b java -version
2015 Oct 2 20:35:08 54769 <54768> 64b /usr/bin/java -version
2015 Oct 2 20:35:08 54770 <54743> 64b /bin/bash -c function sgrax() { while [ -n "$1" ] ; do echo $1 ; shift ; done } ; ( sgrax 10 11 12 13 14 15 16 17 18 19 20 21 4 5 6 7 8 9 cu (...)
2015 Oct 2 20:35:08 54773 <54771> 64b sort -g
2015 Oct 2 20:35:08 54774 <54743> 64b /bin/bash -c python -c "import platform; print(platform.platform())"
2015 Oct 2 20:35:08 54774 <54743> 64b python -c import platform; print(platform.platform())
2015 Oct 2 20:35:08 54774 <54743> 64b python -c import platform; print(platform.platform())
2015 Oct 2 20:35:08 54775 <54774> 64b sh -c uname -p 2> /dev/null
2015 Oct 2 20:35:08 54776 <54775> 64b uname -p
2015 Oct 2 20:35:08 54777 <54774> 64b file /usr/bin/python
2015 Oct 2 20:35:08 54778 <54743> 64b /bin/bash -c mkdir -p /Users/q/Documents/android_out/android_src/target/product/generic/ && echo "PREVIOUS_BUILD_CONFIG := full-eng-{ en_US,en (...)
2015 Oct 2 20:35:08 54779 <54778> 64b mkdir -p /Users/q/Documents/android_out/android_src/target/product/generic/
2015 Oct 2 20:35:08 54780 <54743> 64b /bin/bash -c mkdir -p /Users/q/Documents/android_out/android_src ; echo a > /Users/q/Documents/android_out/android_src/casecheck.txt ; echo B (...)
2015 Oct 2 20:35:08 54781 <54780> 64b mkdir -p /Users/q/Documents/android_out/android_src
2015 Oct 2 20:35:08 54782 <54780> 64b cat /Users/q/Documents/android_out/android_src/casecheck.txt
2015 Oct 2 20:35:08 54783 <54743> 64b /bin/bash -c pwd
2015 Oct 2 20:35:08 54784 <54743> 64b /bin/bash -c unset _JAVA_OPTIONS && java -version 2>&1
2015 Oct 2 20:35:08 54785 <54784> 64b java -version
2015 Oct 2 20:35:08 54785 <54784> 64b /usr/bin/java -version
2015 Oct 2 20:35:08 54786 <54743> 64b /bin/bash -c unset _JAVA_OPTIONS && javac -version 2>&1
2015 Oct 2 20:35:08 54787 <54786> 64b javac -version
2015 Oct 2 20:35:08 54787 <54786> 64b /usr/bin/javac -version
2015 Oct2 20:35:08 54788 <54743> 64b /bin/bash -c echo 'java version "1.8.0_51" Java(TM) SE Runtime Environment (build 1.8.0_51-b16) Java HotSpot(TM) 64-Bit Server VM (build 25.5 (...)
2015 Oct 2 20:35:08 54790 <54788> 64b grep ^java .*[ "]1\.7[\. "$]
2015 Oct 2 20:35:08 54791 <54743> 64b /bin/bash -c echo ‘javac 1.8.0_51‘ | grep ‘[ "]1\.7[\. "$] ‘
2015 Oct 2 20:35:08 54793 <54791> 64b grep [ "]1\.7[\. "$]
Similarly, Iosnoop is used to display file access in real time, no post. Other Dtruss and Dapptrace can experience.
DTrace is really moving inside, with over 980,000 static trace points set up throughout the system,
DTrace can even dynamically turn the public functions of third-party DLLs (*.DYLB) to high-speed, perfect hooks, automatically generating traces, according to internal Danale, using the function pointer table patch +INT3 technology, which is much faster than the same type API Spy tool on Windows. and stable, and there is no memory that affects user space! Completely in the kernel, all API parameters and stacks can be written out by script. Of course, you can also invoke the DTrace API on your own to produce unique trace information, such as Nodejs, Chrome, Firefox and other things like dtrace!
By contrast, while the Windows system is similar to the mechanism ETW (Event Trace for Windows), static trace points are only tens of thousands of. ETW cannot dynamically insert a trace in a third-party DLL in this way, but it needs to generate the trace itself in the DLL calling ETW's API. Tools such as Xperf based on ETW are much weaker, not only to display information, but also to not display the API name, or write script control, which is behind the Windows boss.
DTrace This kind of thing, practice well is like to practice the high-level internal organs of such a door, have the strength not panic.
Mac OS X's powerful tool dtrace enables Process/file monitor, especially for troubleshooting