Debugging exceptions in Xcode 4

I'm struggling to get to the bottom of the exception that occurred as a result of calling the method on an AVAudioRecorder instance. I have an exception point configured, but I cannot get any useful information from the stack trace. The point at which the exception is thrown is located during the call:

[recorder prepareToRecord];

If I turn off breakpoints, the application works fine, without any negative effects. The recorder is working fine. To be clear, the specifics of the situation are not so important. It is rather a case of "What should I do in such a situation to solve the problem?" I see no way to find out more about this problem using the available tools. The documentation on ACBaseCodec seems outdated and does not shed light on what might throw an exception.

Stack Trace from Debug Navigator:

Debug navigator

Stack trace from a separate thread:

enter image description here

Is there any way to find out what caused this exception?

+6
source share
3 answers

Unfortunately, I think that AVAudioPlayer and AVAudioRecorder seem to use C ++ exceptions as part of their normal processing flow in prepareTo .... Therefore, if you enable a break in all exceptions, there is no real way to avoid stopping there. You can probably keep going and going through it. Another possible workaround is to include only Objective-C exceptions, since it seems to throw C ++ exceptions. This is what I did. Sorry this is not the answer why they made this design decision to prepare for ... outside of me.

+9
source

If the program does not work when the debugger is active, there may be a race condition in the stream. In addition, you can try setting NSZombieEnabled to true or run the program in the Tools to see if any memory problems have caused a problem. Is the recorder object saved?

I saw several cases when the program crashed without starting the debugger, but it worked fine when the debugger was active, but I never saw such a situation.

Is the debugger logging any messages?

+1
source

Run it with the tools. There might be something wrong. If you do not get any errors, you should not worry about it.

0
source

Source: https://habr.com/ru/post/894832/


All Articles