如何在构建Debug-iphoneos时调试断言

时间:2016-04-13 11:51:53

标签: ios iphone swift debugging assert

我正在为iOS开发SDK,我在代码中添加了一些assert()来帮助我捕获bug。它在使用模拟器时工作得很好,但是如果我在设备上构建我的应用程序(Debug-iphoneos),从我的mac上拔下它并将其留待测试,我从断言失败中获得的崩溃日志是不可能理解的。 来自基本零断言失败的实际样本:

Exception Type:  EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000001, 0x00000000e7ffdefe
Triggered by Thread:  0

Filtered syslog:
None found

Global Trace Buffer (reverse chronological seconds):
10.153264    CFNetwork                  0x0000000021bb897d TCP Conn 0x14dbd8c0 complete. fd: 9, err: 0
10.154690    CFNetwork                  0x0000000021bb9a7f TCP Conn 0x14dbd8c0 event 1. err: 0
10.288093    CFNetwork                  0x0000000021bb9afd TCP Conn 0x14dbd8c0 started
10.293561    CFNetwork                  0x0000000021bff26f Creating default cookie storage with default identifier
10.293562    CFNetwork                  0x0000000021bff24b Faulting in CFHTTPCookieStorage singleton
10.293562    CFNetwork                  0x0000000021c418f7 Faulting in NSHTTPCookieStorage singleton
10.514965    CFNetwork                  0x0000000021bb897d TCP Conn 0x14d88140 complete. fd: 4, err: 0
10.514965    CFNetwork                  0x0000000021bb9a7f TCP Conn 0x14d88140 event 1. err: 0
10.789507    CFNetwork                  0x0000000021bb9afd TCP Conn 0x14d88140 started



Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   libswiftCore.dylib              0x00509e10 0x3af000 + 1420816
1   MyFramework                     0x002ddfec 0x24f000 + 585708

我有机会从崩溃日志中获取更多信息吗?我试了atos -arch armv7 -o MyApp.app/MyApp 0x24f000但没有成功(返回0x24f000)

1 个答案:

答案 0 :(得分:0)

解决了这篇文章Atos does not symbolicate system frameworks/libraries properly

这里我必须从.app中提取我的框架并执行

xcrun atos -arch armv7 -o  MyFramework.framework/MyFramework -l 0x24f000 0x002ddfec

(注意记忆地址的相反顺序)