cocos2d: my APP crashes but XCode doesn't give me any crash report - ios

It used to work fine but now I get this message when loading a certain scene and then the APP crashes.
2012-12-01 18:33:55.104 AppName[9561:707] cocos2d: CCSpriteFrameCache: Trying to use file 'art1-hd.png' as texture
I have no idea on where to start debugging this. Is there a way to get a more precise error message to understand why this happens?
Btw, I have changed my code signing identity to developer and XCode doesn't yet give me any trace of it on the console other than the plain message above. I checked as well the device logs on the Xcode-Organizer section but no trace.
I whish there was something like in Java + Eclipse, where I could get a precise STACKTRACE of where the crash happened.
Any suggestion on how to get a precise stacktrace (E.g. with function name generating the crash)?
PS: I have set strip debug symbols to "NO" in DEBUG, and to "YES" in Release, but I am builing on my own test iPod and hence I think it is automatically build for "Debug" (the section says build for running and testing which is confusing as the project settings allows only debug and release). But I think the problem is not here.. but in the issues above before the PS:
EDIT: If I look into the debug navigator I don't see any stacktrace of methods, as I want, but just threads.. I need to figure out how to use the global exceptions.

I have no idea on where to start debugging this.
You have the cocos2d source code. I would start there.
Search for "trying to use file" in CCSpriteFrameCache to understand what the cause of this message is (which I agree is confusing, why shouldn't you use that file?).
As for the stack trace, it's available as soon as you add a global exception breakpoint. If the breakpoint triggers in OpenAL code make sure to set it to catch only Objective-C exceptions.

Related

Migrating from AK4 to AK5 - AKOscillatorBank change to Synth

I'm migrating my project from AudioKit 4 to AudioKit 5 and currently stuck on a bad access error. The variables look like they are passed correctly into the SynthVoiceStart method. I'm quite stumped why it's throwing the error as it should be a simple change from AKOScillatorBank to the Synth object.
The project code is accessible HERE on GitHub.
I've attached a screenshot below.
XCode Error
Thank you, a simple mistake on my part.
let engine = AudioEngine()
Was accidentally inside the 'init' method and was not declared beforehand. This meant that AudioKit did not start correctly.
The corrected code is below.
XCode Correct Structure
This is more of a comment, but I don't have enough reputation.
In the past I've investigated and managed to solve EXC_BAD_ACCESS errors with AudioKit by using Address Sanitizer (ASan). In XCode go to Edit Scheme, Diagnostics tab, and tick the Address Sanitizer option. When your program is recompiled and run, ASan will print a report whenever a memory error occurs. This sometimes gives useful information to resolve the error.

Command failed due to signal: Segmentation fault: with xCode 7.0.1

My code is unable to build on xcode 7. What is Segmentation fault?
A segmentation fault happens when your code tries to access memory that it isn't allowed to access. This is often a sign of an uninitialized reference.
It's not clear to me from your screenshot exactly what is going on, though. Perhaps you could provide more details?
From the screenshot it looks like it is happening when you build your project. If this is correct, you need to create a minimal example that displays the problem i.e a code fragment that crashes the compiler in the same way and then you need to raise a bug report about it with Apple (supplying your minimal example so they can reproduce it).
This has happened to me a couple of times in the past and the way I have identified the bit that crashes the compiler is to comment out everything in the source file and then add it back in function by function.That will narrow the problem down to the function. After that you repeat with the lines of code in the offending function, until you get the line that crashes the compiler.
Along the way you may find a work around to stop the compiler crashing. If you do, do not be tempted to skip reporting the bug to Apple. They need to know.

How to use gdb debugger with xcode 5.1

Xcode 5.1 no longer officially supports GDB, instead defaulting only to LLDB. The problem with LLDB is that it shows no useful debug information on app crashes. Furthermore, all Exception Breakpoints simply break on main.m. This makes debugging ridiculously tedious. I read here on SO that this is a common problem with LLDB and that GDB does a better job.
How do I enable GDB for xcode 5.1?
There is no way to use gdb with more recent Xcodes.
I don't know what you mean by "it shows no useful debug information on app crashes." Probably best to file a bug with bugreporter.apple.com with some more detail, there may be a way to get lldb to work correctly for you.
I am also not sure what you are seeing when you say "all Exception Breakpoints break on main.m". If you go to the lldb console and do:
(lldb) break list
are the breakpoints actually on main.m?
One thing to be a little careful about with the Xcode 5 Debugging UI (maybe this started with 4, I can't remember.) When your program stops due to a crash or exception in a stack frame that starts with frames that have no debug information, Xcode will actually select the first frame up the stack that has debug information. This is to avoid showing people screens full of disassembly, which some folks find frightening... So the source frame will show, say, main.m, though the actual bottom-most frame is something else.
Xcode also has a "stack compression" feature that will hide "uninteresting" frames. That can also make this kind of stop confusing - though it will generally show the bottom-most frame you might miss that and only see your source frame. The stack compression can be turned off if you don't like it.
Make sure that is not what you are seeing.

SIGABRT Xcode 4.2 issue

Since I've upgraded from xcode 3.1 to xcode 4.2, when I debug a program and for some reason I get a SIGABRT error (i.e. calling a method of an object that doesn't exist) Xcode shows the error in the main function of the program, instead of the line that is generating the SIGABRT.
Maybe I'm missing some kind of configuration in the debugger or in xcode? any ideas?
I had the same problem for a long time and I found a solution just now. Don't know if it's the most kosher way, but at least it works for me. Basically you should create a global breakpoint (global meaning applying to all your projects).
Check out this blog post, and this tutorial on how to create symbolic breakpoints. I myself created an Exception breakpoint (it catches objc_exception_throw too) this way:
and then moved it to "User" breakpoints space:
Make sure that the scheme you are using has breakpoints active. You can turn them on by hitting the button next to the scheme selector.
http://bit.ly/zuTnpF
What did it for me, was something that I found here that has to do with creating NSZombies
I'll at least copy the highlights:
Go to your project in Xcode 4
Environment variables can be set up in the Scheme editor (find Product -> Edit scheme… in menu bar):
Name the variable as NSZombieEnabled and set its value to YES.
Run your app in Debug mode. You likely get a … message sent
to deallocated instance… message and the debugger stops at the line in error. This information leads to the problem.
When ready, disable NSZombieEnabled by changing YES to NO.

OpenGL ES Analyzer for iPad

I'm trying to use the OpenGL ES Analyzer for my iPad application and I can't get it to show me any symbols from my code in the extended detail pane's stack trace. I see the names of UIKit and UIApplication and other Apple supplied frameworks in the stack trace, but the portion of the stack trace that represents calls into my code just shows up as instruction pointer values, and there are no symbols whatever.
When I run the same app in Xcode 4 I can debug into my code without problem, all symbols are there, etc. So I believe the application is compiled correctly in this regard.
Do others out there have this problem? The information this analyzer is collecting would be extremely useful if I could see where it my code these calls are being made...
Any pointers / workaround very much appreciated.
-Eric
Well, figured this out myself eventually, so just for completeness and for anyone else who runs into this:
It is necessary to have dSYM debugger output, i.e. "DWARD with dSYM file" in the "Debug Information Format" setting in the project.
I had changed this to be just DWARF as creating the dSYM was taking a long time each build cycle.

Resources