OSAtomicIncrement64Barrier在32位设备上崩溃

时间:2015-07-04 02:21:28

标签: ios multithreading core-audio 32bit-64bit

我遇到的崩溃只发生在32位设备上。

我正在使用OSAtomicIncrement64Barrier(在实时音频线程上)递增计数器以通知另一个线程发生了更新。

崩溃始终发生在OSAtomicIncrement64Barrier行上 - 但前提是它在未连接到Xcode时正在运行。

我对OSAtomic函数了解不足以了解问题的根源,或者我是否只是做错了。

下面是违规线程的符号化崩溃报告(它们看起来都一样!)。不确定回答这个问题可能需要哪些其他信息,所以请在评论中告诉我你还需要知道什么!

Incident Identifier: 33861B2A-55F9-473A-86FC-BD738CF3A83C
CrashReporter Key:   32b13822728d1015dfd82c926d70db8659f56248
Hardware Model:      iPad3,1
Process:             myApp [413]
Path:                /private/var/mobile/Containers/Bundle/Application/1BEE592E-8F9A-413C-A989-3E39AE3EA407/myApp.app/myApp
Identifier:          ......
Version:             12 (1.0)
Code Type:           ARM (Native)
Parent Process:      launchd [1]

Date/Time:           2015-07-03 19:16:50.193 -0700
Launch Time:         2015-07-03 19:16:35.574 -0700
OS Version:          iOS 8.3 (12F69)
Report Version:      105

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x00000000
Triggered by Thread:  14


 Thread 14 name:  AURemoteIO::IOThread
Thread 14 Crashed:
0   libsystem_platform.dylib        0x361cdb9e OSAtomicIncrement64Barrier$VARIANT$mp + 6
1   myApp                       0x0008981c renderCallback (ONCAterotAudioController+AudioRenderCallbacks.m:470)
2   AudioToolbox                    0x26f1de8e AUInputElement::PullInput(unsigned long&, AudioTimeStamp const&, unsigned long, unsigned long) + 126
3   AudioToolbox                    0x2700523c AUMatrixMixer::Render(unsigned long&, AudioTimeStamp const&, unsigned long) + 556
4   AudioToolbox                    0x27005ddc AUMatrixMixer::RenderBus(unsigned long&, AudioTimeStamp const&, unsigned long, unsigned long) + 104
5   AudioToolbox                    0x26e456e6 AUBase::DoRenderBus(unsigned long&, AudioTimeStamp const&, unsigned long, AUOutputElement*, unsigned long, AudioBufferList&) + 142
6   AudioToolbox                    0x26e45578 AUBase::DoRender(unsigned long&, AudioTimeStamp const&, unsigned long, unsigned long, AudioBufferList&) + 720
7   AudioToolbox                    0x26e4529a AUMethodRender(void*, unsigned long*, AudioTimeStamp const*, unsigned long, unsigned long, AudioBufferList*) + 42
8   myApp                       0x00088c42 eqCallBack (ONCAterotAudioController+AudioRenderCallbacks.m:115)
9   AudioToolbox                    0x26f1de8e AUInputElement::PullInput(unsigned long&, AudioTimeStamp const&, unsigned long, unsigned long) + 126
10  AudioToolbox                    0x26fc8642 AUDynamicsProcessor::Render(unsigned long&, AudioTimeStamp const&, unsigned long) + 298
11  AudioToolbox                    0x26e456e6 AUBase::DoRenderBus(unsigned long&, AudioTimeStamp const&, unsigned long, AUOutputElement*, unsigned long, AudioBufferList&) + 142
12  AudioToolbox                    0x26e45578 AUBase::DoRender(unsigned long&, AudioTimeStamp const&, unsigned long, unsigned long, AudioBufferList&) + 720
13  AudioToolbox                    0x26e4529a AUMethodRender(void*, unsigned long*, AudioTimeStamp const*, unsigned long, unsigned long, AudioBufferList*) + 42
14  ONCKit                          0x003f2a5e recordCallback (ONCAudioRecordController.m:106)
15  AudioToolbox                    0x26f16480 AUConverterBase::RenderBus(unsigned long&, AudioTimeStamp const&, unsigned long, unsigned long) + 728
16  AudioToolbox                    0x26e456e6 AUBase::DoRenderBus(unsigned long&, AudioTimeStamp const&, unsigned long, AUOutputElement*, unsigned long, AudioBufferList&) + 142
17  AudioToolbox                    0x26e45578 AUBase::DoRender(unsigned long&, AudioTimeStamp const&, unsigned long, unsigned long, AudioBufferList&) + 720
18  AudioToolbox                    0x26f0b4b0 AURemoteIO::PerformIO(unsigned long, unsigned int, unsigned int, AudioTimeStamp const&, AudioTimeStamp const&, AudioBufferList const*, AudioBufferList*, int&) + 488
19  AudioToolbox                    0x26f0c566 AURIOCallbackReceiver_PerformIO + 390
20  AudioToolbox                    0x26f047de _XPerformIO + 162
21  AudioToolbox                    0x26e63938 mshMIGPerform + 188
22  AudioToolbox                    0x26edd760 MSHMIGDispatchMessage + 28
23  AudioToolbox                    0x26f0b7bc AURemoteIO::IOThread::Run() + 116
24  AudioToolbox                    0x26f0ee68 AURemoteIO::IOThread::Entry(void*) + 4
25  AudioToolbox                    0x26e416f2 CAPThread::Entry(CAPThread*) + 206
26  libsystem_pthread.dylib         0x361d2de8 _pthread_body + 136
27  libsystem_pthread.dylib         0x361d2d5a _pthread_start + 114
28  libsystem_pthread.dylib         0x361d0b04 thread_start + 4


Thread 14 crashed with ARM Thread State (32-bit):
    r0: 0x00000000    r1: 0x00001294      r2: 0x00000000      r3: 0x00000274
    r4: 0x0b1094e0    r5: 0x0b109c28      r6: 0x0b109634      r7: 0x0b1095ec
    r8: 0x00000000    r9: 0x00000000     r10: 0x00000400     r11: 0x00000400
    ip: 0x3f800000    sp: 0x0b1094e0      lr: 0x00089821      pc: 0x361cdb9e
  cpsr: 0x80000030

1 个答案:

答案 0 :(得分:0)

似乎问题与我的数据结构中的对齐问题有关。

添加

__attribute__ ((aligned (8)))

持有计数器的结构修复了问题。