Last active
August 26, 2018 06:38
-
-
Save norio-nomura/86eb8ea567962e922df54b5c4a97be66 to your computer and use it in GitHub Desktop.
How to use `thread backtrace -e true` in `lldb`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ echo 'import Dispatch; func f() {}; DispatchQueue.global(qos: .default).async { f() }; dispatchMain()'|swiftc - | |
$ lldb | |
(lldb) target create main | |
Current executable set to 'main' (x86_64). | |
(lldb) b f | |
Breakpoint 1: 9 locations. | |
(lldb) process launch -v DYLD_LIBRARY_PATH=/usr/lib/system/introspection -v DYLD_INSERT_LIBRARIES=/Applications/Xcode.app/Contents/Developer/usr/lib/libBacktraceRecording.dylib | |
Process 33297 launched: '/Users/norio/github/swift-dev/SourceKitten/main' (x86_64) | |
Process 33297 stopped | |
* thread #2, queue = 'com.apple.root.default-qos', stop reason = breakpoint 1.1 | |
frame #0: 0x00000001000017d0 main`main.f() -> () | |
main`main.f() -> (): | |
-> 0x1000017d0 <+0>: pushq %rbp | |
0x1000017d1 <+1>: movq %rsp, %rbp | |
0x1000017d4 <+4>: popq %rbp | |
0x1000017d5 <+5>: retq | |
Target 0: (main) stopped. | |
(lldb) thread backtrace -e true | |
* thread #2, queue = 'com.apple.root.default-qos', stop reason = breakpoint 1.1 | |
* frame #0: 0x00000001000017d0 main`main.f() -> () | |
frame #1: 0x00000001000017e9 main`closure #1 () -> () in main + 9 | |
frame #2: 0x000000010000181d main`reabstraction thunk helper from @escaping @callee_guaranteed () -> () to @escaping @callee_unowned @convention(block) () -> () + 45 | |
frame #3: 0x000000010079dcae libdispatch.dylib`_dispatch_call_block_and_release + 12 | |
frame #4: 0x0000000100795d8f libdispatch.dylib`_dispatch_client_callout + 8 | |
frame #5: 0x00000001007a3c14 libdispatch.dylib`_dispatch_queue_override_invoke + 1387 | |
frame #6: 0x0000000100797bea libdispatch.dylib`_dispatch_root_queue_drain + 723 | |
frame #7: 0x00000001007978c3 libdispatch.dylib`_dispatch_worker_thread3 + 116 | |
frame #8: 0x000000010081216d libsystem_pthread.dylib`_pthread_wqthread + 1387 | |
frame #9: 0x0000000100811bed libsystem_pthread.dylib`start_wqthread + 13 | |
thread #4294967295: tid = 0x23f8f3, 0x00000001007ac678 libdispatch.dylib`_dispatch_root_queue_push_override + 325, queue = 'com.apple.main-thread' | |
frame #0: 0x00000001007ac678 libdispatch.dylib`_dispatch_root_queue_push_override + 325 | |
frame #1: 0x000000010073d69e libswiftDispatch.dylib`(extension in Dispatch):__C.OS_dispatch_queue.async(group: Swift.Optional<__C.OS_dispatch_group>, qos: Dispatch.DispatchQoS, flags: Dispatch.DispatchWorkItemFlags, execute: @convention(block) () -> ()) -> () + 318 | |
frame #2: 0x000000010000174b main`main + 187 | |
frame #3: 0x00007fff5555d015 libdyld.dylib`start + 1 | |
(lldb) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment