나는 OSX 10.9에 this gist의 예를 구축하기 위해 노력하고있어 :dtruss가 DYLD_BIND_AT_LAUNCH이고 sshfs가 OSX 10.9에 탑재됩니까?
cd /tmp
git clone https://gist.github.com/ecfd80885b9ddf6734192c056cf48bf4.git fopentest
cd fopentest
bash buildrun.sh
빌드가 성공 - 그리고 또한, 나는 터미널 출력에서 다음을 볼 수 있습니다
...
+ DYLD_BIND_AT_LAUNCH=YES
+ ./fopentest.exe ./mytestfile.txt
This is a wrapper function for fopen.
=== this is mytestfile.txt ===
Second line here...
Third line here...
하는 의미 그 DYLD_BIND_AT_LAUNCH=YES ./fopentest.exe ./mytestfile.txt
호출이 랩퍼 라이브러리 및 기능을 찾았습니다.
테스트와 마찬가지로 dtruss
, OSX “strace” equivalent을 통해이 실행 파일을 실행하고 싶습니다. 해당 링크에서 recomm39로도 sudo chmod u+s /usr/sbin/dtrace
을 수행했습니다. 그래서 /tmp
폴더에 시도 :
$ DYLD_BIND_AT_LAUNCH=YES dtruss ./fopentest.exe ./mytestfile.txt 2>&1 | grep wrap
This is a wrapper function for fopen.
stat64("libwrapper.dylib\0", 0x7FFF5A7DF248, 0x7FFF5A7E00E0) = 0 0
open("libwrapper.dylib\0", 0x0, 0x0) = 3 0
write_nocancel(0x1, "This is a wrapper function for fopen.\n=== this is mytestfile.txt ===\nSecond line here...\nThird line here...\n\0", 0x6C) = 108 0
그래서, 명확하게 dtruss
여기에 작동합니다. 그러나, 나는 다른 디렉토리에서 동일한 파일을 가지고, 내가 같은 명령을 실행하려고하는 이유, dtruss
실패 :
$ DYLD_BIND_AT_LAUNCH=YES dtruss ./fopentest.exe ./mytestfile.txt 2>&1 | grep wrap
dyld: Library not loaded: libwrapper.dylib
stat64("libwrapper.dylib\0", 0x7FFF4FD85228, 0x7FFF4FD860C0) = 0 0
open("libwrapper.dylib\0", 0x0, 0x0) = -1 Err#2
stat64("/Users/MYNAME/lib/libwrapper.dylib\0", 0x7FFF4FD85A08, 0x7FFF4FD860C0) = -1 Err#2
stat64("/usr/local/lib/libwrapper.dylib\0", 0x7FFF4FD85A08, 0x7FFF4FD860C0) = -1 Err#2
stat64("/usr/lib/libwrapper.dylib\0", 0x7FFF4FD85A18, 0x7FFF4FD860C0) = -1 Err#2
무엇 아마도 이것에 대한 이유가 될 수 있을까?