由于取消引用垃圾指针导致应用程序崩溃

时间:2013-04-04 18:21:22

标签: ios debugging crash exc-bad-access

我看到我的iPod应用程序中几乎没有随机崩溃,所有崩溃报告中都有以下消息(尽管它们有不同的线程跟踪)。崩溃是不可重现的 - 它是随机发生的。

尝试取消引用垃圾指针

我还附上了一份样本崩溃报告。请建议如何调试此类问题。

崩溃报告:

CrashReporter Key:6e6f41fdb678cf746d1c4561b2d7bc2b3f6772ad     硬件型号:iPod4,1     过程:TestApplication [3154]     路径:/var/mobile/Applications/E5ED253B-A27A-4014-885A-030D19C7CB2C/TestApplication.app/TestApplication     标识符:com.domain.retail.TestApplication     版本:1.0.0     代码类型:ARM     父流程:launchd [1]

Date/Time:       2013-04-02 10:37:29.000 +0530
OS Version:      iPhone OS 6.1.3 (10B329)
Report Version:  104

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x000000cc
Crashed Thread:  10

Thread 0 name:  Dispatch queue: com.domain.main-thread
Thread 0:
0   libsystem_kernel.dylib          0x3a7bceb4 mach_msg_trap + 20
1   CoreFoundation                  0x32626040 0x3258f000 + 618560
2   CoreFoundation                  0x32624d58 0x3258f000 + 613720
3   CoreFoundation                  0x32597eb8 CFRunLoopRunSpecific + 352
4   CoreFoundation                  0x32597d48 CFRunLoopRunInMode + 104
5   GraphicsServices                0x3614a2e8 GSEventRunModal + 72
6   UIKit                           0x344ad300 UIApplicationMain + 1120
7   TestApplication                          0x000a54d0 main + 44

Thread 1 name:  Dispatch queue: com.domain.libdispatch-manager
Thread 1:
0   libsystem_kernel.dylib          0x3a7bd648 kevent64 + 24
1   libdispatch.dylib               0x3a6e8df8 0x3a6e5000 + 15864

Thread 2 name:  WebThread
Thread 2:
0   libsystem_kernel.dylib          0x3a7bceb4 mach_msg_trap + 20
1   CoreFoundation                  0x32626040 0x3258f000 + 618560
2   CoreFoundation                  0x32624da0 0x3258f000 + 613792
3   CoreFoundation                  0x32597eb8 CFRunLoopRunSpecific + 352
4   CoreFoundation                  0x32597d48 CFRunLoopRunInMode + 104
5   WebCore                         0x38585500 0x3857b000 + 42240
6   libsystem_c.dylib               0x3a726310 0x3a715000 + 70416

Thread 3:
0   libsystem_kernel.dylib          0x3a7cd6a4 __semwait_signal + 24
1   Foundation                      0x32f0ac60 0x32eb7000 + 343136
2   TestApplication                          0x0031c9c0 -[KSCrashDeadlockMonitor runMonitor] + 244
3   Foundation                      0x32f67e80 0x32eb7000 + 724608
4   libsystem_c.dylib               0x3a726310 0x3a715000 + 70416

Thread 4 name:  KSCrash Exception Handler (Secondary)
Thread 4:
0   libsystem_kernel.dylib          0x3a7bceb4 mach_msg_trap + 20
1   TestApplication                          0x00318b50 ksmachexc_i_handleExceptions + 124
2   libsystem_c.dylib               0x3a726310 0x3a715000 + 70416

Thread 5 name:  KSCrash Exception Handler (Primary)
Thread 5:

Thread 6 name:  com.domain.NSURLConnectionLoader
Thread 6:
0   libsystem_kernel.dylib          0x3a7bceb4 mach_msg_trap + 20
1   CoreFoundation                  0x32626040 0x3258f000 + 618560
2   CoreFoundation                  0x32624da0 0x3258f000 + 613792
3   CoreFoundation                  0x32597eb8 CFRunLoopRunSpecific + 352
4   CoreFoundation                  0x32597d48 CFRunLoopRunInMode + 104
5   Foundation                      0x32ee43d0 0x32eb7000 + 185296
6   Foundation                      0x32f67e80 0x32eb7000 + 724608
7   libsystem_c.dylib               0x3a726310 0x3a715000 + 70416

Thread 7 name:  com.domain.CFSocket.private
Thread 7:
0   libsystem_kernel.dylib          0x3a7cd594 select$DARWIN_EXTSN + 20
1   libsystem_c.dylib               0x3a726310 0x3a715000 + 70416

Thread 8 name:  JavaScriptCore::BlockFree
Thread 8:
0   libsystem_kernel.dylib          0x3a7cd08c __psynch_cvwait + 24
1   libsystem_c.dylib               0x3a71eaa0 pthread_cond_timedwait + 40
2   JavaScriptCore                  0x36540c70 _ZN3WTF15ThreadCondition9timedWaitERNS_5MutexEd + 104
3   JavaScriptCore                  0x36652550 0x364e5000 + 1496400
4   JavaScriptCore                  0x36664fa8 0x364e5000 + 1572776
5   libsystem_c.dylib               0x3a726310 0x3a715000 + 70416

Thread 9:
0   libsystem_kernel.dylib          0x3a7cdd98 __workq_kernreturn + 8
1   libsystem_c.dylib               0x3a71ba10 0x3a715000 + 27152

Thread 10 name:  Dispatch queue: com.domain.root.high-priority
Thread 10 Crashed:
0   libicucore.A.dylib              0x39e5e570 ucol_getVersion + 0
1   TextInput                       0x37d741b0 _ZN2KB8WordTrie4loadERKNS_6StringE + 280
2   TextInput                       0x37d6d698 0x37d35000 + 231064
3   TextInput                       0x380de2f8 0x37d35000 + 3838712
4   TextInput                       0x380de298 0x37d35000 + 3838616
5   TextInput                       0x37d65170 _ZN14TIInputManager17load_dictionariesERKN2KB6StringES3_b + 20
6   TextInput                       0x37d761c8 0x37d35000 + 266696
7   TextInput                       0x37d75e08 0x37d35000 + 265736
8   UIKit                           0x3454ffd0 0x34456000 + 1023952
9   UIKit                           0x3454f018 0x34456000 + 1019928
10  UIKit                           0x3454ec28 0x34456000 + 1018920
11  UIKit                           0x3454d500 0x34456000 + 1012992
12  UIKit                           0x3454d1f0 0x34456000 + 1012208
13  UIKit                           0x345afa48 0x34456000 + 1415752
14  UIKit                           0x345ac918 0x34456000 + 1403160
15  UIKit                           0x345ac618 0x34456000 + 1402392
16  UIKit                           0x345ab018 0x34456000 + 1396760
17  UIKit                           0x345aae40 0x34456000 + 1396288
18  UIKit                           0x345aa780 0x34456000 + 1394560
19  TestApplication                          0x00155e90 -[TestApplicationRequestInfoController showScanAlertForErrorType:Barcode:] + 2380
20  TestApplication                          0x00151c48 -[TestApplicationRequestInfoController showAlertForErrorType:Barcode:] + 72
21  TestApplication                          0x001fe090 -[TestApplicationBOPISOrdersScanningController processFirstNonSerialNumberScan:] + 3788
22  TestApplication                          0x0020dd38 -[TestApplicationScanController processScanInfo] + 3512
23  TestApplication                          0x0020cf38 __39-[TestApplicationScanController startScanThread]_block_invoke + 44
24  libdispatch.dylib               0x3a6e7118 0x3a6e5000 + 8472
25  libdispatch.dylib               0x3a6f5258 0x3a6e5000 + 66136
26  libdispatch.dylib               0x3a6f53b8 0x3a6e5000 + 66488
27  libsystem_c.dylib               0x3a71ba10 0x3a715000 + 27152

Thread 11:
0   libsystem_kernel.dylib          0x3a7bceb4 mach_msg_trap + 20
1   CoreFoundation                  0x32626040 0x3258f000 + 618560
2   CoreFoundation                  0x32624da0 0x3258f000 + 613792
3   CoreFoundation                  0x32597eb8 CFRunLoopRunSpecific + 352
4   CoreFoundation                  0x32597d48 CFRunLoopRunInMode + 104
5   Foundation                      0x32ebaf90 0x32eb7000 + 16272
6   Foundation                      0x32ec3d50 0x32eb7000 + 52560
7   TestApplication                          0x002cc288 -[CommStream runLoopThread:] + 704
8   Foundation                      0x32f67e80 0x32eb7000 + 724608
9   libsystem_c.dylib               0x3a726310 0x3a715000 + 70416

Thread 12:
0   libsystem_kernel.dylib          0x3a7cd594 select$DARWIN_EXTSN + 20
1   Foundation                      0x32f67e80 0x32eb7000 + 724608
2   libsystem_c.dylib               0x3a726310 0x3a715000 + 70416

Thread 13:
0   libsystem_kernel.dylib          0x3a7bceb4 mach_msg_trap + 20
1   CoreFoundation                  0x32626040 0x3258f000 + 618560
2   CoreFoundation                  0x32624da0 0x3258f000 + 613792
3   CoreFoundation                  0x32597eb8 CFRunLoopRunSpecific + 352
4   CoreFoundation                  0x32597d48 CFRunLoopRunInMode + 104
5   Foundation                      0x32ebaf90 0x32eb7000 + 16272
6   Foundation                      0x32ec3d50 0x32eb7000 + 52560
7   TestApplication                          0x002cc288 -[CommStream runLoopThread:] + 704
8   Foundation                      0x32f67e80 0x32eb7000 + 724608
9   libsystem_c.dylib               0x3a726310 0x3a715000 + 70416

Thread 14:
0   libsystem_kernel.dylib          0x3a7cd594 select$DARWIN_EXTSN + 20
1   Foundation                      0x32f67e80 0x32eb7000 + 724608
2   libsystem_c.dylib               0x3a726310 0x3a715000 + 70416

Thread 15:
0   libsystem_kernel.dylib          0x3a7cdd98 __workq_kernreturn + 8
1   libsystem_c.dylib               0x3a71ba10 0x3a715000 + 27152

Thread 10 crashed with ARM Thread State:
    r0: 0x00000000     r1: 0x05fe1320     r2: 0x00000001     r3: 0x00000001 
    r4: 0x03000000     r5: 0x07000000     r6: 0x05a1c000     r7: 0x05fe1394 
    r8: 0x05fe14d8     r9: 0x00000000    r10: 0x37d5f865    r11: 0x05fe14c8 
    ip: 0x3be8e2bc     sp: 0x05fe1300     lr: 0x37d74427     pc: 0x39e5e570 
  cpsr: 0x20000030 

CrashDoctor Diagnosis: Attempted to dereference garbage pointer 0xcc.
Originated at or in a subcall of -[TestApplicationRequestInfoController showScanAlertForErrorType:Barcode:]

1 个答案:

答案 0 :(得分:1)

看一下主题10:

其中一个功能可能存在问题:

19  TestApplication                          0x00155e90 -[TestApplicationRequestInfoController showScanAlertForErrorType:Barcode:] + 2380
20  TestApplication                          0x00151c48 -[TestApplicationRequestInfoController showAlertForErrorType:Barcode:] + 72
21  TestApplication                          0x001fe090 -[TestApplicationBOPISOrdersScanningController processFirstNonSerialNumberScan:] + 3788
22  TestApplication                          0x0020dd38 -[TestApplicationScanController processScanInfo] + 3512
23  TestApplication                          0x0020cf38 __39-[TestApplicationScanController startScanThread]_block_invoke + 44

仔细检查它们。或者在它们上面放置断点并重新运行程序,看看当程序通过这些函数时会发生什么。

希望这有帮助...只是一个初学者......

请记住,没有随机崩溃..这些崩溃是由于代码中的错误造成的。