Skip to content

Instantly share code, notes, and snippets.

@rkmathi
Last active August 29, 2015 14:23
Show Gist options
  • Save rkmathi/4ab2ab8d8eada189c2d9 to your computer and use it in GitHub Desktop.
Save rkmathi/4ab2ab8d8eada189c2d9 to your computer and use it in GitHub Desktop.
$ sudo dtruss
$ sudo dtruss ./a.out > /dev/null
this is text file.
SYSCALL(args) = return
thread_selfid(0x0, 0x0, 0x0) = 1704016 0
open(".\0", 0x0, 0x1) = 3 0
fstat64(0x3, 0x7FFF5F10AEB0, 0x1) = 0 0
fcntl(0x3, 0x32, 0x7FFF5F10B1A0) = 0 0
close(0x3) = 0 0
stat64("/Users/rkmathi/tmp/ruby/two_rank_down\0", 0x7FFF5F10AE20, 0x7FFF5F10B1A0) = 0 0
csops(0x0, 0x0, 0x7FFF5F10B118) = 0 0
issetugid(0x0, 0x0, 0x7FFF5F10B118) = 0 0
shared_region_check_np(0x7FFF5F109058, 0x0, 0x7FFF5F10B118) = 0 0
stat64("/usr/lib/dtrace/libdtrace_dyld.dylib\0", 0x7FFF5F10A1E8, 0x7FFF5F10B118) = 0 0
open("/usr/lib/dtrace/libdtrace_dyld.dylib\0", 0x0, 0x0) = 3 0
pread(0x3, "\312\376\272\276\0", 0x1000, 0x0) = 4096 0
pread(0x3, "\317\372\355\376\a\0", 0x1000, 0x1000) = 4096 0
fcntl(0x3, 0x3D, 0x7FFF5F108550) = 0 0
mmap(0x100AFE000, 0x2000, 0x5, 0x12, 0x3, 0x1000) = 0x100AFE000 0
mmap(0x100B00000, 0x1000, 0x3, 0x12, 0x3, 0x3000) = 0x100B00000 0
mmap(0x100B01000, 0x1FC0, 0x1, 0x12, 0x3, 0x4000) = 0x100B01000 0
close(0x3) = 0 0
stat64("/usr/lib/dtrace/libdtrace_dyld.dylib\0", 0x7FFF5F10AB68, 0x1) = 0 0
stat64("/usr/lib/libSystem.B.dylib\0", 0x7FFF5F10A018, 0x1) = 0 0
stat64("/usr/lib/system/libcache.dylib\0", 0x7FFF5F109C08, 0x1) = 0 0
stat64("/usr/lib/system/libcommonCrypto.dylib\0", 0x7FFF5F109C08, 0x1) = 0 0
stat64("/usr/lib/system/libcompiler_rt.dylib\0", 0x7FFF5F109C08, 0x1) = 0 0
stat64("/usr/lib/system/libcopyfile.dylib\0", 0x7FFF5F109C08, 0x1) = 0 0
stat64("/usr/lib/system/libcorecrypto.dylib\0", 0x7FFF5F109C08, 0x1) = 0 0
stat64("/usr/lib/system/libdispatch.dylib\0", 0x7FFF5F109C08, 0x1) = 0 0
stat64("/usr/lib/system/libdyld.dylib\0", 0x7FFF5F109C08, 0x1) = 0 0
stat64("/usr/lib/system/libkeymgr.dylib\0", 0x7FFF5F109C08, 0x1) = 0 0
stat64("/usr/lib/system/liblaunch.dylib\0", 0x7FFF5F109C08, 0x1) = 0 0
stat64("/usr/lib/system/libmacho.dylib\0", 0x7FFF5F109C08, 0x1) = 0 0
stat64("/usr/lib/system/libquarantine.dylib\0", 0x7FFF5F109C08, 0x1) = 0 0
stat64("/usr/lib/system/libremovefile.dylib\0", 0x7FFF5F109C08, 0x1) = 0 0
stat64("/usr/lib/system/libsystem_asl.dylib\0", 0x7FFF5F109C08, 0x1) = 0 0
stat64("/usr/lib/system/libsystem_blocks.dylib\0", 0x7FFF5F109C08, 0x1) = 0 0
stat64("/usr/lib/system/libsystem_c.dylib\0", 0x7FFF5F109C08, 0x1) = 0 0
stat64("/usr/lib/system/libsystem_configuration.dylib\0", 0x7FFF5F109C08, 0x1) = 0 0
stat64("/usr/lib/system/libsystem_coreservices.dylib\0", 0x7FFF5F109C08, 0x1) = 0 0
stat64("/usr/lib/system/libsystem_coretls.dylib\0", 0x7FFF5F109C08, 0x1) = 0 0
stat64("/usr/lib/system/libsystem_dnssd.dylib\0", 0x7FFF5F109C08, 0x1) = 0 0
stat64("/usr/lib/system/libsystem_info.dylib\0", 0x7FFF5F109C08, 0x1) = 0 0
stat64("/usr/lib/system/libsystem_kernel.dylib\0", 0x7FFF5F109C08, 0x1) = 0 0
stat64("/usr/lib/system/libsystem_m.dylib\0", 0x7FFF5F109C08, 0x1) = 0 0
stat64("/usr/lib/system/libsystem_malloc.dylib\0", 0x7FFF5F109C08, 0x1) = 0 0
stat64("/usr/lib/system/libsystem_network.dylib\0", 0x7FFF5F109C08, 0x1) = 0 0
stat64("/usr/lib/system/libsystem_networkextension.dylib\0", 0x7FFF5F109C08, 0x1) = 0 0
stat64("/usr/lib/system/libsystem_notify.dylib\0", 0x7FFF5F109C08, 0x1) = 0 0
stat64("/usr/lib/system/libsystem_platform.dylib\0", 0x7FFF5F109C08, 0x1) = 0 0
stat64("/usr/lib/system/libsystem_pthread.dylib\0", 0x7FFF5F109C08, 0x1) = 0 0
stat64("/usr/lib/system/libsystem_sandbox.dylib\0", 0x7FFF5F109C08, 0x1) = 0 0
stat64("/usr/lib/system/libsystem_secinit.dylib\0", 0x7FFF5F109C08, 0x1) = 0 0
stat64("/usr/lib/system/libsystem_stats.dylib\0", 0x7FFF5F109C08, 0x1) = 0 0
stat64("/usr/lib/system/libsystem_trace.dylib\0", 0x7FFF5F109C08, 0x1) = 0 0
stat64("/usr/lib/system/libunc.dylib\0", 0x7FFF5F109C08, 0x1) = 0 0
stat64("/usr/lib/system/libunwind.dylib\0", 0x7FFF5F109C08, 0x1) = 0 0
stat64("/usr/lib/system/libxpc.dylib\0", 0x7FFF5F109C08, 0x1) = 0 0
stat64("/usr/lib/libobjc.A.dylib\0", 0x7FFF5F108EE8, 0x1) = 0 0
stat64("/usr/lib/libobjc.A.dylib\0", 0x7FFF5F108EE8, 0x1) = 0 0
stat64("/usr/lib/libauto.dylib\0", 0x7FFF5F108EE8, 0x1) = 0 0
stat64("/usr/lib/libc++abi.dylib\0", 0x7FFF5F108DC8, 0x1) = 0 0
stat64("/usr/lib/libc++.1.dylib\0", 0x7FFF5F108DC8, 0x1) = 0 0
stat64("/usr/lib/libDiagnosticMessagesClient.dylib\0", 0x7FFF5F108CB8, 0x1) = 0 0
getpid(0x7FFF8BDD4740, 0x7FFF5F108CB8, 0x1) = 68594 0
open("/dev/dtracehelper\0", 0x2, 0x7FFF5F10B010) = 3 0
ioctl(0x3, 0x80086804, 0x7FFF5F10AF98) = 0 0
close(0x3) = 0 0
sysctl(0x7FFF5F10A658, 0x2, 0x7FFF5F10A668) = 0 0
thread_selfid(0x7FFF5F10A658, 0x2, 0x7FFF5F10A668) = 1704016 0
bsdthread_register(0x7FFF86951410, 0x7FFF86951400, 0x2000) = 1073741855 0
mprotect(0x100AF9000, 0x88, 0x1) = 0 0
mprotect(0x100B03000, 0x1000, 0x0) = 0 0
mprotect(0x100B19000, 0x1000, 0x0) = 0 0
mprotect(0x100B1A000, 0x1000, 0x0) = 0 0
mprotect(0x100B30000, 0x1000, 0x0) = 0 0
mprotect(0x100AFB000, 0x1000, 0x1) = 0 0
mprotect(0x100AF9000, 0x88, 0x3) = 0 0
mprotect(0x100AF9000, 0x88, 0x1) = 0 0
issetugid(0x100AF9000, 0x88, 0x1) = 0 0
getpid(0x100AF9000, 0x88, 0x1) = 68594 0
stat64("/AppleInternal/XBS/.isChrooted\0", 0x7FFF5F10A5B8, 0x1) = -1 Err#2
stat64("/BuildSupport/makeProject\0", 0x7FFF5F10A5B8, 0x1) = -1 Err#2
stat64("/AppleInternal\0", 0x7FFF5F10A528, 0x1) = -1 Err#2
csops(0x10BF2, 0x7, 0x7FFF5F10A050) = -1 Err#22
csops(0x10BF2, 0x7, 0x7FFF5F109930) = -1 Err#22
getrlimit(0x1008, 0x7FFF5F10B7F0, 0x7FFF5F109930) = 0 0
open_nocancel("./TEXT.txt\0", 0x0, 0x1B6) = 3 0
fstat64(0x3, 0x7FFF5F10B898, 0x1B6) = 0 0
read_nocancel(0x3, "this is text file.\n\0", 0x1000) = 19 0
fstat64(0x1, 0x7FFF5F10B848, 0x1000) = 0 0
ioctl(0x1, 0x4004667A, 0x7FFF5F10B88C) = 0 0
write_nocancel(0x1, "this is text file.\n\0", 0x13) = 19 0
write_nocancel(0x1, "\n\0", 0x1) = 1 0
$ sudo dtruss ruby read_text.rb > /dev/null
SYSCALL(args) = return
thread_selfid(0x0, 0x0, 0x0) = 1714254 0
csops(0x0, 0x0, 0x7FFF5B1770A8) = 0 0
issetugid(0x0, 0x0, 0x7FFF5B1770A8) = 0 0
shared_region_check_np(0x7FFF5B174FE8, 0x0, 0x7FFF5B1770A8) = 0 0
stat64("/usr/lib/dtrace/libdtrace_dyld.dylib\0", 0x7FFF5B176178, 0x7FFF5B1770A8) = 0 0
open("/usr/lib/dtrace/libdtrace_dyld.dylib\0", 0x0, 0x0) = 3 0
pread(0x3, "\312\376\272\276\0", 0x1000, 0x0) = 4096 0
pread(0x3, "\317\372\355\376\a\0", 0x1000, 0x1000) = 4096 0
fcntl(0x3, 0x3D, 0x7FFF5B1744E0) = 0 0
mmap(0x104A91000, 0x2000, 0x5, 0x12, 0x3, 0x1000) = 0x104A91000 0
mmap(0x104A93000, 0x1000, 0x3, 0x12, 0x3, 0x3000) = 0x104A93000 0
mmap(0x104A94000, 0x1FC0, 0x1, 0x12, 0x3, 0x4000) = 0x104A94000 0
close(0x3) = 0 0
stat64("/usr/lib/dtrace/libdtrace_dyld.dylib\0", 0x7FFF5B176AF8, 0x1) = 0 0
stat64("/usr/lib/libSystem.B.dylib\0", 0x7FFF5B175FA8, 0x1) = 0 0
stat64("/usr/lib/system/libcache.dylib\0", 0x7FFF5B175B98, 0x1) = 0 0
stat64("/usr/lib/system/libcommonCrypto.dylib\0", 0x7FFF5B175B98, 0x1) = 0 0
stat64("/usr/lib/system/libcompiler_rt.dylib\0", 0x7FFF5B175B98, 0x1) = 0 0
stat64("/usr/lib/system/libcopyfile.dylib\0", 0x7FFF5B175B98, 0x1) = 0 0
stat64("/usr/lib/system/libcorecrypto.dylib\0", 0x7FFF5B175B98, 0x1) = 0 0
stat64("/usr/lib/system/libdispatch.dylib\0", 0x7FFF5B175B98, 0x1) = 0 0
stat64("/usr/lib/system/libdyld.dylib\0", 0x7FFF5B175B98, 0x1) = 0 0
stat64("/usr/lib/system/libkeymgr.dylib\0", 0x7FFF5B175B98, 0x1) = 0 0
stat64("/usr/lib/system/liblaunch.dylib\0", 0x7FFF5B175B98, 0x1) = 0 0
stat64("/usr/lib/system/libmacho.dylib\0", 0x7FFF5B175B98, 0x1) = 0 0
stat64("/usr/lib/system/libquarantine.dylib\0", 0x7FFF5B175B98, 0x1) = 0 0
stat64("/usr/lib/system/libremovefile.dylib\0", 0x7FFF5B175B98, 0x1) = 0 0
stat64("/usr/lib/system/libsystem_asl.dylib\0", 0x7FFF5B175B98, 0x1) = 0 0
stat64("/usr/lib/system/libsystem_blocks.dylib\0", 0x7FFF5B175B98, 0x1) = 0 0
stat64("/usr/lib/system/libsystem_c.dylib\0", 0x7FFF5B175B98, 0x1) = 0 0
stat64("/usr/lib/system/libsystem_configuration.dylib\0", 0x7FFF5B175B98, 0x1) = 0 0
stat64("/usr/lib/system/libsystem_coreservices.dylib\0", 0x7FFF5B175B98, 0x1) = 0 0
stat64("/usr/lib/system/libsystem_coretls.dylib\0", 0x7FFF5B175B98, 0x1) = 0 0
stat64("/usr/lib/system/libsystem_dnssd.dylib\0", 0x7FFF5B175B98, 0x1) = 0 0
stat64("/usr/lib/system/libsystem_info.dylib\0", 0x7FFF5B175B98, 0x1) = 0 0
stat64("/usr/lib/system/libsystem_kernel.dylib\0", 0x7FFF5B175B98, 0x1) = 0 0
stat64("/usr/lib/system/libsystem_m.dylib\0", 0x7FFF5B175B98, 0x1) = 0 0
stat64("/usr/lib/system/libsystem_malloc.dylib\0", 0x7FFF5B175B98, 0x1) = 0 0
stat64("/usr/lib/system/libsystem_network.dylib\0", 0x7FFF5B175B98, 0x1) = 0 0
stat64("/usr/lib/system/libsystem_networkextension.dylib\0", 0x7FFF5B175B98, 0x1) = 0 0
stat64("/usr/lib/system/libsystem_notify.dylib\0", 0x7FFF5B175B98, 0x1) = 0 0
stat64("/usr/lib/system/libsystem_platform.dylib\0", 0x7FFF5B175B98, 0x1) = 0 0
stat64("/usr/lib/system/libsystem_pthread.dylib\0", 0x7FFF5B175B98, 0x1) = 0 0
stat64("/usr/lib/system/libsystem_sandbox.dylib\0", 0x7FFF5B175B98, 0x1) = 0 0
stat64("/usr/lib/system/libsystem_secinit.dylib\0", 0x7FFF5B175B98, 0x1) = 0 0
stat64("/usr/lib/system/libsystem_stats.dylib\0", 0x7FFF5B175B98, 0x1) = 0 0
stat64("/usr/lib/system/libsystem_trace.dylib\0", 0x7FFF5B175B98, 0x1) = 0 0
stat64("/usr/lib/system/libunc.dylib\0", 0x7FFF5B175B98, 0x1) = 0 0
stat64("/usr/lib/system/libunwind.dylib\0", 0x7FFF5B175B98, 0x1) = 0 0
stat64("/usr/lib/system/libxpc.dylib\0", 0x7FFF5B175B98, 0x1) = 0 0
stat64("/usr/lib/libobjc.A.dylib\0", 0x7FFF5B174E78, 0x1) = 0 0
stat64("/usr/lib/libauto.dylib\0", 0x7FFF5B174E78, 0x1) = 0 0
stat64("/usr/lib/libc++abi.dylib\0", 0x7FFF5B174D58, 0x1) = 0 0
stat64("/usr/lib/libc++.1.dylib\0", 0x7FFF5B174D58, 0x1) = 0 0
stat64("/usr/lib/libDiagnosticMessagesClient.dylib\0", 0x7FFF5B174C48, 0x1) = 0 0
getpid(0x7FFF8BDD4740, 0x7FFF5B174C48, 0x1) = 69063 0
open("/dev/dtracehelper\0", 0x2, 0x7FFF5B176FA0) = 3 0
ioctl(0x3, 0x80086804, 0x7FFF5B176F28) = 0 0
close(0x3) = 0 0
stat64("/usr/lib/dtrace/libdtrace_dyld.dylib\0", 0x7FFF5B176AF8, 0x1) = 0 0
stat64("/usr/lib/libSystem.B.dylib\0", 0x7FFF5B175FA8, 0x1) = 0 0
stat64("/usr/lib/system/libcache.dylib\0", 0x7FFF5B175B98, 0x1) = 0 0
stat64("/usr/lib/system/libcommonCrypto.dylib\0", 0x7FFF5B175B98, 0x1) = 0 0
stat64("/usr/lib/system/libcompiler_rt.dylib\0", 0x7FFF5B175B98, 0x1) = 0 0
stat64("/usr/lib/system/libcopyfile.dylib\0", 0x7FFF5B175B98, 0x1) = 0 0
stat64("/usr/lib/system/libcorecrypto.dylib\0", 0x7FFF5B175B98, 0x1) = 0 0
stat64("/usr/lib/system/libdispatch.dylib\0", 0x7FFF5B175B98, 0x1) = 0 0
stat64("/usr/lib/system/libdyld.dylib\0", 0x7FFF5B175B98, 0x1) = 0 0
stat64("/usr/lib/system/libkeymgr.dylib\0", 0x7FFF5B175B98, 0x1) = 0 0
stat64("/usr/lib/system/liblaunch.dylib\0", 0x7FFF5B175B98, 0x1) = 0 0
stat64("/usr/lib/system/libmacho.dylib\0", 0x7FFF5B175B98, 0x1) = 0 0
stat64("/usr/lib/system/libquarantine.dylib\0", 0x7FFF5B175B98, 0x1) = 0 0
stat64("/usr/lib/system/libremovefile.dylib\0", 0x7FFF5B175B98, 0x1) = 0 0
stat64("/usr/lib/system/libsystem_asl.dylib\0", 0x7FFF5B175B98, 0x1) = 0 0
stat64("/usr/lib/system/libsystem_blocks.dylib\0", 0x7FFF5B175B98, 0x1) = 0 0
stat64("/usr/lib/system/libsystem_c.dylib\0", 0x7FFF5B175B98, 0x1) = 0 0
stat64("/usr/lib/system/libsystem_configuration.dylib\0", 0x7FFF5B175B98, 0x1) = 0 0
stat64("/usr/lib/system/libsystem_coreservices.dylib\0", 0x7FFF5B175B98, 0x1) = 0 0
stat64("/usr/lib/system/libsystem_coretls.dylib\0", 0x7FFF5B175B98, 0x1) = 0 0
stat64("/usr/lib/system/libsystem_dnssd.dylib\0", 0x7FFF5B175B98, 0x1) = 0 0
stat64("/usr/lib/system/libsystem_info.dylib\0", 0x7FFF5B175B98, 0x1) = 0 0
stat64("/usr/lib/system/libsystem_kernel.dylib\0", 0x7FFF5B175B98, 0x1) = 0 0
stat64("/usr/lib/system/libsystem_m.dylib\0", 0x7FFF5B175B98, 0x1) = 0 0
stat64("/usr/lib/system/libsystem_malloc.dylib\0", 0x7FFF5B175B98, 0x1) = 0 0
stat64("/usr/lib/system/libsystem_network.dylib\0", 0x7FFF5B175B98, 0x1) = 0 0
stat64("/usr/lib/system/libsystem_networkextension.dylib\0", 0x7FFF5B175B98, 0x1) = 0 0
stat64("/usr/lib/system/libsystem_notify.dylib\0", 0x7FFF5B175B98, 0x1) = 0 0
stat64("/usr/lib/system/libsystem_platform.dylib\0", 0x7FFF5B175B98, 0x1) = 0 0
stat64("/usr/lib/system/libsystem_pthread.dylib\0", 0x7FFF5B175B98, 0x1) = 0 0
stat64("/usr/lib/system/libsystem_sandbox.dylib\0", 0x7FFF5B175B98, 0x1) = 0 0
stat64("/usr/lib/system/libsystem_secinit.dylib\0", 0x7FFF5B175B98, 0x1) = 0 0
stat64("/usr/lib/system/libsystem_stats.dylib\0", 0x7FFF5B175B98, 0x1) = 0 0
stat64("/usr/lib/system/libsystem_trace.dylib\0", 0x7FFF5B175B98, 0x1) = 0 0
stat64("/usr/lib/system/libunc.dylib\0", 0x7FFF5B175B98, 0x1) = 0 0
stat64("/usr/lib/system/libunwind.dylib\0", 0x7FFF5B175B98, 0x1) = 0 0
stat64("/usr/lib/system/libxpc.dylib\0", 0x7FFF5B175B98, 0x1) = 0 0
stat64("/usr/lib/libobjc.A.dylib\0", 0x7FFF5B174E78, 0x1) = 0 0
stat64("/usr/lib/libauto.dylib\0", 0x7FFF5B174E78, 0x1) = 0 0
stat64("/usr/lib/libc++abi.dylib\0", 0x7FFF5B174D58, 0x1) = 0 0
stat64("/usr/lib/libc++.1.dylib\0", 0x7FFF5B174D58, 0x1) = 0 0
stat64("/usr/lib/libDiagnosticMessagesClient.dylib\0", 0x7FFF5B174C48, 0x1) = 0 0
getpid(0x7FFF8BDD4740, 0x7FFF5B174C48, 0x1) = 69063 0
open("/dev/dtracehelper\0", 0x2, 0x7FFF5B176FA0) = 3 0
ioctl(0x3, 0x80086804, 0x7FFF5B176F28) = 0 0
close(0x3) = 0 0
sysctl(0x7FFF5B1765E8, 0x2, 0x7FFF5B1765F8) = 0 0
thread_selfid(0x7FFF5B1765E8, 0x2, 0x7FFF5B1765F8) = 1714254 0
bsdthread_register(0x7FFF86951410, 0x7FFF86951400, 0x2000) = 1073741855 0
mprotect(0x104A8E000, 0x88, 0x1) = 0 0
mprotect(0x104A96000, 0x1000, 0x0) = 0 0
mprotect(0x104AAC000, 0x1000, 0x0) = 0 0
mprotect(0x104AAD000, 0x1000, 0x0) = 0 0
mprotect(0x104AC3000, 0x1000, 0x0) = 0 0
mprotect(0x104A90000, 0x1000, 0x1) = 0 0
mprotect(0x104A8E000, 0x88, 0x3) = 0 0
mprotect(0x104A8E000, 0x88, 0x1) = 0 0
issetugid(0x104A8E000, 0x88, 0x1) = 0 0
getpid(0x104A8E000, 0x88, 0x1) = 69063 0
stat64("/AppleInternal/XBS/.isChrooted\0", 0x7FFF5B176548, 0x1) = -1 Err#2
stat64("/BuildSupport/makeProject\0", 0x7FFF5B176548, 0x1) = -1 Err#2
stat64("/AppleInternal\0", 0x7FFF5B1764B8, 0x1) = -1 Err#2
stat64("/BuildSupport/makeProject\0", 0x7FFF5B176548, 0x1) = -1 Err#2
stat64("/AppleInternal\0", 0x7FFF5B1764B8, 0x1) = -1 Err#2
csops(0x10DC7, 0x7, 0x7FFF5B175FE0) = 0 0
csops(0x10DC7, 0x7, 0x7FFF5B1758C0) = 0 0
...
execve("/usr/local/bin/bash\0", 0x7FFF5B177A28, 0x7FFF5B177A48) = -1 Err#2
execve("/usr/sbin/bash\0", 0x7FFF5B177A28, 0x7FFF5B177A48) = -1 Err#2
execve("/usr/bin/bash\0", 0x7FFF5B177A28, 0x7FFF5B177A48) = -1 Err#2
execve("/sbin/bash\0", 0x7FFF5B177A28, 0x7FFF5B177A48) = -1 Err#2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment