如何从 iOS 崩溃日志中获取汇编代码
How to get assembly code from an iOS crashlog
我正在处理难以重现的内存崩溃,并使用 wwdc18 session 414 with additional clues from this
中提供的指导进行故障排除
我在符号化堆栈跟踪时没有问题(见底部),但是当我尝试反汇编最后一帧的地址时,我从 lldb 控制台收到此错误:
(lldb) disassemble -a 0x00000001052faed4
error: error reading data from section __text
error: Failed to disassemble memory in function at 0x1052faed4.
内存崩溃很棘手,这种情况下我真的需要从汇编代码中寻找额外的线索来解决它。
遗憾的是,WWDC 视频在 setup/configuration 中飞来飞去,建议它应该 正常工作 ...但事实并非如此。我怀疑视频中可能缺少一些关键配置?有谁知道如何获取汇编代码?
作为参考,这是符号化堆栈跟踪的顶部(显示崩溃的线程)
Thread[0] EXC_BAD_ACCESS (SIGSEGV) (KERN_INVALID_ADDRESS at 0x8000000000000010 -> 0x0000000000000010 (possible pointer authentication failure))
[ 0] 0x00000001052faed4 myApp`Flux.FASFluxDispatcher.invokeCallback(token: Swift.String) -> () + 60
[ 1] 0x00000001052faecf myApp `Flux.FASFluxDispatcher.invokeCallback(token: Swift.String) -> () + 55
[ 2] 0x00000001052fb2eb myApp `closure #1 () -> () in Flux.FASFluxDispatcher.doDispatch(action: Any) -> () + 195
[ 3] 0x00000001052feeb7 myApp `partial apply forwarder for reabstraction thunk helper from @callee_guaranteed () -> (@error @owned Swift.Error) to @escaping @callee_guaranteed () -> (@out (), @error @owned Swift.Error) + 19
[ 4] 0x00000001bff1ef30 autoreleasepool<A>(invoking:) + 64 (ObjectiveC.swift:172)
[ 5] 0x00000001052fb5af myApp `Flux.FASFluxDispatcher.dispatchAction(action: Any) -> () + 339
[ 6] 0x00000001052ff77f myApp `partial apply forwarder for closure #1 () -> () in Flux.FASActionCreator.dispatchAsync(action: Any, completion: Swift.Optional<() -> ()>) -> () + 111
[ 7] 0x00000001052fc0bf myApp `reabstraction thunk helper from @escaping @callee_guaranteed () -> () to @escaping @callee_unowned @convention(block) () -> () + 19
[ 8] 0x000000019967024c _dispatch_call_block_and_release + 32 (init.c:1454)
[ 9] 0x0000000199671db0 _dispatch_client_callout + 20 (object.m:559)
[ 10] 0x000000019967f7ac _dispatch_main_queue_callback_4CF + 836 (inline_internal.h:2548)
[ 11] 0x00000001999f911c __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16 (CFRunLoop.c:1790)
[ 12] 0x00000001999f3120 __CFRunLoopRun + 2508 (CFRunLoop.c:3118)
[ 13] 0x00000001999f221c CFRunLoopRunSpecific + 600 (CFRunLoop.c:3242)
[ 14] 0x00000001b15bc784 GSEventRunModal + 164 (GSEvent.c:2259)
[ 15] 0x000000019c432ee8 -[UIApplication _run] + 1072 (UIApplication.m:3253)
[ 16] 0x000000019c43875c UIApplicationMain + 168 (UIApplication.m:4707)
[ 17] 0x0000000104edcf67 myApp `main + 67 at AppDelegate.swift:29:9
[ 18] 0x00000001996b26b0 start + 4
Thread[1]
[ 0] 0x00000001c79cd1ac __psynch_cvwait + 8
[ 1] etc...
dSYM 中的 DWARF 文件只有符号信息和调试信息,它不包含二进制文件的 TEXT 和 DATA 段的完整副本。如果文件系统上的 dSYM 旁边有二进制副本,lldb 将在加载 dSYM 时加载它。或者您可以使用 target modules add
命令告诉 lldb 将二进制文件加载到当前会话中。
我正在处理难以重现的内存崩溃,并使用 wwdc18 session 414 with additional clues from this
我在符号化堆栈跟踪时没有问题(见底部),但是当我尝试反汇编最后一帧的地址时,我从 lldb 控制台收到此错误:
(lldb) disassemble -a 0x00000001052faed4
error: error reading data from section __text
error: Failed to disassemble memory in function at 0x1052faed4.
内存崩溃很棘手,这种情况下我真的需要从汇编代码中寻找额外的线索来解决它。
遗憾的是,WWDC 视频在 setup/configuration 中飞来飞去,建议它应该 正常工作 ...但事实并非如此。我怀疑视频中可能缺少一些关键配置?有谁知道如何获取汇编代码?
作为参考,这是符号化堆栈跟踪的顶部(显示崩溃的线程)
Thread[0] EXC_BAD_ACCESS (SIGSEGV) (KERN_INVALID_ADDRESS at 0x8000000000000010 -> 0x0000000000000010 (possible pointer authentication failure))
[ 0] 0x00000001052faed4 myApp`Flux.FASFluxDispatcher.invokeCallback(token: Swift.String) -> () + 60
[ 1] 0x00000001052faecf myApp `Flux.FASFluxDispatcher.invokeCallback(token: Swift.String) -> () + 55
[ 2] 0x00000001052fb2eb myApp `closure #1 () -> () in Flux.FASFluxDispatcher.doDispatch(action: Any) -> () + 195
[ 3] 0x00000001052feeb7 myApp `partial apply forwarder for reabstraction thunk helper from @callee_guaranteed () -> (@error @owned Swift.Error) to @escaping @callee_guaranteed () -> (@out (), @error @owned Swift.Error) + 19
[ 4] 0x00000001bff1ef30 autoreleasepool<A>(invoking:) + 64 (ObjectiveC.swift:172)
[ 5] 0x00000001052fb5af myApp `Flux.FASFluxDispatcher.dispatchAction(action: Any) -> () + 339
[ 6] 0x00000001052ff77f myApp `partial apply forwarder for closure #1 () -> () in Flux.FASActionCreator.dispatchAsync(action: Any, completion: Swift.Optional<() -> ()>) -> () + 111
[ 7] 0x00000001052fc0bf myApp `reabstraction thunk helper from @escaping @callee_guaranteed () -> () to @escaping @callee_unowned @convention(block) () -> () + 19
[ 8] 0x000000019967024c _dispatch_call_block_and_release + 32 (init.c:1454)
[ 9] 0x0000000199671db0 _dispatch_client_callout + 20 (object.m:559)
[ 10] 0x000000019967f7ac _dispatch_main_queue_callback_4CF + 836 (inline_internal.h:2548)
[ 11] 0x00000001999f911c __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16 (CFRunLoop.c:1790)
[ 12] 0x00000001999f3120 __CFRunLoopRun + 2508 (CFRunLoop.c:3118)
[ 13] 0x00000001999f221c CFRunLoopRunSpecific + 600 (CFRunLoop.c:3242)
[ 14] 0x00000001b15bc784 GSEventRunModal + 164 (GSEvent.c:2259)
[ 15] 0x000000019c432ee8 -[UIApplication _run] + 1072 (UIApplication.m:3253)
[ 16] 0x000000019c43875c UIApplicationMain + 168 (UIApplication.m:4707)
[ 17] 0x0000000104edcf67 myApp `main + 67 at AppDelegate.swift:29:9
[ 18] 0x00000001996b26b0 start + 4
Thread[1]
[ 0] 0x00000001c79cd1ac __psynch_cvwait + 8
[ 1] etc...
dSYM 中的 DWARF 文件只有符号信息和调试信息,它不包含二进制文件的 TEXT 和 DATA 段的完整副本。如果文件系统上的 dSYM 旁边有二进制副本,lldb 将在加载 dSYM 时加载它。或者您可以使用 target modules add
命令告诉 lldb 将二进制文件加载到当前会话中。