Skip to content

Instantly share code, notes, and snippets.

@wtfbbqhax
Last active August 27, 2016 17:42
Show Gist options
  • Save wtfbbqhax/b85081a4721aa305af49bae9559ad3dd to your computer and use it in GitHub Desktop.
Save wtfbbqhax/b85081a4721aa305af49bae9559ad3dd to your computer and use it in GitHub Desktop.
OSX traces of Tremulous .app bundle failing Pk3 bootstrap
~ ❯❯❯ lldb -n tremulous
(lldb) process attach --name "tremulous"
Process 81586 stopped
* thread #1: tid = 0x2fc8f7b, 0x00007fff966b52a2 libsystem_kernel.dylib`poll + 10, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
    frame #0: 0x00007fff966b52a2 libsystem_kernel.dylib` poll  + 10
libsystem_kernel.dylib`poll:
->  0x7fff966b52a2 <+10>: jae    0x7fff966b52ac            ; <+20>
    0x7fff966b52a4 <+12>: mov    rdi, rax
    0x7fff966b52a7 <+15>: jmp    0x7fff966ae7f2            ; cerror
    0x7fff966b52ac <+20>: ret

Executable module set to "/Users/viroemer/Devel/wtfbbqhax/tremulous/build/Tremulous.app/Contents/MacOS/tremulous".
Architecture set to: x86_64h-apple-macosx.
(lldb) ps
error: 'ps' is not a valid command.
error: Unrecognized command 'ps'.
(lldb) bt
* thread #1: tid = 0x2fc8f7b, 0x00007fff966b52a2 libsystem_kernel.dylib`poll + 10, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
  * frame #0: 0x00007fff966b52a2 libsystem_kernel.dylib` poll  + 10
    frame #1: 0x00007fff97c7f746 libcurl.4.dylib` Curl_poll  + 140
    frame #2: 0x00007fff97c7b53e libcurl.4.dylib` curl_multi_wait  + 530
    frame #3: 0x00007fff97c74aa9 libcurl.4.dylib` curl_easy_perform  + 245
    frame #4: 0x0000000104e36857 tremulous` RestClient::Connection::performCurlRequest(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const
&)  + 1159
    frame #5: 0x0000000104e36a6e tremulous` RestClient::Connection::get(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)  + 14
    frame #6: 0x0000000104e38095 tremulous` RestClient::get(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)  + 165
    frame #7: 0x0000000104e38f46 tremulous` GetTremulousPk3s  + 1750
    frame #8: 0x0000000104d97718 tremulous` FS_InitFilesystem  + 216
    frame #9: 0x0000000104d8dd2e tremulous` Com_Init  + 862
    frame #10: 0x0000000104dce6f1 tremulous` main  + 465
    frame #11: 0x0000000104d5c884 tremulous` start  + 52
(lldb) up
frame #1: 0x00007fff97c7f746 libcurl.4.dylib` Curl_poll  + 140
libcurl.4.dylib`Curl_poll:
    0x7fff97c7f746 <+140>: cmp    eax, -0x1
    0x7fff97c7f749 <+143>: jne    0x7fff97c7f793            ; <+217>
    0x7fff97c7f74b <+145>: call   0x7fff97c96f10            ; symbol stub for: __error
    0x7fff97c7f750 <+150>: mov    eax, dword ptr [rax]
(lldb)
frame #2: 0x00007fff97c7b53e libcurl.4.dylib` curl_multi_wait  + 530
(lldb)
frame #3: 0x00007fff97c74aa9 libcurl.4.dylib` curl_easy_perform  + 245
libcurl.4.dylib`curl_easy_perform:
    0x7fff97c74aa9 <+245>: mov    ebx, eax
    0x7fff97c74aab <+247>: test   ebx, ebx
    0x7fff97c74aad <+249>: jne    0x7fff97c74b21            ; <+365>
    0x7fff97c74aaf <+251>: mov    r13d, 0x38
(lldb)
frame #4: 0x0000000104e36857 tremulous` RestClient::Connection::performCurlRequest(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
+ 1159
tremulous`RestClient::Connection::performCurlRequest:
    0x104e36857 <+1159>: test   eax, eax
    0x104e36859 <+1161>: je     0x104e36882               ; <+1202>
    0x104e3685b <+1163>: cmp    eax, 0x1c
    0x104e3685e <+1166>: jne    0x104e368bc               ; <+1260>
(lldb)
frame #5: 0x0000000104e36a6e tremulous` RestClient::Connection::get(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)  + 14
tremulous`RestClient::Connection::get:
    0x104e36a6e <+14>: mov    rax, rbx
    0x104e36a71 <+17>: add    rsp, 0x8
    0x104e36a75 <+21>: pop    rbx
    0x104e36a76 <+22>: pop    rbp
(lldb)
frame #6: 0x0000000104e38095 tremulous` RestClient::get(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)  + 165
tremulous`RestClient::get:
    0x104e38095 <+165>: mov    eax, dword ptr [rbp - 0x78]
    0x104e38098 <+168>: mov    dword ptr [rbx], eax
    0x104e3809a <+170>: test   byte ptr [rbx + 0x8], 0x1
    0x104e3809e <+174>: jne    0x104e380a9               ; <+185>
(lldb)
frame #7: 0x0000000104e38f46 tremulous` GetTremulousPk3s  + 1750
tremulous`GetTremulousPk3s:
    0x104e38f46 <+1750>: mov    rdi, r13
    0x104e38f49 <+1753>: call   0x104e3f9e8               ; symbol stub for: std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_string(
)
    0x104e38f4e <+1758>: mov    rax, qword ptr [rip + 0x37143] ; (void *)0x0000000104e74530: construction vtable for std::__1::basic_ostream<char, std::__1::char_traits<char> >-i
n-std::__1::basic_ofstream<char, std::__1::char_traits<char> >
    0x104e38f55 <+1765>: mov    rcx, rax
(lldb) li
(lldb) b open
Breakpoint 1: 55 locations.
(lldb) r
There is a running process, detach from it and restart?: [Y/n] n
(lldb) c
Process 81586 resuming
Process 81586 stopped
* thread #1: tid = 0x2fc8f7b, 0x00007fff934a8920 Security`Security::AtomicBufferedFile::open(), queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
    frame #0: 0x00007fff934a8920 Security` Security::AtomicBufferedFile::open()
Security`Security::AtomicBufferedFile::open:
->  0x7fff934a8920 <+0>: push   rbp
    0x7fff934a8921 <+1>: mov    rbp, rsp
    0x7fff934a8924 <+4>: push   r15
    0x7fff934a8926 <+6>: push   r14
(lldb) bt
* thread #1: tid = 0x2fc8f7b, 0x00007fff934a8920 Security`Security::AtomicBufferedFile::open(), queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
  * frame #0: 0x00007fff934a8920 Security` Security::AtomicBufferedFile::open()
    frame #1: 0x00007fff934a8767 Security` Security::DbModifier::getDbVersion(bool)  + 159
    frame #2: 0x00007fff934b7e2c Security` Security::DbModifier::hasTable(unsigned int)  + 52
    frame #3: 0x00007fff934ac4a7 Security` Security::AppleDatabase::passThrough(Security::DbContext&, unsigned int, void const*, void**)  + 95
    frame #4: 0x00007fff934b7d8d Security` cssm_PassThrough(cssm_dl_db_handle, unsigned int, void const*, void**)  + 151
    frame #5: 0x00007fff934b7c21 Security` CSSM_DL_PassThrough  + 97
    frame #6: 0x00007fff934bb1a0 Security` SSDLSession::PassThrough(long, unsigned int, void const*, void**)  + 220
    frame #7: 0x00007fff934b7d8d Security` cssm_PassThrough(cssm_dl_db_handle, unsigned int, void const*, void**)  + 151
    frame #8: 0x00007fff934b7c21 Security` CSSM_DL_PassThrough  + 97
    frame #9: 0x00007fff934b7815 Security` Security::CssmClient::DbDbCursorImpl::next(Security::CssmClient::DbAttributes*, Security::CssmDataContainer*, Security::CssmClient::DbU
niqueRecord&)  + 459
    frame #10: 0x00007fff9355ddf8 Security` Security::CssmClient::SSDbCursorImpl::next(Security::CssmClient::DbAttributes*, Security::CssmDataContainer*, Security::CssmClient::Db
UniqueRecord&, cssm_access_credentials const*)  + 346
    frame #11: 0x00007fff934be94e Security` Security::KeychainCore::KCCursorImpl::next(Security::KeychainCore::Item&)  + 804
    frame #12: 0x00007fff934ce9a2 Security` allowedEVRootsForLeafCertificate  + 634
    frame #13: 0x00007fff934cd790 Security` Security::KeychainCore::Trust::evaluate(bool)  + 82
    frame #14: 0x00007fff934f13cf Security` SecTrustGetCertificateCount  + 54
    frame #15: 0x00007fff97c939ac libcurl.4.dylib` darwinssl_connect_common  + 4123
    frame #16: 0x00007fff97c91fce libcurl.4.dylib` Curl_ssl_connect_nonblocking  + 77
    frame #17: 0x00007fff97c5aeca libcurl.4.dylib` https_connecting  + 22
    frame #18: 0x00007fff97c7baa1 libcurl.4.dylib` multi_runsingle  + 797
    frame #19: 0x00007fff97c7b6e2 libcurl.4.dylib` curl_multi_perform  + 159
    frame #20: 0x00007fff97c74b14 libcurl.4.dylib` curl_easy_perform  + 352
    frame #21: 0x0000000104e36857 tremulous` RestClient::Connection::performCurlRequest(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > cons
t&)  + 1159
    frame #22: 0x0000000104e36a6e tremulous` RestClient::Connection::get(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)  + 14
    frame #23: 0x0000000104e38095 tremulous` RestClient::get(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)  + 165
    frame #24: 0x0000000104e38f46 tremulous` GetTremulousPk3s  + 1750
    frame #25: 0x0000000104d97718 tremulous` FS_InitFilesystem  + 216
    frame #26: 0x0000000104d8dd2e tremulous` Com_Init  + 862
    frame #27: 0x0000000104dce6f1 tremulous` main  + 465
    frame #28: 0x0000000104d5c884 tremulous` start  + 52
@wtfbbqhax
Copy link
Author

Pretty sure ".app" bundles are simply not allowed to modify themselves. What a shame.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment