iOS: how to localize line in source code from dissasembly log - ios

Console info:
2015-11-15 23:26:42.824 SWPi2[1564:476501] *** -[__NSCFConstantString length]: message sent to deallocated instance 0x110d868a0
bt:
* thread #1: tid = 0x74555, 0x0000000110a9beaf CoreFoundation`___forwarding___ + 767, queue = 'com.apple.main-thread', stop reason = EXC_BREAKPOINT (code=EXC_I386_BPT, subcode=0x0)
* frame #0: 0x0000000110a9beaf CoreFoundation`___forwarding___ + 767
frame #1: 0x0000000110a9bb28 CoreFoundation`__forwarding_prep_0___ + 120
frame #2: 0x0000000110a1abfc CoreFoundation`CFURLCreateStringByReplacingPercentEscapes + 60
frame #3: 0x0000000110a5cec6 CoreFoundation`URLPathToPOSIXPath + 38
frame #4: 0x0000000110a1a1e7 CoreFoundation`CFURLCreateStringWithFileSystemPath + 439
frame #5: 0x0000000110a16f2c CoreFoundation`CFURLCopyFileSystemPath + 364
frame #6: 0x0000000110b05b25 CoreFoundation`extractQuadrupleFromPathIfPossible + 1221
frame #7: 0x0000000110b3f8c9 CoreFoundation`+[CFPrefsSearchListSource withSearchListForIdentifier:container:perform:] + 185
frame #8: 0x0000000110b2d017 CoreFoundation`_CFPreferencesCopyAppValueWithContainer + 183
frame #9: 0x0000000117a4f134 libAccessibility.dylib`_copyValuePreference + 138
frame #10: 0x0000000117a4ee14 libAccessibility.dylib`_getBooleanPreference + 24
frame #11: 0x0000000117a52312 libAccessibility.dylib`_AXSQuickSpeakEnabled + 76
frame #12: 0x000000010f0d57ad UIKit`-[UIApplication(UIKitApplicationAccessibility) _accessibilitySetUpQuickSpeak] + 79
frame #13: 0x00000001101a7129 Foundation`__NSFireDelayedPerform + 402
frame #14: 0x0000000110aa6364 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 20
frame #15: 0x0000000110aa5f11 CoreFoundation`__CFRunLoopDoTimer + 1089
frame #16: 0x0000000110a678b1 CoreFoundation`__CFRunLoopRun + 1937
frame #17: 0x0000000110a66e98 CoreFoundation`CFRunLoopRunSpecific + 488
frame #18: 0x0000000111bf8ad2 GraphicsServices`GSEventRunModal + 161
frame #19: 0x000000010ecd6676 UIKit`UIApplicationMain + 171
frame #20: 0x000000010deb1c41 SWPi2`main(argc=1, argv=0x00007fff51def770) + 129 at main.m:7
frame #21: 0x000000011255b92d libdyld.dylib`start + 1
thread forwarding:
0x110a9bc80 <+208>: movq %rbx, -0x40(%rbp)
0x110a9bc84 <+212>: leaq 0x2a3a0d(%rip), %rsi ; "_NSZombie_"
0x110a9bc8b <+219>: movl $0xa, %edx
0x110a9bc90 <+224>: movq %r14, %rdi
0x110a9bc93 <+227>: callq 0x110ba403c ; symbol stub for: strncmp
0x110a9bc98 <+232>: testl %eax, %eax
0x110a9bc9a <+234>: je 0x110a9be63 ; <+691>
0x110a9bca0 <+240>: movq 0x2ca1c1(%rip), %rsi ; "methodSignatureForSelector:"
0x110a9bca7 <+247>: movq %r12, %rdi
0x110a9bcaa <+250>: callq 0x110ba37e4 ; symbol stub for: class_respondsToSelector
0x110a9bcaf <+255>: testb %al, %al
0x110a9bcb1 <+257>: movq -0x40(%rbp), %r14
0x110a9bcb5 <+261>: movq -0x38(%rbp), %r13
0x110a9bcb9 <+265>: je 0x110a9beb4 ; <+772>
0x110a9bcbf <+271>: movq 0x2ca1a2(%rip), %rsi ; "methodSignatureForSelector:"
0x110a9bcc6 <+278>: movq %r14, %rdi
0x110a9bcc9 <+281>: movq -0x30(%rbp), %rdx
0x110a9bccd <+285>: callq *0x2dc525(%rip) ; (void *)0x00000001105d3800: objc_msgSend
0x110a9bcd3 <+291>: movq %rax, %r12
0x110a9bcd6 <+294>: testq %r12, %r12
0x110a9bcd9 <+297>: je 0x110a9bf11 ; <+865>
0x110a9bcdf <+303>: movq 0x2ca152(%rip), %rsi ; "_frameDescriptor"
0x110a9bce6 <+310>: movq %r12, %rdi
0x110a9bce9 <+313>: callq *0x2dc509(%rip) ; (void *)0x00000001105d3800: objc_msgSend
0x110a9bcef <+319>: movq %rax, %rbx
0x110a9bcf2 <+322>: movq (%rbx), %rax
0x110a9bcf5 <+325>: movzwl 0x22(%rax), %eax
0x110a9bcf9 <+329>: shrl $0x6, %eax
0x110a9bcfc <+332>: andq $0x1, %rax
0x110a9bd00 <+336>: cmpq %r13, %rax
0x110a9bd03 <+339>: je 0x110a9bd49 ; <+409>
0x110a9bd05 <+341>: movq -0x30(%rbp), %rdi
0x110a9bd09 <+345>: callq 0x110ba38ec ; symbol stub for: sel_getName
0x110a9bd0e <+350>: movq %rax, %rdx
0x110a9bd11 <+353>: movq (%rbx), %rax
0x110a9bd14 <+356>: movzwl 0x22(%rax), %eax
0x110a9bd18 <+360>: leaq 0x29b169(%rip), %rsi ; ""
0x110a9bd1f <+367>: leaq 0x2aa161(%rip), %r8 ; " not"
0x110a9bd26 <+374>: testb $0x40, %al
0x110a9bd28 <+376>: movq %r8, %rcx
0x110a9bd2b <+379>: cmovneq %rsi, %rcx
0x110a9bd2f <+383>: testq %r13, %r13
0x110a9bd32 <+386>: cmovneq %rsi, %r8
0x110a9bd36 <+390>: leaq 0x2f1983(%rip), %rsi ; #"*** NSForwarding: warning: method signature and compiler disagree on struct-return-edness of '%s'. Signature thinks it does%s return a struct, and compiler thinks it does%s."
0x110a9bd3d <+397>: movl $0x4, %edi
0x110a9bd42 <+402>: xorl %eax, %eax
Profiler stops in this place without zombie sign.
How to localize NSZombie in source code?

Related

App Crashing (EXC_BAD_ACCESS) only in RTL Languages like Arabic

App is crashing with EXC_BAD_ACCESS exception only in RTL mode whereas the app is working fine in LTR mode. I'm running the app by forcing it in RTL mode as below,
Edit Scheme -> Run -> Option -> App Language -> Right to Left Pseudo Language.
It is crashing in UIApplicationMain with following stack trace
0x12495a1bb <+94>: movq 0x47896(%rip), %rsi ; "overflowEngineVarIndexForEngine:"
0x12495a1c2 <+101>: movq %r14, %rdi
0x12495a1c5 <+104>: movq %rbx, %rdx
0x12495a1c8 <+107>: callq *0x3d022(%rip) ; (void *)0x0000000113ecd7c0: objc_msgSend
0x12495a1ce <+113>: jmp 0x12495a1d5 ; <+120>
0x12495a1d0 <+115>: movl $0xffffffff, %eax ; imm = 0xFFFFFFFF
0x12495a1d5 <+120>: movq 0xc0(%rbx), %rcx
0x12495a1dc <+127>: movl %eax, %eax
0x12495a1de <+129>: movq %rax, %rdx
0x12495a1e1 <+132>: shrq $0x6, %rdx
-> 0x12495a1e5 <+136>: movq (%rcx,%rdx,8), %rcx Thread 1: EXC_BAD_ACCESS (code=2, address=0x6190201a4f78)
0x12495a1e9 <+140>: andl $0x3f, %eax
0x12495a1ec <+143>: shlq $0x5, %rax
0x12495a1f0 <+147>: leaq (%rcx,%rax), %r15
Crash Log Looks like this
Thread 0:: Dispatch queue: com.apple.main-thread
0 ??? 0x110739ad8 ???
1 ??? 0x111e93948 ???
2 CoreAutoLayout 0x128b4e3e9 -[NSISEngine negativeErrorVarForBrokenConstraintWithMarker:errorVar:] + 89
3 CoreAutoLayout 0x128b5716f -[NSISEngine removeConstraintWithMarker:] + 1102
4 CoreAutoLayout 0x128b6ca30 -[NSLayoutConstraint _removeFromEngine:] + 209
5 UIKitCore 0x13ecd4dd0 -[UIView _layoutEngine_willRemoveLayoutConstraint:] + 80
6 UIKitCore 0x13ecd589c -[UIView(UIConstraintBasedLayout) nsli_removeConstraint:] + 90
7 CoreAutoLayout 0x128b6de31 __55+[NSLayoutConstraint _addOrRemoveConstraints:activate:]_block_invoke + 53
8 CoreAutoLayout 0x128b5458f -[NSISEngine withBehaviors:performModifications:] + 84
9 CoreAutoLayout 0x128b6dd0a +[NSLayoutConstraint _addOrRemoveConstraints:activate:] + 398
10 UIKitCore 0x13ece22f8 -[UIView(AdditionalLayoutSupport) _withUnsatisfiableConstraintsLoggingSuspendedIfEngineDelegateExists:] + 580
11 UIKitCore 0x13ece344d -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededWithViewForVariableChangeNotifications:] + 154
12 UIKitCore 0x13ece4556 -[UIView(AdditionalLayoutSupport) _updateConstraintsAtEngineLevelIfNeededWithViewForVariableChangeNotifications:] + 374
13 UIKitCore 0x13ede1561 -[UIView _updateConstraintsAsNecessaryAndApplyLayoutFromEngine] + 352
14 UIKitCore 0x13edf559f -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 2305
15 QuartzCore 0x11b49302c CA::Layer::layout_if_needed(CA::Transaction*) + 526
16 QuartzCore 0x11b49e5b9 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 65
17 QuartzCore 0x11b3afb0c CA::Context::commit_transaction(CA::Transaction*, double, double*) + 626
18 QuartzCore 0x11b3e769b CA::Transaction::commit() + 735
19 QuartzCore 0x11b3e8b64 CA::Transaction::flush_as_runloop_observer(bool) + 60
20 CoreFoundation 0x11f3df055 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
21 CoreFoundation 0x11f3d99c2 __CFRunLoopDoObservers + 515
22 CoreFoundation 0x11f3d9f0d __CFRunLoopRun + 1161
23 CoreFoundation 0x11f3d96a7 CFRunLoopRunSpecific + 560
24 GraphicsServices 0x12793128a GSEventRunModal + 139
25 UIKitCore 0x13e7c2ad3 -[UIApplication _run] + 994
26 UIKitCore 0x13e7c79ef UIApplicationMain + 123
27 libswiftUIKit.dylib 0x1267f3c72 UIApplicationMain(_:_:_:_:) + 98
28 Bookings 0x105de34c0 main + 560 (main.swift:12)
29 dyld_sim 0x1170582bf start_sim + 10
30 dyld 0x20cd81310 start + 2432
I have enabled Constraint Error Breakpoint , Exception Breakpoint and Run Time Issue Breakpoint but have no luck in finding any clue about the issue. Have used instruments to find memory leaks but had no luck there too since it showed as no leaks.
So from crash logs it is clear that app is crashing coz of something went wrong inside Autolayout engine (which may be coz of some contradicting constraints) and I can't check all the constraints since app has huge number of them. How can find the root cause of this crash and fix this issue.
I would appreciate any help in finding the root cause of this crash issue.

[NSNull length]: unrecognized selector sent to instance on keyboard keystroke?

I have added some textField and textView on static table view. the code was fine and running on xcode 6.4 / ios 8. * but it is throwing exception which i am not able to track. now i am debugging code on xcode 7.2 (swift2.2)
I tried putting symbolic and and exceptional break point too but no luck :(
following is stack trace of crash, Thanks in advance for your valuable help.
2015-12-14 16:07:07.989 TuteMate[3380:90711] -[NSNull length]: unrecognized selector sent to instance 0x10ccc6af0
from exceptional breakpoint :
CoreFoundation`-[NSObject(NSObject) doesNotRecognizeSelector:]:
-> 0x10504e3c0 <+0>: pushq %rbp
0x10504e3c1 <+1>: movq %rsp, %rbp
0x10504e3c4 <+4>: pushq %r15
0x10504e3c6 <+6>: pushq %r14
0x10504e3c8 <+8>: pushq %rbx
0x10504e3c9 <+9>: pushq %rax
0x10504e3ca <+10>: movq %rdx, %r14
0x10504e3cd <+13>: movq %rdi, %rbx
0x10504e3d0 <+16>: movq 0x216c79(%rip), %rsi ; "class"
0x10504e3d7 <+23>: callq *0x229e1b(%rip) ; (void *)0x000000010730b800: objc_msgSend
0x10504e3dd <+29>: movq %rax, %rdi
0x10504e3e0 <+32>: movq %rbx, %rsi
0x10504e3e3 <+35>: movq %r14, %rdx
0x10504e3e6 <+38>: callq 0x10504ed00 ; __CFFullMethodName
0x10504e3eb <+43>: movq %rax, %r14
0x10504e3ee <+46>: leaq 0x23fdeb(%rip), %r15 ; #"%#: unrecognized selector sent to instance %p"
0x10504e3f5 <+53>: movl $0x3, %edi
0x10504e3fa <+58>: xorl %eax, %eax
0x10504e3fc <+60>: movq %r15, %rsi
0x10504e3ff <+63>: movq %r14, %rdx
0x10504e402 <+66>: movq %rbx, %rcx
0x10504e405 <+69>: callq 0x104fe2560 ; CFLog
0x10504e40a <+74>: leaq 0x22b90f(%rip), %rax ; kCFAllocatorSystemDefault
0x10504e411 <+81>: movq (%rax), %rdi
0x10504e414 <+84>: xorl %esi, %esi
0x10504e416 <+86>: xorl %eax, %eax
0x10504e418 <+88>: movq %r15, %rdx
0x10504e41b <+91>: movq %r14, %rcx
0x10504e41e <+94>: movq %rbx, %r8
0x10504e421 <+97>: callq 0x104f35190 ; CFStringCreateWithFormat
0x10504e426 <+102>: movq %rax, %rdi
0x10504e429 <+105>: callq 0x104f33580 ; CFMakeCollectable
0x10504e42e <+110>: movq %rax, %rbx
0x10504e431 <+113>: movq %rbx, %rdi
0x10504e434 <+116>: nop
0x10504e435 <+117>: nopl (%rax)
0x10504e439 <+121>: leaq 0x225300(%rip), %rax ; __CFOASafe
0x10504e440 <+128>: cmpb $0x0, (%rax)
0x10504e443 <+131>: je 0x10504e459 ; <+153>
0x10504e445 <+133>: movl $0x3, %edi
0x10504e44a <+138>: xorl %edx, %edx
0x10504e44c <+140>: xorl %ecx, %ecx
0x10504e44e <+142>: xorl %r8d, %r8d
0x10504e451 <+145>: movq %rbx, %rsi
0x10504e454 <+148>: callq 0x10501b150 ; __CFRecordAllocationEvent
0x10504e459 <+153>: movq %rbx, %rdi
0x10504e45c <+156>: callq 0x1050a3696 ; symbol stub for: _objc_rootAutorelease
0x10504e461 <+161>: movq 0x218370(%rip), %rdi ; (void *)0x00000001052690d0: NSException
0x10504e468 <+168>: leaq 0x234fb1(%rip), %rcx ; NSInvalidArgumentException
0x10504e46f <+175>: movq (%rcx), %rdx
0x10504e472 <+178>: movq 0x216c4f(%rip), %rsi ; "exceptionWithName:reason:userInfo:"
0x10504e479 <+185>: xorl %r8d, %r8d
0x10504e47c <+188>: movq %rax, %rcx
0x10504e47f <+191>: callq *0x229d73(%rip) ; (void *)0x000000010730b800: objc_msgSend
0x10504e485 <+197>: movq %rax, %rdi
0x10504e488 <+200>: callq 0x1050a3738 ; symbol stub for: objc_exception_throw
0x10504e48d <+205>: nopl (%rax)
update stack Trace
2015-12-14 16:45:58.932 TuteMate[4000:109943] -[NSNull length]: unrecognized selector sent to instance 0x105b72af0
2015-12-14 16:46:02.651 TuteMate[4000:109943] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSNull length]: unrecognized selector sent to instance 0x105b72af0'
*** First throw call stack:
(
0 CoreFoundation 0x000000010594de65 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x0000000107bfddeb objc_exception_throw + 48
2 CoreFoundation 0x000000010595648d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x00000001058a390a ___forwarding___ + 970
4 CoreFoundation 0x00000001058a34b8 _CF_forwarding_prep_0 + 120
5 CoreFoundation 0x0000000105825dfa CFStringCompareWithOptionsAndLocale + 202
6 Foundation 0x0000000106019e37 -[NSString compare:options:range:] + 29
7 UIKit 0x00000001069c4e6f -[UIPhysicalKeyboardEvent _matchesKeyCommand:] + 303
8 UIKit 0x00000001068e93fd -[UIResponder _keyCommandForEvent:target:] + 364
9 UIKit 0x00000001068e95b2 -[UIResponder _keyCommandForEvent:target:] + 801
10 UIKit 0x00000001068e95b2 -[UIResponder _keyCommandForEvent:target:] + 801
11 UIKit 0x00000001068e95b2 -[UIResponder _keyCommandForEvent:target:] + 801
12 UIKit 0x00000001068e95b2 -[UIResponder _keyCommandForEvent:target:] + 801
13 UIKit 0x00000001068e95b2 -[UIResponder _keyCommandForEvent:target:] + 801
14 UIKit 0x00000001068e95b2 -[UIResponder _keyCommandForEvent:target:] + 801
15 UIKit 0x00000001066fb91a -[UIApplication _handleKeyUIEvent:] + 948
16 UIKit 0x00000001068e9e53 -[UIResponder _handleKeyUIEvent:] + 79
17 UIKit 0x00000001068e9e53 -[UIResponder _handleKeyUIEvent:] + 79
18 UIKit 0x00000001068e9e53 -[UIResponder _handleKeyUIEvent:] + 79
19 UIKit 0x00000001068e9e53 -[UIResponder _handleKeyUIEvent:] + 79
20 UIKit 0x00000001068e9e53 -[UIResponder _handleKeyUIEvent:] + 79
21 UIKit 0x00000001068e9e53 -[UIResponder _handleKeyUIEvent:] + 79
22 UIKit 0x00000001068e9e53 -[UIResponder _handleKeyUIEvent:] + 79
23 UIKit 0x00000001068e9e53 -[UIResponder _handleKeyUIEvent:] + 79
24 UIKit 0x00000001068e9e53 -[UIResponder _handleKeyUIEvent:] + 79
25 UIKit 0x00000001068e9e53 -[UIResponder _handleKeyUIEvent:] + 79
26 UIKit 0x00000001068e9e53 -[UIResponder _handleKeyUIEvent:] + 79
27 UIKit 0x00000001068e9e53 -[UIResponder _handleKeyUIEvent:] + 79
28 UIKit 0x00000001068e9e53 -[UIResponder _handleKeyUIEvent:] + 79
29 UIKit 0x00000001068e9e53 -[UIResponder _handleKeyUIEvent:] + 79
30 UIKit 0x00000001068e9e53 -[UIResponder _handleKeyUIEvent:] + 79
31 UIKit 0x00000001068e9e53 -[UIResponder _handleKeyUIEvent:] + 79
32 UIKit 0x00000001066fb2cd -[UIApplication handleKeyUIEvent:] + 79
33 UIKit 0x0000000106991c83 -[UIKeyboardImpl _handleKeyEvent:executionContext:] + 66
34 UIKit 0x0000000106b91cde -[UIKeyboardLayoutStar completeRetestForTouchUp:timestamp:interval:executionContext:] + 3356
35 UIKit 0x00000001069a0bbd __28-[UIKeyboardLayout touchUp:]_block_invoke + 228
36 UIKit 0x00000001070ed724 -[UIKeyboardTaskQueue continueExecutionOnMainThread] + 332
37 UIKit 0x00000001069a0ace -[UIKeyboardLayout touchUp:] + 236
38 UIKit 0x00000001069a1614 -[UIKeyboardLayout touchesEnded:withEvent:] + 348
39 UIKit 0x000000010674b49b -[UIWindow _sendTouchesForEvent:] + 835
40 UIKit 0x000000010674c1d0 -[UIWindow sendEvent:] + 865
41 UIKit 0x00000001066fab66 -[UIApplication sendEvent:] + 263
42 UIKit 0x00000001066d4d97 _UIApplicationHandleEventQueue + 6844
43 CoreFoundation 0x0000000105879a31 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
44 CoreFoundation 0x000000010586f95c __CFRunLoopDoSources0 + 556
45 CoreFoundation 0x000000010586ee13 __CFRunLoopRun + 867
46 CoreFoundation 0x000000010586e828 CFRunLoopRunSpecific + 488
47 GraphicsServices 0x000000010c9daad2 GSEventRunModal + 161
48 UIKit 0x00000001066da610 UIApplicationMain + 171
49 TuteMate 0x000000010500128d main + 109
50 libdyld.dylib 0x000000010932c92d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
UPDATE
There are no other viewWillAppeaer, didAppear... methods implemented!
override func viewDidLoad() {
super.viewDidLoad()
title = "Profile Edit"
}
And table viewDelegates are
override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
// #warning Potentially incomplete method implementation.
// Return the number of sections.
return 1
}
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
// #warning Incomplete method implementation.
// Return the number of rows in the section.
return 3
}
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = super.tableView(tableView, cellForRowAtIndexPath: indexPath)
return cell
}
#dip: From your comments it seems that you need to learn something very important about debugging, and that is: Everything you believe is false. When you say "I don't store null or anything like that", we know that is false. And the second most important rule: Trust the evidence.
The evidence is that a message "length:" which is an NSString method is sent to [NSNull null]. Somewhere you are storing [NSNull null] where you should store a string. Third rule of debugging: You did something wrong. There are no mysterious gremlins trying to upset you, it's your code that's wrong. So find out where you are storing an [NSNull null]. Anything coming from a JSON parser is always a good candidate.
Possible Solution:
My issue was caused because I inadvertently clicked on the Key Commands controls in the attribute inspector.
Check out my response here:
https://stackoverflow.com/a/36187611/5006807
I hope it helps....

app crashes in iOS 8 when debugging, but works when not debugging

This app work fine on iOS 7 simulator without any issue. But when I'm debugging it on iOS 8.1 simulator it crashes. It would not even reach 1st view controller's viewDidLoad.
Just after compiler leaves applicaitondidFinishLaunchingWithOptions: method app crashes.
However I can run already built app in iOS 8.1 simulator without any issue. Crashes only when I'm running the app through Xcode. What could be the reason? (considering the fact that it's already debugging fine in iOS 7) ?
EDIT: (CRASH LOG)
UIKit`UIApplicationMain:
0x108ecff1e: pushq %rbp
0x108ecff1f: movq %rsp, %rbp
0x108ecff22: pushq %r15
0x108ecff24: pushq %r14
0x108ecff26: pushq %r13
0x108ecff28: pushq %r12
0x108ecff2a: pushq %rbx
0x108ecff2b: subq $0x38, %rsp
0x108ecff2f: movq %rcx, -0x48(%rbp)
0x108ecff33: movq %rdx, %r15
0x108ecff36: movq %rsi, %rbx
0x108ecff39: movl %edi, %r13d
0x108ecff3c: movq 0xb4ca8d(%rip), %rax ; (void *)0x000000010bcf1070: __stack_chk_guard
0x108ecff43: movq (%rax), %rax
0x108ecff46: movq %rax, -0x30(%rbp)
0x108ecff4a: leaq 0xdf66bb(%rip), %r14 ; _UIApplicationLinkedOnVersion
0x108ecff51: movl (%r14), %ecx
0x108ecff54: testl %ecx, %ecx
0x108ecff56: jne 0x108ecff7a ; UIApplicationMain + 92
0x108ecff58: xorl %eax, %eax
0x108ecff5a: cmpq $-0x1, 0xdf05ee(%rip) ; WebKitSetIsClassic + 7
0x108ecff62: je 0x108ecffa9 ; UIApplicationMain + 139
0x108ecff64: leaq 0xdf05e5(%rip), %rdi ; _UIApplicationLinkedOnVersionOnce
0x108ecff6b: leaq 0xb4fcfe(%rip), %rsi ; __block_literal_global1030
0x108ecff72: callq 0x1096a29e4 ; symbol stub for: dispatch_once
0x108ecff77: movl (%r14), %ecx
0x108ecff7a: xorl %eax, %eax
0x108ecff7c: cmpl $0x20100, %ecx
0x108ecff82: jb 0x108ecffa9 ; UIApplicationMain + 139
0x108ecff84: movq 0xdb8e15(%rip), %rdi ; (void *)0x000000010a4d7da8: NSAutoreleasePool
0x108ecff8b: movq 0xd8d406(%rip), %rsi ; "alloc"
0x108ecff92: movq 0xb4d0f7(%rip), %r14 ; (void *)0x000000010a881000: objc_msgSend
0x108ecff99: callq *%r14
0x108ecff9c: movq 0xd8d84d(%rip), %rsi ; "init"
0x108ecffa3: movq %rax, %rdi
0x108ecffa6: callq *%r14
0x108ecffa9: movq %r15, -0x50(%rbp)
0x108ecffad: movq %rax, -0x58(%rbp)
0x108ecffb1: cmpl $0x2, %r13d
0x108ecffb5: jl 0x108ed0019 ; UIApplicationMain + 251
0x108ecffb7: addq $0x8, %rbx
0x108ecffbb: decl %r13d
0x108ecffbe: leaq 0x8a9075(%rip), %r14 ; "-BuildDefaultPNG"
0x108ecffc5: leaq 0x8a907f(%rip), %r15 ; "-RegisterForSystemEvents"
0x108ecffcc: movq (%rbx), %r12
0x108ecffcf: movq %r12, %rdi
0x108ecffd2: movq %r14, %rsi
0x108ecffd5: callq 0x1096a2cd8 ; symbol stub for: strcmp
0x108ecffda: testl %eax, %eax
0x108ecffdc: je 0x108ed0009 ; UIApplicationMain + 235
0x108ecffde: movq %r12, %rdi
0x108ecffe1: movq %r15, %rsi
0x108ecffe4: callq 0x1096a2cd8 ; symbol stub for: strcmp
0x108ecffe9: testl %eax, %eax
0x108ecffeb: je 0x108ed0000 ; UIApplicationMain + 226
0x108ecffed: movq %r12, %rdi
0x108ecfff0: leaq 0x8a906d(%rip), %rsi ; "--RegisterForSystemEvents"
0x108ecfff7: callq 0x1096a2cd8 ; symbol stub for: strcmp
0x108ecfffc: testl %eax, %eax
0x108ecfffe: jne 0x108ed0010 ; UIApplicationMain + 242
0x108ed0000: movb $0x1, 0xdf656c(%rip) ; __ShouldLaunchSafe
0x108ed0007: jmp 0x108ed0010 ; UIApplicationMain + 242
0x108ed0009: movb $0x1, 0xdf6561(%rip) ; __IsRunningTests
0x108ed0010: addq $0x8, %rbx
0x108ed0014: decl %r13d
0x108ed0017: jne 0x108ecffcc ; UIApplicationMain + 174
0x108ed0019: xorl %eax, %eax
0x108ed001b: callq 0x1096a1592 ; symbol stub for: BKSDisplayServicesStart
0x108ed0020: callq 0x108ed0d0b ; UIApplicationInitialize
0x108ed0025: movq 0xdb8d24(%rip), %rdi ; (void *)0x0000000109c9ec80: UIApplication
0x108ed002c: movq 0xd8d39d(%rip), %rsi ; "class"
0x108ed0033: callq *0xb4d057(%rip) ; (void *)0x000000010a881000: objc_msgSend
0x108ed0039: movq %rax, %r15
0x108ed003c: movq -0x50(%rbp), %rbx
0x108ed0040: testq %rbx, %rbx
0x108ed0043: jne 0x108ed0081 ; UIApplicationMain + 355
0x108ed0045: movq 0xdb8d34(%rip), %rdi ; (void *)0x000000010a4d7e20: NSBundle
0x108ed004c: movq 0xd8e0dd(%rip), %rsi ; "mainBundle"
0x108ed0053: movq 0xb4d036(%rip), %r14 ; (void *)0x000000010a881000: objc_msgSend
0x108ed005a: callq *%r14
0x108ed005d: movq 0xd8e0d4(%rip), %rsi ; "infoDictionary"
0x108ed0064: movq %rax, %rdi
0x108ed0067: callq *%r14
0x108ed006a: movq 0xd8d38f(%rip), %rsi ; "objectForKey:"
0x108ed0071: leaq 0xb8b4b8(%rip), %rdx ; #"NSPrincipalClass"
0x108ed0078: movq %rax, %rdi
0x108ed007b: callq *%r14
0x108ed007e: movq %rax, %rbx
0x108ed0081: movq 0xd8e0c0(%rip), %rsi ; "length"
0x108ed0088: movq %rbx, %rdi
0x108ed008b: callq *0xb4cfff(%rip) ; (void *)0x000000010a881000: objc_msgSend
0x108ed0091: testq %rax, %rax
0x108ed0094: movq -0x48(%rbp), %r13
0x108ed0098: je 0x108ed0127 ; UIApplicationMain + 521
0x108ed009e: movq %rbx, %rdi
0x108ed00a1: callq 0x1096a19ca ; symbol stub for: NSClassFromString
0x108ed00a6: movq %rax, %r15
0x108ed00a9: testq %r15, %r15
0x108ed00ac: jne 0x108ed0127 ; UIApplicationMain + 521
0x108ed00ae: movq 0xdb8b33(%rip), %rdi ; (void *)0x000000010a4d8500: NSAssertionHandler
0x108ed00b5: movq 0xd8d47c(%rip), %rsi ; "currentHandler"
0x108ed00bc: movq 0xb4cfcd(%rip), %r12 ; (void *)0x000000010a881000: objc_msgSend
0x108ed00c3: callq *%r12
0x108ed00c6: movq %rax, -0x50(%rbp)
0x108ed00ca: movq 0xdb8b1f(%rip), %rdi ; (void *)0x000000010a4dae90: NSString
0x108ed00d1: movq 0xd8d468(%rip), %rsi ; "stringWithUTF8String:"
0x108ed00d8: leaq 0x8a8fb0(%rip), %rdx ; "int UIApplicationMain(int, char **, NSString *, NSString *)"
0x108ed00df: callq *%r12
0x108ed00e2: movq %rax, %r14
0x108ed00e5: movq 0xdb8b04(%rip), %rdi ; (void *)0x000000010a4dae90: NSString
0x108ed00ec: movq 0xd8d44d(%rip), %rsi ; "stringWithUTF8String:"
0x108ed00f3: leaq 0x8a868f(%rip), %rdx ; "/SourceCache/UIKit_Sim/UIKit-3318.16.14/UIApplication.m"
0x108ed00fa: callq *%r12
0x108ed00fd: movq %rax, %rcx
0x108ed0100: movq 0xd8e179(%rip), %rsi ; "handleFailureInFunction:file:lineNumber:description:"
0x108ed0107: movq %rbx, (%rsp)
0x108ed010b: leaq 0xb8b43e(%rip), %r9 ; #"Unable to instantiate the UIApplication subclass instance. No class named %# is loaded."
0x108ed0112: xorl %r15d, %r15d
0x108ed0115: movl $0xb36, %r8d
0x108ed011b: xorl %eax, %eax
0x108ed011d: movq %r14, %rdx
0x108ed0120: movq -0x50(%rbp), %rdi
0x108ed0124: callq *%r12
0x108ed0127: leaq 0x330(%rip), %rdi ; _UIApplicationHandleEvent
0x108ed012e: callq 0x1096a1d12 ; symbol stub for: GSEventRegisterEventCallBack
0x108ed0133: leaq 0x8f1(%rip), %rdi ; _UIApplicationHandleHIDEvent
0x108ed013a: callq 0x1096a15bc ; symbol stub for: BKSHIDEventRegisterEventCallback
0x108ed013f: movq 0xd8d28a(%rip), %rsi ; "class"
0x108ed0146: movq 0xb4cf43(%rip), %r12 ; (void *)0x000000010a881000: objc_msgSend
0x108ed014d: movq %r15, %rdi
0x108ed0150: callq *%r12
0x108ed0153: movq 0xd8e196(%rip), %rsi ; "registerAsSystemApp"
0x108ed015a: movq %rax, %rdi
0x108ed015d: callq *%r12
0x108ed0160: movb %al, 0xdf640d(%rip) ; __RegisterAsSystemApp
0x108ed0166: cmpq $-0x1, 0xdf0372(%rip) ; __signalRunLoopSource + 7
0x108ed016e: jne 0x108ed0446 ; UIApplicationMain + 1320
0x108ed0174: cmpb $0x0, 0xdf036d(%rip) ; _UIApplicationIsExtension.once + 7
0x108ed017b: je 0x108ed0186 ; UIApplicationMain + 616
0x108ed017d: xorl %eax, %eax
0x108ed017f: callq 0x1096a1cee ; symbol stub for: GSEventInitializeAsExtension
0x108ed0184: jmp 0x108ed0192 ; UIApplicationMain + 628
0x108ed0186: movzbl 0xdf63e6(%rip), %edi ; __RegisterAsSystemApp
0x108ed018d: callq 0x1096a1ce8 ; symbol stub for: GSEventInitialize
0x108ed0192: movq 0xb4cca7(%rip), %rax ; (void *)0x000000010ae3f300: NSDefaultRunLoopMode
0x108ed0199: movq (%rax), %rdi
0x108ed019c: callq 0x1096a1d06 ; symbol stub for: GSEventPushRunLoopMode
0x108ed01a1: movq 0xd8e430(%rip), %rsi ; "_startWindowServerIfNecessary"
0x108ed01a8: movq %r15, %rdi
0x108ed01ab: callq *%r12
0x108ed01ae: movq 0xd8e42b(%rip), %rsi ; "_startStatusBarServerIfNecessary"
0x108ed01b5: movq %r15, %rdi
0x108ed01b8: callq *%r12
0x108ed01bb: movq %r15, %rdi
0x108ed01be: callq 0x108ecfdd0 ; UIApplicationInstantiateSingleton
0x108ed01c3: movq 0xdb8c56(%rip), %rdi ; (void *)0x000000010e867498: FBSUIApplicationSystemService
0x108ed01ca: movq 0xd8d1c7(%rip), %rsi ; "alloc"
0x108ed01d1: callq *%r12
0x108ed01d4: movq 0xd8e40d(%rip), %rsi ; "initWithQueue:"
0x108ed01db: movq 0xb4c7fe(%rip), %rdx ; (void *)0x000000010bbe4780: _dispatch_main_q
0x108ed01e2: movq %rax, %rdi
0x108ed01e5: callq *%r12
0x108ed01e8: movq %rax, 0xdf0319(%rip) ; __systemAppService
0x108ed01ef: movq 0xdf6372(%rip), %rdx ; UIApp
0x108ed01f6: movq 0xd8d48b(%rip), %rsi ; "setDelegate:"
0x108ed01fd: movq %rax, %rdi
0x108ed0200: callq *%r12
0x108ed0203: movq 0xdb8c1e(%rip), %rdi ; (void *)0x000000010e867650: FBSUIApplicationWorkspace
0x108ed020a: movq 0xd8d187(%rip), %rsi ; "alloc"
0x108ed0211: callq *%r12
0x108ed0214: movq %rax, %r14
0x108ed0217: movq 0xdb8c12(%rip), %rbx ; (void *)0x000000010e868168: FBSSerialQueue
0x108ed021e: movq 0xb4cc13(%rip), %rax ; (void *)0x000000010ae3f308: NSRunLoopCommonModes
0x108ed0225: movq (%rax), %rax
0x108ed0228: movq %rax, -0x40(%rbp)
0x108ed022c: leaq 0xb8d9dd(%rip), %rax ; #"UIInitializationRunLoopMode"
0x108ed0233: movq %rax, -0x38(%rbp)
0x108ed0237: movq 0xdb897a(%rip), %rdi ; (void *)0x000000010ae78cd8: NSArray
0x108ed023e: movq 0xd8d0fb(%rip), %rsi ; "arrayWithObjects:count:"
0x108ed0245: leaq -0x40(%rbp), %rdx
0x108ed0249: movl $0x2, %ecx
0x108ed024e: callq *%r12
0x108ed0251: movq 0xd8e398(%rip), %rsi ; "queueWithMainRunLoopModes:"
0x108ed0258: movq %rbx, %rdi
0x108ed025b: movq %rax, %rdx
0x108ed025e: callq *%r12
0x108ed0261: movq 0xd8e390(%rip), %rsi ; "initWithSerialQueue:"
0x108ed0268: movq %r14, %rdi
0x108ed026b: movq %rax, %rdx
0x108ed026e: callq *%r12
0x108ed0271: movq %rax, 0xdf0238(%rip) ; __workspace
0x108ed0278: movq 0xdf62e9(%rip), %rdx ; UIApp
0x108ed027f: movq 0xd8d402(%rip), %rsi ; "setDelegate:"
0x108ed0286: movq %rax, %rdi
0x108ed0289: callq *%r12
0x108ed028c: movq 0xdb8965(%rip), %rdi ; (void *)0x0000000109ca4540: UIDevice
0x108ed0293: movq 0xd8d2d6(%rip), %rsi ; "currentDevice"
0x108ed029a: callq *%r12
0x108ed029d: movq 0xd8d2d4(%rip), %rsi ; "userInterfaceIdiom"
0x108ed02a4: movq %rax, %rdi
0x108ed02a7: callq *%r12
0x108ed02aa: cmpq $0x1, %rax
0x108ed02ae: jne 0x108ed02c4 ; UIApplicationMain + 934
0x108ed02b0: movq 0xdb8af1(%rip), %rdi ; (void *)0x0000000109cab250: UIClassicController
0x108ed02b7: movq 0xd8e062(%rip), %rsi ; "sharedClassicController"
0x108ed02be: callq *0xb4cdcc(%rip) ; (void *)0x000000010a881000: objc_msgSend
0x108ed02c4: testq %r13, %r13
0x108ed02c7: jne 0x108ed0307 ; UIApplicationMain + 1001
0x108ed02c9: movq 0xdb8ab0(%rip), %rdi ; (void *)0x000000010a4d7e20: NSBundle
0x108ed02d0: movq 0xd8de59(%rip), %rsi ; "mainBundle"
0x108ed02d7: callq *%r12
0x108ed02da: movq 0xd8de57(%rip), %rsi ; "infoDictionary"
0x108ed02e1: movq %rax, %rdi
0x108ed02e4: callq *%r12
0x108ed02e7: movq 0xd8d112(%rip), %rsi ; "objectForKey:"
0x108ed02ee: leaq 0xb8b27b(%rip), %rdx ; #"UIApplicationDelegateClass"
0x108ed02f5: movq %rax, %rdi
0x108ed02f8: callq *%r12
0x108ed02fb: movq %rax, %r13
0x108ed02fe: testq %r13, %r13
0x108ed0301: je 0x108ed0401 ; UIApplicationMain + 1251
0x108ed0307: movq %r13, %rdi
0x108ed030a: callq 0x1096a19ca ; symbol stub for: NSClassFromString
0x108ed030f: movq %rax, %r14
0x108ed0312: testq %r14, %r14
0x108ed0315: jne 0x108ed0384 ; UIApplicationMain + 1126
0x108ed0317: movq 0xdb88ca(%rip), %rdi ; (void *)0x000000010a4d8500: NSAssertionHandler
0x108ed031e: movq 0xd8d213(%rip), %rsi ; "currentHandler"
0x108ed0325: callq *%r12
0x108ed0328: movq %rax, %r15
0x108ed032b: movq 0xdb88be(%rip), %rdi ; (void *)0x000000010a4dae90: NSString
0x108ed0332: movq 0xd8d207(%rip), %rsi ; "stringWithUTF8String:"
0x108ed0339: leaq 0x8a8d4f(%rip), %rdx ; "int UIApplicationMain(int, char **, NSString *, NSString *)"
0x108ed0340: callq *%r12
0x108ed0343: movq %rax, %rbx
0x108ed0346: movq 0xdb88a3(%rip), %rdi ; (void *)0x000000010a4dae90: NSString
0x108ed034d: movq 0xd8d1ec(%rip), %rsi ; "stringWithUTF8String:"
0x108ed0354: leaq 0x8a842e(%rip), %rdx ; "/SourceCache/UIKit_Sim/UIKit-3318.16.14/UIApplication.m"
0x108ed035b: callq *%r12
0x108ed035e: movq %rax, %rcx
0x108ed0361: movq 0xd8df18(%rip), %rsi ; "handleFailureInFunction:file:lineNumber:description:"
0x108ed0368: movq %r13, (%rsp)
0x108ed036c: leaq 0xb8b21d(%rip), %r9 ; #"Unable to instantiate the UIApplication delegate instance. No class named %# is loaded."
0x108ed0373: movl $0xb62, %r8d
0x108ed0379: xorl %eax, %eax
0x108ed037b: movq %rbx, %rdx
0x108ed037e: movq %r15, %rdi
0x108ed0381: callq *%r12
0x108ed0384: movq 0xdb89c5(%rip), %rdi ; (void *)0x0000000109c9ec80: UIApplication
0x108ed038b: movq 0xd8d03e(%rip), %rsi ; "class"
0x108ed0392: callq *%r12
0x108ed0395: movq 0xd8e264(%rip), %rsi ; "isSubclassOfClass:"
0x108ed039c: movq %r14, %rdi
0x108ed039f: movq %rax, %rdx
0x108ed03a2: callq *%r12
0x108ed03a5: movq 0xdf61bc(%rip), %rbx ; UIApp
0x108ed03ac: testb %al, %al
0x108ed03ae: je 0x108ed03c5 ; UIApplicationMain + 1191
0x108ed03b0: movq 0xd8d2d1(%rip), %rsi ; "setDelegate:"
0x108ed03b7: movq %rbx, %rdi
0x108ed03ba: movq %rbx, %rdx
0x108ed03bd: callq *0xb4cccd(%rip) ; (void *)0x000000010a881000: objc_msgSend
0x108ed03c3: jmp 0x108ed0401 ; UIApplicationMain + 1251
0x108ed03c5: movq 0xd8cfcc(%rip), %rsi ; "alloc"
0x108ed03cc: movq %r14, %rdi
0x108ed03cf: callq *%r12
0x108ed03d2: movq 0xd8d417(%rip), %rsi ; "init"
0x108ed03d9: movq %rax, %rdi
0x108ed03dc: callq *%r12
0x108ed03df: movq 0xd8d4d2(%rip), %rsi ; "autorelease"
0x108ed03e6: movq %rax, %rdi
0x108ed03e9: callq *%r12
0x108ed03ec: movq 0xd8e215(%rip), %rsi ; "_setDelegate:assumeOwnership:"
0x108ed03f3: movl $0x1, %ecx
0x108ed03f8: movq %rbx, %rdi
0x108ed03fb: movq %rax, %rdx
0x108ed03fe: callq *%r12
0x108ed0401: movq 0xd8cf78(%rip), %rsi ; "release"
0x108ed0408: movq -0x58(%rbp), %rdi
0x108ed040c: callq *%r12
0x108ed040f: movq 0xdf6152(%rip), %rdi ; UIApp
0x108ed0416: movq 0xd8e1f3(%rip), %rsi ; "_run"
0x108ed041d: callq *%r12
0x108ed0420: movq 0xb4c5a9(%rip), %rax ; (void *)0x000000010bcf1070: __stack_chk_guard
0x108ed0427: movq (%rax), %rax
0x108ed042a: cmpq -0x30(%rbp), %rax
0x108ed042e: jne 0x108ed0441 ; UIApplicationMain + 1315
0x108ed0430: xorl %eax, %eax
0x108ed0432: addq $0x38, %rsp
0x108ed0436: popq %rbx
0x108ed0437: popq %r12
0x108ed0439: popq %r13
0x108ed043b: popq %r14
0x108ed043d: popq %r15
0x108ed043f: popq %rbp
0x108ed0440: retq
0x108ed0441: callq 0x1096a2936 ; symbol stub for: __stack_chk_fail
0x108ed0446: leaq 0xdf0093(%rip), %rdi ; _UIApplicationIsExtension.once
0x108ed044d: leaq 0xb4f57c(%rip), %rsi ; __block_literal_global616
0x108ed0454: callq 0x1096a29e4 ; symbol stub for: dispatch_once
0x108ed0459: jmp 0x108ed0174 ; UIApplicationMain + 598
breakpoint stops near :
0x108ed0420: movq 0xb4c5a9(%rip), %rax ; (void *)0x000000010bcf1070: __stack_chk_guard
I'm working with xcode 6.3 and swift 1.2. It seems that there is a problem with the pod that you've imported. Try to update the pod installed, then restart xcode and try again. It worked for me :)

Crash in a CAKeyframeAnimation for animating a view along a path

I have some code to animate a UIView: zoom it down while animating it along a path.
It crashes with the error below (reproducible: always):
CoreGraphics`CG::Path::apply(void*, void (*)(void*, CGPathElementType, CGPoint const*)) const:
0x1055c06: pushl %ebp
0x1055c07: movl %esp, %ebp
0x1055c09: subl $24, %esp
0x1055c0c: movl 8(%ebp), %eax
0x1055c0f: movl (%eax), %ecx
0x1055c11: movl (%ecx), %eax
0x1055c13: movl 16(%ebp), %edx
0x1055c16: movl %edx, 8(%esp)
0x1055c1a: movl 12(%ebp), %edx
0x1055c1d: movl %edx, 4(%esp)
0x1055c21: movl %ecx, (%esp)
0x1055c24: calll *64(%eax)
0x1055c27: addl $24, %esp
0x1055c2a: popl %ebp
0x1055c2b: ret
I think it comes from the method below (pathAnimationWithStartPoint:), as if I don't add the CAKeyframeAnimation returned by it, i.e., just:
[group setAnimations:#[ zoomAnimation ]];
instead of
[group setAnimations:#[ zoomAnimation, pathAnimation ]];
it runs without crashing.
- (CAKeyframeAnimation *) pathAnimationWithStartPoint:(CGPoint) startPoint {
CGPoint endPoint = self.showApplicationTourButton.center;
CGFloat xDistanceBetweenStartAndEndPoints = abs(startPoint.x - endPoint.x);
CGFloat yOfHighestPointOfCurvePath = endPoint.y - 250;
CGPoint controlPoint1 = CGPointMake(startPoint.x + 1.0f / 3.0f * xDistanceBetweenStartAndEndPoints, yOfHighestPointOfCurvePath);
CGPoint controlPoint2 = CGPointMake(startPoint.x + 2.0f / 3.0f * xDistanceBetweenStartAndEndPoints, yOfHighestPointOfCurvePath);
CGMutablePathRef curvedPath = CGPathCreateMutable();
CGPathMoveToPoint(curvedPath, NULL, startPoint.x, startPoint.y);
CGPathAddCurveToPoint(curvedPath, NULL, controlPoint1.x, controlPoint1.y, controlPoint2.x, controlPoint2.y, endPoint.x, endPoint.y);
CAKeyframeAnimation *pathAnimation = [CAKeyframeAnimation animationWithKeyPath:#"position"];
pathAnimation.path = curvedPath;
CGPathRelease(curvedPath);
pathAnimation.calculationMode = kCAAnimationPaced;
pathAnimation.fillMode = kCAFillModeForwards;
pathAnimation.removedOnCompletion = NO;
return pathAnimation;
}
Backtrace:
* thread #1: tid = 0x1a03, 0x01055c11 CoreGraphics`CG::Path::apply(void*, void (*)(void*, CGPathElementType, CGPoint const*)) const + 11, stop reason = EXC_BAD_ACCESS (code=2, address=0x0)
frame #0: 0x01055c11 CoreGraphics`CG::Path::apply(void*, void (*)(void*, CGPathElementType, CGPoint const*)) const + 11
frame #1: 0x00f5d090 CoreGraphics`CGPathApply + 64
frame #2: 0x01838c68 QuartzCore`CA::Render::Path::new_path(CGPath const*, bool) + 158
frame #3: 0x018c3493 QuartzCore`-[CAKeyframeAnimation _setCARenderAnimation:layer:] + 176
frame #4: 0x018c3b2c QuartzCore`-[CAKeyframeAnimation _copyRenderAnimationForLayer:] + 68
frame #5: 0x018c6f12 QuartzCore`-[CAAnimationGroup _copyRenderAnimationForLayer:] + 241
frame #6: 0x018df547 QuartzCore`CA::Layer::commit_animations(CA::Transaction*, double (*)(CA::Layer*, double, void*), void (*)(CA::Layer*, CA::Render::Animation*, void*), void (*)(CA::Layer*, void**, void*), void*) + 641
frame #7: 0x01855520 QuartzCore`CA::Context::commit_layer(CA::Layer*, unsigned int, unsigned int, void*) + 94
frame #8: 0x018d87fa QuartzCore`CA::Layer::commit_if_needed(CA::Transaction*, void (*)(CA::Layer*, unsigned int, unsigned int, void*), void*) + 330
frame #9: 0x018d877e QuartzCore`CA::Layer::commit_if_needed(CA::Transaction*, void (*)(CA::Layer*, unsigned int, unsigned int, void*), void*) + 206
frame #10: 0x01856667 QuartzCore`CA::Context::commit_transaction(CA::Transaction*) + 1775
frame #11: 0x01857227 QuartzCore`CA::Transaction::commit() + 395
frame #12: 0x018f9b17 QuartzCore`+[CATransaction commit] + 52
frame #13: 0x000399bf MyApp`-[HomeViewController catchTourScrollViewScreenshotViewAndAnimateItToButton](self=0x0b4e5210, _cmd=0x006f381a) + 1903 at HomeViewController.m:197
frame #14: 0x0391f663 libobjc.A.dylib`-[NSObject performSelector:] + 62
frame #15: 0x0003c383 MyApp`-[NSObject(self=0x0b4e5210, _cmd=0x006ef5ad, selector=0x006f381a) performSelectorIfRespondsToIt:] + 243 at NSObject+PerformSelectorIfRespondsToIt.m:22
frame #16: 0x00042506 MyApp`__44-[TourViewController closeTourWithAnimation]_block_invoke268(.block_descriptor=0x0b6985a0, finished='\x01') + 86 at TourViewController.m:419
frame #17: 0x01af0df6 UIKit`-[UIViewAnimationBlockDelegate _didEndBlockAnimation:finished:context:] + 223
frame #18: 0x01ae3d66 UIKit`-[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 237
frame #19: 0x01ae3f04 UIKit`-[UIViewAnimationState animationDidStop:finished:] + 68
frame #20: 0x12b6ff28 UIKit`-[UIViewAnimationStateAccessibility(SafeCategory) animationDidStop:finished:] + 66
frame #21: 0x018df7d8 QuartzCore`CA::Layer::run_animation_callbacks(void*) + 284
frame #22: 0x03a90014 libdispatch.dylib`_dispatch_client_callout + 14
frame #23: 0x03a807d5 libdispatch.dylib`_dispatch_main_queue_callback_4CF + 296
frame #24: 0x03f3eaf5 CoreFoundation`__CFRunLoopRun + 1925
frame #25: 0x03f3df44 CoreFoundation`CFRunLoopRunSpecific + 276
frame #26: 0x03f3de1b CoreFoundation`CFRunLoopRunInMode + 123
frame #27: 0x044c67e3 GraphicsServices`GSEventRunModal + 88
frame #28: 0x044c6668 GraphicsServices`GSEventRun + 104
frame #29: 0x01aa5ffc UIKit`UIApplicationMain + 1211
frame #30: 0x0000285d MyApp`main(argc=1, argv=0xbffff3f4) + 141 at main.m:16
frame #31: 0x00002785 MyApp`start + 53
* thread #1: tid = 0x1a03, 0x01055c11 CoreGraphics`CG::Path::apply(void*, void (*)(void*, CGPathElementType, CGPoint const*)) const + 11, stop reason = EXC_BAD_ACCESS (code=2, address=0x0)
frame #0: 0x01055c11 CoreGraphics`CG::Path::apply(void*, void (*)(void*, CGPathElementType, CGPoint const*)) const + 11
frame #1: 0x00f5d090 CoreGraphics`CGPathApply + 64
frame #2: 0x01838c68 QuartzCore`CA::Render::Path::new_path(CGPath const*, bool) + 158
frame #3: 0x018c3493 QuartzCore`-[CAKeyframeAnimation _setCARenderAnimation:layer:] + 176
frame #4: 0x018c3b2c QuartzCore`-[CAKeyframeAnimation _copyRenderAnimationForLayer:] + 68
frame #5: 0x018c6f12 QuartzCore`-[CAAnimationGroup _copyRenderAnimationForLayer:] + 241
frame #6: 0x018df547 QuartzCore`CA::Layer::commit_animations(CA::Transaction*, double (*)(CA::Layer*, double, void*), void (*)(CA::Layer*, CA::Render::Animation*, void*), void (*)(CA::Layer*, void**, void*), void*) + 641
frame #7: 0x01855520 QuartzCore`CA::Context::commit_layer(CA::Layer*, unsigned int, unsigned int, void*) + 94
frame #8: 0x018d87fa QuartzCore`CA::Layer::commit_if_needed(CA::Transaction*, void (*)(CA::Layer*, unsigned int, unsigned int, void*), void*) + 330
frame #9: 0x018d877e QuartzCore`CA::Layer::commit_if_needed(CA::Transaction*, void (*)(CA::Layer*, unsigned int, unsigned int, void*), void*) + 206
frame #10: 0x01856667 QuartzCore`CA::Context::commit_transaction(CA::Transaction*) + 1775
frame #11: 0x01857227 QuartzCore`CA::Transaction::commit() + 395
frame #12: 0x018f9b17 QuartzCore`+[CATransaction commit] + 52
frame #13: 0x000399bf MyApp`-[HomeViewController catchTourScrollViewScreenshotViewAndAnimateItToButton](self=0x0b4e5210, _cmd=0x006f381a) + 1903 at HomeViewController.m:197
frame #14: 0x0391f663 libobjc.A.dylib`-[NSObject performSelector:] + 62
frame #15: 0x0003c383 MyApp`-[NSObject(self=0x0b4e5210, _cmd=0x006ef5ad, selector=0x006f381a) performSelectorIfRespondsToIt:] + 243 at NSObject+PerformSelectorIfRespondsToIt.m:22
frame #16: 0x00042506 MyApp`__44-[TourViewController closeTourWithAnimation]_block_invoke268(.block_descriptor=0x0b6985a0, finished='\x01') + 86 at TourViewController.m:419
frame #17: 0x01af0df6 UIKit`-[UIViewAnimationBlockDelegate _didEndBlockAnimation:finished:context:] + 223
frame #18: 0x01ae3d66 UIKit`-[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 237
frame #19: 0x01ae3f04 UIKit`-[UIViewAnimationState animationDidStop:finished:] + 68
frame #20: 0x12b6ff28 UIKit`-[UIViewAnimationStateAccessibility(SafeCategory) animationDidStop:finished:] + 66
frame #21: 0x018df7d8 QuartzCore`CA::Layer::run_animation_callbacks(void*) + 284
frame #22: 0x03a90014 libdispatch.dylib`_dispatch_client_callout + 14
frame #23: 0x03a807d5 libdispatch.dylib`_dispatch_main_queue_callback_4CF + 296
frame #24: 0x03f3eaf5 CoreFoundation`__CFRunLoopRun + 1925
frame #25: 0x03f3df44 CoreFoundation`CFRunLoopRunSpecific + 276
frame #26: 0x03f3de1b CoreFoundation`CFRunLoopRunInMode + 123
frame #27: 0x044c67e3 GraphicsServices`GSEventRunModal + 88
frame #28: 0x044c6668 GraphicsServices`GSEventRun + 104
frame #29: 0x01aa5ffc UIKit`UIApplicationMain + 1211
frame #30: 0x0000285d MyApp`main(argc=1, argv=0xbffff3f4) + 141 at main.m:16
frame #31: 0x00002785 MyApp`start + 53
Turning on NSZombie does not give any more useful debug information.
The same code used to work before upgrading to Xcode 4.6.3 (4H1503). To be noted: in the simulator, the animation sometimes was paused and clicking on it would resume it. This weird artifact was a sign that something was wrong but I didn't know it yet.
Did I miss something?
If this is a known bug, is there any workaround?
Some research notes:
A similar question has been asked on SO, but the accepted answer just "fix" the problem by changing the path animation to a linear translation.
My problem seems also very similar to the blog post here: http://www.blogosfera.co.uk/2013/08/exc_bad_access-while-using-coreanimation/
This really isn't much of answer, but more of an attempt to give you a tool to find more clues. Hopefully, someone with more clue than I will chime in.
Turn on malloc stack logging.
Reproduce the crash.
Check the registers; if $r0 or $r1 look like heap allocations, then get the malloc history of said address(s).
If the last event on either is a FREE, then the data buffer (or object) is being freed prematurely. (see http://lldb.llvm.org/lldb-gdb.html for information on grabbing the malloc history).
Now, that may not actually help you that much even if it confirms that it is a premature deallocation. What it will tell you, if so, is that it is a race condition. Unfortunately, fixing it isn't really possible, but a workaround might be. If you can figure out what object you control that might have allocated the prematurely free()d buffer, then you ought to be able to hold a strong reference to said object until the animation is fully completed.
And file a bug, attaching your crashing binary, please.
Also, turn on malloc scribble. That'll ensure that deallocated memory is trashed immediately upon deallocation, which should make the crash happen as soon as it possibly can.

Debugging in XCode: Exception Breakpoints

I'm debugging a random SIGTRAP crash right now that just happens in the background. It's probably something that has to do with an NSManagedObjectContext somewhere.
Besides that, I'm trying to debug it using an exception breakpoint to at least find out where it's originating from. The only problem is that the crash/breakpoint occurs in a 0 objc_exception_throw, which is no help to me.
The data I get back looks like this:
libobjc.A.dylib`objc_exception_throw:
0x32a3a960: push {r4, r5, r6, r7, lr} // breakpoint stops here
0x32a3a962: add r7, sp, #12
0x32a3a964: mov r4, r0
0x32a3a966: movs r0, #16
0x32a3a968: blx 0x32a46854 ; symbol stub for: -[NSObject isEqual:]
So my question is, how I can I create an exception breakpoint to initiate itself earlier? I'm trying to make the breakpoint occur in the last bit of actual Objective-C code before the crash.
I have tried editing the breakpoint to be shared, break on throw, then break on catch, and have changed the type of exception between Objective-C, C++, and "all" with no luck.
How can I make the exception breakpoint throw earlier?
Unless there is a way to decipher the code I posted. If that's possible, please give me a brief explanation of what it means, and how you deciphered it so I can learn to do so as well :)
Thanks everyone!
If I let the program run...
It continues to the crash, which looks like this:
libsystem_kernel.dylib`mach_msg_trap:
0x30830ea0: mov r12, sp
0x30830ea4: push {r4, r5, r6, r8}
0x30830ea8: ldm r12, {r4, r5, r6}
0x30830eac: mvn r12, #30
0x30830eb0: svc #128
0x30830eb4: pop {r4, r5, r6, r8} // SIGTRAP throws here
0x30830eb8: bx lr
Stack trace when running command "bt" as a debugger command
* thread #13: tid = 0x2337, 0x32a3a960 libobjc.A.dylib`objc_exception_throw, stop reason = breakpoint 1.1
frame #0: 0x32a3a960 libobjc.A.dylib`objc_exception_throw
frame #1: 0x340f9fee CoreData`-[NSPersistentStoreCoordinator executeRequest:withContext:error:] + 298
frame #2: 0x341522d2 CoreData`-[NSManagedObjectContext save:] + 730
frame #3: 0x32054b02 UIKit`__84-[UIManagedDocument writeContents:toURL:forSaveOperation:originalContentsURL:error:]_block_invoke_0 + 30
frame #4: 0x34155bc0 CoreData`developerSubmittedBlockToNSManagedObjectContextPerform + 88
frame #5: 0x36e3d4b6 libdispatch.dylib`_dispatch_client_callout + 22
frame #6: 0x36e419f6 libdispatch.dylib`_dispatch_barrier_sync_f_invoke + 30
frame #7: 0x34155d42 CoreData`-[NSManagedObjectContext performBlockAndWait:] + 174
frame #8: 0x32054862 UIKit`-[UIManagedDocument writeContents:toURL:forSaveOperation:originalContentsURL:error:] + 986
frame #9: 0x3205418a UIKit`-[UIManagedDocument writeContents:andAttributes:safelyToURL:forSaveOperation:error:] + 698
frame #10: 0x32017ce4 UIKit`__block_global_4 + 68
frame #11: 0x32017c80 UIKit`__block_global_3 + 156
frame #12: 0x339c767c Foundation`-[NSFileCoordinator _invokeAccessor:thenCompletionHandler:] + 144
frame #13: 0x339c791e Foundation`__73-[NSFileCoordinator coordinateWritingItemAtURL:options:error:byAccessor:]_block_invoke_0 + 90
frame #14: 0x339c894e Foundation`-[NSFileCoordinator(NSPrivate) _invokeAccessor:orDont:thenRelinquishAccessClaimForID:] + 202
frame #15: 0x339c926c Foundation`-[NSFileCoordinator(NSPrivate) _coordinateWritingItemAtURL:options:error:byAccessor:] + 548
frame #16: 0x339c78be Foundation`-[NSFileCoordinator coordinateWritingItemAtURL:options:error:byAccessor:] + 90
frame #17: 0x32017254 UIKit`-[UIDocument _coordinateWritingItemAtURL:error:byAccessor:] + 720
frame #18: 0x320179a0 UIKit`__59-[UIDocument saveToURL:forSaveOperation:completionHandler:]_block_invoke_0 + 284
frame #19: 0x36e3e11e libdispatch.dylib`_dispatch_call_block_and_release + 10
frame #20: 0x36e41ece libdispatch.dylib`_dispatch_queue_drain$VARIANT$mp + 142
frame #21: 0x36e41dc0 libdispatch.dylib`_dispatch_queue_invoke$VARIANT$mp + 40
frame #22: 0x36e4291c libdispatch.dylib`_dispatch_root_queue_drain + 184
frame #23: 0x36e42ac0 libdispatch.dylib`_dispatch_worker_thread2 + 84
frame #24: 0x33ba7a10 libsystem_c.dylib`_pthread_wqthread + 360
frame #25: 0x33ba78a4 libsystem_c.dylib`start_wqthread + 8
Check out the link that Matt Wilding posted in the comments of his answer!
You don't have much control over where that breakpoint triggers. Once you've hit the breakpoint though, you can use the bt command to print the current stack trace.
EDIT: With the backtrace...
It looks like UIDocument's -saveToURL:forSaveOperation:completionHandler: method is the culprit. I've never used the class before, so I can't help too much. If you're calling that method anywhere in your code (like from a block?), you could also put a breakpoint there, in anticipation of the failure.

Resources