OSAtomicIncrement64Barrier 在 32 位设备上崩溃
OSAtomicIncrement64Barrier crash on 32-bit devices
我遇到了只发生在 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
看来这个问题与我的数据结构中的对齐问题有关。
添加
__attribute__ ((aligned (8)))
持有计数器的结构解决了这个问题。
我遇到了只发生在 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
看来这个问题与我的数据结构中的对齐问题有关。
添加
__attribute__ ((aligned (8)))
持有计数器的结构解决了这个问题。