Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

EXC_BAD_ACCESS on iOS in system libraries

I'm having an EXC_BAD_ACCESS exception in an iOS game made in Xcode. It happens on the Simulator and on real devices. It's always at the same part in the game, but does not always happen. It's cryptic because it does not seem to have anything to do with the game's objects, just with default library/system methods. Xcode also does not show which line of code is causing it (but it shows which line in assembly). I'm posting the backtrace below. What could be causing it? How can I find out what is the problem?

thread #1: tid = 0x1c03, 0x01980051 libobjc.A.dylib`_cache_getImp + 9, stop reason = EXC_BAD_ACCESS (code=1, address=0xc0000008)
frame #0: 0x01980051 libobjc.A.dylib`_cache_getImp + 9
frame #1: 0x0196dac4 libobjc.A.dylib`lookUpMethod + 42
frame #2: 0x0196da88 libobjc.A.dylib`class_respondsToSelector + 65
frame #3: 0x023160d3 CoreFoundation`objectIsKindOfClass + 51
frame #4: 0x0239f087 CoreFoundation`__handleUncaughtException + 71
frame #5: 0x0196f0b9 libobjc.A.dylib`_objc_terminate() + 86
frame #6: 0x01da2a65 libc++abi.dylib`safe_handler_caller(void (*)()) + 13
frame #7: 0x01da2acd libc++abi.dylib`std::terminate() + 23
frame #8: 0x01da3c4e libc++abi.dylib`__cxa_rethrow + 83
frame #9: 0x0196efbd libobjc.A.dylib`objc_exception_rethrow + 47
frame #10: 0x022bbf98 CoreFoundation`CFRunLoopRunSpecific + 360
frame #11: 0x022bbe1b CoreFoundation`CFRunLoopRunInMode + 123
frame #12: 0x01df57e3 GraphicsServices`GSEventRunModal + 88
frame #13: 0x01df5668 GraphicsServices`GSEventRun + 104
frame #14: 0x00aa5ffc UIKit`UIApplicationMain + 1211
frame #15: 0x000026e1 Game`main(argc=1, argv=0xbffff3bc) + 95 at main.m:6
frame #16: 0x00002645 Game`start + 53
like image 376
HLorenzi Avatar asked Jan 20 '26 09:01

HLorenzi


1 Answers

It is an uncaught exception. There should be a log message the describes the exception that was thrown.


Ew.... ugly... it is a malformed exception causing the crash.

Quite likely, your app is corrupting memory somehow. Create an exception breakpoint (it is in the debugger UI) and see if you can get it to break in the debugger. Since it is a rethrow() in the backtrace, the original throw may actually be useful.

like image 115
bbum Avatar answered Jan 22 '26 05:01

bbum