Xcode malloc error - stack looks weird - iphone

I'm using cocos2d and I load all my sprites and scenes before my game. However, once loaded, it seems if I click to start the game too quickly I get this crash:
malloc: *** error for object 0x65cdbb4: incorrect checksum for freed object - object was probably modified after being freed.
*** set a breakpoint in malloc_error_break to debug
So I did what it suggested, recreated the crash and the stack shows this:
#0 0x9033df7e in malloc_error_break ()
#1 0x9033f128 in szone_error ()
#2 0x9033f29b in free_list_checksum_botch ()
#3 0x9024c186 in tiny_malloc_from_free_list ()
#4 0x9024b2a1 in szone_malloc_should_clear ()
#5 0x9024b148 in malloc_zone_malloc ()
#6 0x90249218 in malloc ()
#7 0x97145617 in operator new ()
#8 0x03adc43f in llvm::User::operator new ()
#9 0x03aab18f in llvm::CastInst::Create ()
#10 0x0341394c in llvm::BitcodeReader::ParseFunctionBody ()
#11 0x034164fe in llvm::BitcodeReader::materializeFunction ()
#12 0x0cd72472 in glvmAddOperation ()
#13 0x0cd4c752 in gleBuildVertexSubmitFunc ()
#14 0x0cd74e0c in cvmsModularBuilder ()
#15 0x03392a67 in cvmsCompBuildModularFunction ()
#16 0x033970a8 in cvmsServerBuildModularFunction ()
#17 0x03394e26 in CVMSBuildModularFunction ()
#18 0x032b0c26 in glvm_deferred_build_modular ()
#19 0x03310404 in glvmDoWork ()
#20 0x902747fd in _pthread_start ()
#21 0x90274682 in thread_start ()
None of these functions listed are mine, any ideas? Thanks.

Related

Unable to understand watchkit extension crash

I am getting these crash reports on Xcode organizer from users of the app. It does not show any line of my code in the crash, looks like it crashed on init. I do not know how to progress with the debug. Can you please help:
Thread 0#0 (null) in 0x300000 ()
#1 (null) in 0x300000 ()
#2 (null) in _WKInterfaceControllerCreateClass ()
#3 (null) in __115-[SPRemoteInterface createViewController:className:properties:contextID:info:gestureDescriptions:clientIdentifier:]_block_invoke_3 ()
#4 (null) in __115-[SPRemoteInterface createViewController:className:properties:contextID:info:gestureDescriptions:clientIdentifier:]_block_invoke_2 ()
#5 (null) in spUtils_dispatchAsyncToMainThread ()
#6 (null) in __115-[SPRemoteInterface createViewController:className:properties:contextID:info:gestureDescriptions:clientIdentifier:]_block_invoke ()
#7 (null) in -[SPRemoteInterface performAfterApplicationDidFinishLaunching:] ()
#8 (null) in -[SPRemoteInterface createViewController:className:properties:contextID:info:gestureDescriptions:clientIdentifier:] ()
#9 (null) in __140-[SPExtensionConnection interfaceViewController:createCompanionControllerClass:properties:initializationContextID:info:gestureDescriptions:]_block_invoke ()
#10 (null) in __62-[SPExtensionConnection performOnSendQueue:syncIfUnsuspended:]_block_invoke.583 ()
#11 (null) in spUtils_dispatchAsyncToMainThread ()
#12 (null) in -[SPExtensionConnection performOnSendQueue:syncIfUnsuspended:] ()
#13 (null) in -[SPExtensionConnection interfaceViewController:createCompanionControllerClass:properties:initializationContextID:info:gestureDescriptions:] ()
#14 (null) in -[SPApplicationDelegate interfaceViewController:createCompanionControllerClass:properties:initializationContextID:] ()
#15 (null) in -[SPInterfaceViewController loadView] ()
#16 (null) in -[UIViewController loadViewIfRequired] ()
#17 (null) in -[UIViewController view] ()
#18 (null) in -[SPModalViewController setContentViewController:] ()
#19 (null) in -[SPApplicationDelegate extensionConnection:interfaceViewController:presentViewController:info:initializationContextID:] ()
#20 (null) in -[SPExtensionConnection handlePlistDictionary:] ()
#21 (null) in -[SPExtensionConnection handleProtoPlist:] ()
#22 (null) in __43-[SPExtensionConnection receiveData:reply:]_block_invoke ()
#23 (null) in spUtils_dispatchAsyncToMainThread ()
#24 (null) in -[SPExtensionConnection receiveData:reply:] ()
#25 (null) in -[SPRemoteInterface performForClientConnections:directToUIBlock:] ()
#26 (null) in __54-[SPRemoteInterface sendData:clientIdentifiers:reply:]_block_invoke ()
#27 (null) in spUtils_dispatchAsyncToMainThread ()
#28 (null) in -[SPRemoteInterface sendData:clientIdentifiers:reply:] ()
#29 (null) in -[SPRemoteInterface sendData:clientIdentifiers:] ()
#30 (null) in -[SPRemoteInterface sendPlist:clientIdentifiers:] ()
#31 (null) in -[SPRemoteInterface controller:presentInterfaceController:initializationContextID:] ()
#32 (null) in +[SPRemoteInterface controller:presentInterfaceController:context:] ()
#33 (null) in __59-[WKInterfaceController presentControllerWithName:context:]_block_invoke ()
#34 (null) in -[WKInterfaceController presentControllerWithName:context:] ()
I had a similar issue. In my case, the issue was that I changed the watch app extension name, so it doesn't include the underscore character. After this, I experienced this crash.
The solution was, to go into the storyboard file of the watch app extension, and in the identity inspector of the existing view controllers, I just retyped the name of the custom class names, and the module updated automatically. After this, it worked. Hope it works for you as well.
Just FYI. The issue that I had was one of those embarrassing ones.
The storyboard had "Inherit Module From Target" on.
However, the default layout that Apple creates, has the executable in a separate (Extension) target.
I need to uncheck that box, and explicitly reference my extension target.
D'oh!

Getting SEGV / core dumped when running Perl debugger

When I try to run the Perl debugger I'm getting a SEGV error:
Signal SEGV at /opt/csw/lib/perl/csw/Term/ReadLine/Gnu.pm line 240.
Term::ReadLine::Gnu::new("Term::ReadLine", "perldb", GLOB(0x81c1168), GLOB(0x81873a0)) called at /opt/csw/share/perl/5.10.1/perl5db.pl line 6073
DB::setterm called at /opt/csw/share/perl/5.10.1/perl5db.pl line 2237
DB::DB called at -e line 1
Abort (core dumped)
The errors takes place with any Perl code and I think is due to the debugger using Term::ReadLine::Gnu::new.
Using gdb to get the stack trace, I get the following:
Core was generated by `/opt/csw/bin/perl -de$a++'.
Program terminated with signal 6, Aborted.
#0 0xfeaabbc5 in kill () from /lib/libc.so.1
(gdb) bt
#0 0xfeaabbc5 in kill () from /lib/libc.so.1
#1 0xfef0c748 in Perl_apply () from /opt/csw/lib/i386/libperl.so
#2 0xfeeff1ee in Perl_pp_chown () from /opt/csw/lib/i386/libperl.so
#3 0xfeeb6721 in Perl_runops_standard () from /opt/csw/lib/i386/libperl.so
#4 0xfee570da in Perl_call_sv () from /opt/csw/lib/i386/libperl.so
#5 0xfeeac2c8 in Perl_sighandler () from /opt/csw/lib/i386/libperl.so
#6 0xfeea8173 in Perl_csighandler () from /opt/csw/lib/i386/libperl.so
#7 0xfeaa8ecf in __sighndlr () from /lib/libc.so.1
#8 0xfea9eb8f in call_user_handler () from /lib/libc.so.1
#9 <signal handler called>
#10 0xfe82b828 in baudrate () from /lib/libcurses.so.1
#11 0xfe7ede48 in _nc_setupterm () from /opt/csw/lib/libncurses.so.5
#12 0xfe7ee010 in tgetent () from /opt/csw/lib/libncurses.so.5
#13 0xfe88659a in _rl_init_terminal_io () from /opt/csw/lib/i386/libreadline.so.6
#14 0xfe86eb32 in readline_initialize_everything () from /opt/csw/lib/i386/libreadline.so.6
#15 0xfe86ea22 in rl_initialize () from /opt/csw/lib/i386/libreadline.so.6
#16 0xfe8d6e1d in XS_Term__ReadLine__Gnu__XS_rl_initialize () from /opt/csw/lib/perl/csw/auto/Term/ReadLine/Gnu/Gnu.so
#17 0xfeebe7ee in Perl_pp_entersub () from /opt/csw/lib/i386/libperl.so
#18 0xfeeb6721 in Perl_runops_standard () from /opt/csw/lib/i386/libperl.so
#19 0xfee568f1 in S_run_body () from /opt/csw/lib/i386/libperl.so
#20 0xfee56813 in perl_run () from /opt/csw/lib/i386/libperl.so
#21 0x08050b48 in main ()
I would greatly appreciate any help/clues.
Thanks!

Random crash in webCore, see call stack, how to debug?

Iphone simulator crash in thread 7 (web thread), app use webview, interact with other views using phoneGap.
Based on XCode 4.2.
#0 0x05841d8a in WebCore::ApplicationCacheGroup::disassociateDocumentLoader ()
#1 0x056879fa in WebCore::ApplicationCacheHost::~ApplicationCacheHost ()
#2 0x0568714f in WebCore::DocumentLoader::~DocumentLoader ()
#3 0x053decb0 in WebDocumentLoaderMac::~WebDocumentLoaderMac ()
#4 0x0579f405 in WebCore::FrameLoader::detachViewsAndDocumentLoader ()
#5 0x0577a542 in WebCore::FrameLoader::detachFromParent ()
#6 0x054414d1 in -[WebView(WebPrivate) _close] ()
#7 0x0459567d in __invoking___ ()
#8 0x04595551 in -[NSInvocation invoke] ()
#9 0x055983c3 in HandleAPISource ()
#10 0x0460601f in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ ()
#11 0x0456419d in __CFRunLoopDoSources0 ()
#12 0x04563786 in __CFRunLoopRun ()
#13 0x04563240 in CFRunLoopRunSpecific ()
#14 0x04563161 in CFRunLoopRunInMode ()
#15 0x05659423 in RunWebThread ()
#16 0x98305259 in _pthread_start ()
#17 0x983050de in thread_start ()

How can I find out why my app is getting SIGKILLed inside UIPasteboard?

Very infrequently, our app is crashing because it receives SIGKILL. The circumstances are different, but the backtrace is always the same:
#0 0x94a00afa in mach_msg_trap ()
#1 0x94a01267 in mach_msg ()
#2 0x00fa9d5c in _UIPasteboardServerContainsTypesAtIndex ()
#3 0x00faa9ae in UIPasteboardServerContainsTypesAtIndex ()
#4 0x00fa5417 in -[UIPasteboard containsPasteboardTypes:] ()
#5 0x00de4054 in -[UITextField canPerformAction:withSender:] ()
#6 0x087038a8 in -[UIResponder(UITextAccessibilityUtilities) _accessibilityHasTextOperations] ()
#7 0x08704df5 in -[UIAccessibilityTextFieldElement _accessibilityHasTextOperations] ()
#8 0x08791dcf in -[NSObject(AXPrivCategory) accessibilityAttributeValue:] ()
#9 0x0878a3b4 in _copyMultipleAttributeValuesCallback ()
#10 0x087c5c95 in _AXXMIGCopyMultipleAttributeValues ()
#11 0x087c0a6c in _XCopyMultipleAttributeValues ()
#12 0x087c8e66 in mshMIGPerform ()
#13 0x020cf1c5 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ ()
#14 0x02034022 in __CFRunLoopDoSource1 ()
#15 0x0203290a in __CFRunLoopRun ()
#16 0x02031db4 in CFRunLoopRunSpecific ()
#17 0x02031ccb in CFRunLoopRunInMode ()
#18 0x02a43879 in GSEventRunModal ()
#19 0x02a4393e in GSEventRun ()
#20 0x00d2ba9b in UIApplicationMain ()
#21 0x0000284d in main (argc=1, argv=0xbfffed44) at [myapp]/main.m:14
#22 0x000027c5 in start ()
How would I go about finding out what is causing this crash?
The SIGKILL is sent to apps for any kind of exceptions. Se we have to make an educated guess what the exception reason would be in this case. In the above case it looks like accessibility is checking for a certain kind of pasteboard type to be present.
Since this is happening in Apple code most likely this is a bug in iOS, because the containsPasteboardTypes: method should never throw an exception. Only possibly if the passed parameter is nil, but then the bug would lie in UIAccessibilityTextFieldElement which too is Apple's responsibility.
Long story short: you need to file a radar. As a workaround you can add an #try block around the offending operation. This would catch and ignore the exception.

iphone simulator crash

My app crashes only in simulator , it doesn't crash on device.
it crashes in simulator and gives me nothing except this :
#0 0x00000000 in 0x00000000 ()
#1 0x0182966e in icu::RuleBasedBreakIterator::handleNext ()
#2 0x018293dc in icu::RuleBasedBreakIterator::next() ()
#3 0x01828a12 in icu::RuleBasedBreakIterator::following(int) ()
#4 0x043378dd in WebCore::nextBreakablePosition(unsigned short const*, int, int, bool) ()
#5 0x04cc2fca in -[NSString(WebStringDrawing) __web_drawInRect:withFont:ellipsis:alignment:letterSpacing:lineSpacing:includeEmoji:truncationRect:measureOnly:renderedStringOut:] ()
#6 0x04cc07be in -[NSString(WebStringDrawing) __web_drawInRect:withFont:ellipsis:alignment:letterSpacing:lineSpacing:includeEmoji:truncationRect:measureOnly:] ()
#7 0x04cc0499 in -[NSString(WebStringDrawing) _web_drawInRect:withFont:ellipsis:alignment:lineSpacing:includeEmoji:truncationRect:measureOnly:] ()
#8 0x04cc021b in -[NSString(WebStringDrawing) _web_sizeInRect:withFont:ellipsis:lineSpacing:] ()
#9 0x0053fc33 in -[NSString(UIStringDrawing) sizeWithFont:constrainedToSize:lineBreakMode:lineSpacing:] ()
#10 0x00644987 in -[UILabel _drawTextInRect:baselineCalculationOnly:] ()
#11 0x006422fc in -[UILabel drawTextInRect:] ()
#12 0x00559187 in -[UIView(CALayerDelegate) drawLayer:inContext:] ()
#13 0x00221b5e in -[CALayer drawInContext:] ()
#14 0x0022de47 in backing_callback(CGContext*, void*) ()
#15 0x0017b1f7 in CABackingStoreUpdate ()
#16 0x0022dd24 in -[CALayer _display] ()
#17 0x0022427d in CALayerDisplayIfNeeded ()
#18 0x001c90c3 in CA::Context::commit_transaction(CA::Transaction*) ()
#19 0x001ca294 in CA::Transaction::commit() ()
#20 0x001ca555 in CA::Transaction::release_thread(void*) ()
#21 0x98f4de0c in _pthread_tsd_cleanup ()
#22 0x98f0664c in _pthread_exit ()
#23 0x98f069a0 in pthread_exit ()
#24 0x00c93d1a in -[NSString compare:options:] ()
#25 0x00c93c98 in __NSThread__main__ ()
#26 0x98f04ed9 in _pthread_start ()
#27 0x98f086de in thread_start ()
Why is this happening?
Thanks.
Set NSZombieEnabled, MallocStackLogging, and guard malloc in the debugger. Then, when your App crashes, type this in the gdb console:
(gdb) info malloc-history 0x543216
Replace 0x543216 with the address of the object that caused the crash, and you will get a much more useful stack trace and it should help you pinpoint the exact line in your code that is causing the problem.
See this article for more detailed instructions.
Another idea is to try turning off auto-correction in the simulator Settings App.