文章

iOS 符号化 stack trace

  1. stack trace 一般长这样:
libsystem_platform.dylib            0x00000001b4af7424 DF2D1232-D046-3EE6-A970-4CBC580DD764 + 25636
Sky                                 0x000000010412db0c Sky + 72460
Sky                                 0x00000001041301e8 Sky + 82408
Sky                                 0x0000000104163f24 Sky + 294692
Foundation                          0x00000001b5133e18 8B74C8CA-1D63-3539-8A9F-59CEAC421FCE + 597528
Foundation                          0x00000001b51e5acc __NSFireTimer + 68
CoreFoundation                      0x00000001b4d6b8c0 2557D6BE-0659-3B5C-A992-24A0F92D185A + 714944
CoreFoundation                      0x00000001b4d6b5f8 2557D6BE-0659-3B5C-A992-24A0F92D185A + 714232
CoreFoundation                      0x00000001b4d6ac6c 2557D6BE-0659-3B5C-A992-24A0F92D185A + 711788
CoreFoundation                      0x00000001b4d65b14 2557D6BE-0659-3B5C-A992-24A0F92D185A + 690964
CoreFoundation                      0x00000001b4d65084 CFRunLoopRunSpecific + 480
GraphicsServices                    0x00000001befaf534 GSEventRunModal + 108
UIKitCore                           0x00000001b8ed4698 UIApplicationMain + 1940
Sky                                 0x0000000104122708 Sky + 26376
libdyld.dylib                       0x00000001b4be4e18 71F324E5-8EC6-3A4B-A985-199B87BB9D4E + 3608
  1. 需要用到的有提交该版本时的 dSYM 以及 atos

  2. 命令格式为 atos -arch <arch> -o app.dSYM/Contents/Resources/DWARF/app -l <load address> <stack address 1> <stack address 2> ...

  3. 其中 arch 可由 dwarfdump -u app.dSYM 得到。

  4. load address 为 stack address - shift,本例中为 0x000000010412db0c - 72460 = 0x10411c000,计算一次即可。

  5. 运行 3 中命令即可得到结果如:

SleepViewController.backTap(_:) (in Sky) (SleepViewController.swift:164)

implicit closure #1 in SleepViewController.didTapApply(withDuration:) (in Sky) (<compiler-generated>:0)
protocol witness for Message.traverse<A>(visitor:) in conformance SkyGetMusicFromFavoriteRequest (in Sky) + 8
License:  CC BY 4.0