问题
I'm getting exceptions thrown in com.apple.coremedia.networkbuffering
as described in this question.
They don't crash the app or seem to cause any problems. But they make my exception breakpoint useless because it triggers all the time.
I found these questions describing some ways to filter "All Exception" breakpoints but didn't have much luck. I examined the NSThread in the debugger hoping to find an some information I could use to construct a condition to apply on the breakpoint, but the thread isn't named. There's information in the stack trace that I might be able to use, but I couldn't find a good way to apply it to prevent the breakpoint from firing.
Call stack is included at the end of the question.
How can I prevent my "All exceptions" breakpoint from stopping on this exception?
Here is the call stack:
(lldb) po [NSThread callStackSymbols]
<_NSCallStackArray 0xdceefa0>(
0 ??? 0x12e41edd 0x0 + 316939997,
1 AudioCodecs 0x15aa7f95 _ZL15GetPropertyInfoPvmPmPh + 45,
2 AudioToolbox 0x0435ae79 AudioCodecGetPropertyInfo + 89,
3 AudioToolbox 0x04257d85 _ZN14CodecConverter15CheckInitializeEPKvm + 533,
4 AudioToolbox 0x042579e5 _ZN14CodecConverterC2ERP20OpaqueAudioComponentP28OpaqueAudioComponentInstanceRK14StreamDescPairS7_bRK23AudioConverterPrimeInfo + 661,
5 AudioToolbox 0x0425773c _ZN14CodecConverterC1ERP20OpaqueAudioComponentP28OpaqueAudioComponentInstanceRK14StreamDescPairS7_bRK23AudioConverterPrimeInfo + 60,
6 AudioToolbox 0x0425c6d0 _ZN19CodecDecoderFactory24BuildCodecConverterChainERK14StreamDescPairRK18ChainBuildSettingsP19AudioConverterChainP19PCMConverterFactory + 240,
7 AudioToolbox 0x042445dc _ZN17ConverterRegistry15CreateConverterERK14StreamDescPairPP19AudioConverterChainmPK21AudioClassDescription + 204,
8 AudioToolbox 0x04235156 _AudioConverterNewInternal + 342,
9 AudioToolbox 0x042832e1 _ZN16AudioQueueObject19ConverterConnection14BuildConverterEv + 1505,
10 AudioToolbox 0x04282c72 _ZN16AudioQueueObject19ConverterConnectionC2ERS_Rl + 130,
11 AudioToolbox 0x042848bc _ZN16AudioQueueObject16IONodeConnection27GetConverterConnection_InitERl + 60,
12 AudioToolbox 0x042899bc _ZN16AudioQueueObject11SetPropertyEmR14CADeserializer + 2588,
13 AudioToolbox 0x042b3bdb AQServer_SetProperty + 123,
14 AudioToolbox 0x042be251 AudioQueueSetProperty + 369,
15 MediaToolbox 0x0c665d8b subaq_createSubAudioQueue + 876,
16 MediaToolbox 0x0c6655d1 FigAudioQueueCreate + 669,
17 MediaToolbox 0x0c7012c3 FigAudioQueueRenderPipelineCreate + 658,
18 MediaToolbox 0x0c68c3a3 fpfs_EnsureRenderChainForTrack + 2722,
19 MediaToolbox 0x0c682c3f fpfs_ResolveAllWaitingTracks + 2372,
20 MediaToolbox 0x0c67cd85 fpfs_PushSampleBuffer + 3941,
21 MediaToolbox 0x0c64b993 _ZL32fim_MakePushSampleBufferCallbackP17OpaqueFigManifoldP14FigIcyManifoldiPFlS0_iPvjxP20opaqueCMSampleBufferES3_jxS5_ + 85,
22 MediaToolbox 0x0c64b453 _ZL22AudioFileStreamPacketsPvmmPKvP28AudioStreamPacketDescription + 3263,
23 AudioToolbox 0x042ac5de _ZN22AudioFileStreamWrapper15CallPacketsProcEmmPKvP28AudioStreamPacketDescriptionb + 142,
24 AudioToolbox 0x042de8e1 _ZN15ADTSAudioStream15GeneratePacketsER27AudioFileStreamContinuation + 1873,
25 AudioToolbox 0x042af1e5 _ZN22AudioFileStreamWrapper10ParseBytesEmPKvm + 229,
26 AudioToolbox 0x042abfd8 AudioFileStreamParseBytes + 88,
27 MediaToolbox 0x0c64a218 _ZL24FigIcyManifoldInjectDataP17OpaqueFigManifoldxjP19OpaqueCMBlockBuffer + 819,
28 MediaToolbox 0x0c69dbc2 fpfs_BytePumpFn + 2813,
29 MediaToolbox 0x0c648f18 fbp_SendDataCallback + 171,
30 MediaToolbox 0x0c64884d FigICY_HTTPPumpFn + 2350,
31 MediaToolbox 0x0c83f826 figHTTPRequestPerformReadCallback + 183,
32 MediaToolbox 0x0c83f9cd figHttpRequestSendOutputBlockBuffer + 81,
33 MediaToolbox 0x0c83f729 figHttpRequestAppendDataArrayToBlockBuffer + 485,
34 MediaToolbox 0x0c83f09a figHttpRequestDidReceiveDataArrayCallback + 300,
35 CFNetwork 0x015578ae ___ZN27URLConnectionClient_Classic29_delegate_didReceiveDataArrayEv_block_invoke + 157,
36 CFNetwork 0x01556bac ___ZN27URLConnectionClient_Classic18_withDelegateAsyncEPKcU13block_pointerFvP16_CFURLConnectionPK33CFURLConnectionClientCurrent_VMaxE_block_invoke_2 + 104,
37 CFNetwork 0x015a10ef ___ZNK17CoreSchedulingSet13_performAsyncEPKcU13block_pointerFvvE_block_invoke + 25,
38 CoreFoundation 0x039f0d59 CFArrayApplyFunction + 57,
39 CFNetwork 0x014c05af _ZN19RunloopBlockContext7performEv + 139,
40 CFNetwork 0x015a16d2 _ZThn16_N19RunloopBlockContext24multiplexerClientPerformEv + 20,
41 CFNetwork 0x014c03dd _ZN17MultiplexerSource7performEv + 299,
42 CFNetwork 0x014c01f2 _ZN17MultiplexerSource8_performEPv + 76,
43 CoreFoundation 0x039d883f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15,
44 CoreFoundation 0x039d81cb __CFRunLoopDoSources0 + 235,
45 CoreFoundation 0x039f529e __CFRunLoopRun + 910,
46 CoreFoundation 0x039f4ac3 CFRunLoopRunSpecific + 467,
47 CoreFoundation 0x039ffe61 CFRunLoopRun + 129,
48 CoreMedia 0x024f6e9e FigThreadGlobalNetworkBufferingRunloop + 31,
49 CoreMedia 0x024f9dbd figThreadMain + 284,
50 libsystem_pthread.dylib 0x04f825fb _pthread_body + 144,
51 libsystem_pthread.dylib 0x04f82485 _pthread_struct_init + 0,
52 libsystem_pthread.dylib 0x04f87cf2 thread_start + 34
)
回答1:
This may help in general when you have a block of code e.g. a 3rd part library that throws multiple exceptions that you want to ignore:
Set two breakpoints, one before and one after the exception throwing block of code you want to ignore. Run the program, until it stops at an exception, and type 'breakpoint list' into the debugger console, and find the number of the 'all exceptions' break point, it should look like this:
2: names = {'objc_exception_throw', '__cxa_throw'}, locations = 2 Options: disabled 2.1: where = libobjc.A.dylibobjc_exception_throw, address = 0x00007fff8f8da6b3, unresolved, hit count = 0 2.2: where = libc++abi.dylib__cxa_throw, address = 0x00007fff8d19fab7, unresolved, hit count = 0
This means it is breakpoint 2. Now in xcode, edit the first breakpoint (before the exception throwing code) and change the action to 'debugger command' and type in 'breakpoint disable 2' (and set 'automatically continue...' checkbox ).
Do the same for the break point after the offending line and have the command 'breakpoint enable 2'.
The all breakpoints exception will now turn on and off so it's only active when you need iT
来源:https://stackoverflow.com/questions/20379412/ignore-exceptions-in-com-apple-coremedia-networkbuffering