]> git.saurik.com Git - apple/xnu.git/blob - tools/trace/ios_trace_ipc.sh
xnu-4570.71.2.tar.gz
[apple/xnu.git] / tools / trace / ios_trace_ipc.sh
1 #!/bin/sh
2 #
3 # Initiate tracing
4 CODE_MACH_KMSG_INFO=0x1200028
5 CODE_MACH_PROC_EXEC=0x401000C
6 CODE_MACH_MSG_SEND=0x120000C
7 CODE_MACH_MSG_RECV=0x1200010
8 CODE_TRACE_DATA_EXEC=0x7000008
9
10 ofile=${1:-ipc.raw}
11 sleepsec=${2:-3}
12
13 trace -i -b 8192
14 trace -n
15 trace -g
16 if [ $sleepsec -gt 0 ]; then
17 echo ""
18 echo "Sleeping for ${sleepsec}..."
19 sleep ${sleepsec}
20 fi
21 echo "Tracing!"
22
23 ps -Ac | sed 's,\s*\([0-9][0-9]*\) .*[0-9]*:[0-9]*\.[0-9]* \(.*\), 00000000.0 0.0(0.0) proc_exec \1 0 0 0 0 0 \2,' > "ps_${ofile}.txt"
24 trace -L ${ofile} -k ${CODE_MACH_KMSG_INFO} -k ${CODE_MACH_PROC_EXEC} -k ${CODE_MACH_MSG_SEND} -k ${CODE_MACH_MSG_RECV}