Stack trace for exceptions trimmed off on Lion?
Stack trace for exceptions trimmed off on Lion?
- Subject: Stack trace for exceptions trimmed off on Lion?
- From: Oleg Krupnov <email@hidden>
- Date: Sun, 07 Aug 2011 12:58:26 +0300
Hi,
I've occasionally noticed after upgrading to Lion that my exception
handling code no longer provides full stack trace, but only some
trimmed piece.
For example, I performed the following experiment. There is an
-emulateCrash: action method, implemented in MyWindowController,
attached to a menu command. In that method I simply raise and
NSAssert(false, @"Test crash").
Here is the full stack trace I see in the debugger:
0 CoreFoundation 0x00007fff93b9d986
__exceptionPreprocess + 198
1 libobjc.A.dylib 0x00007fff92623d5e
objc_exception_throw + 43
2 CoreFoundation 0x00007fff93b9d7ba
+[NSException raise:format:arguments:] + 106
3 Foundation 0x00007fff88df014f
-[NSAssertionHandler
handleFailureInMethod:object:file:lineNumber:description:] + 169
4 MyApp 0x00000001000445e6
-[MyWindowController emulateCrash:] + 195
5 CoreFoundation 0x00007fff93b8d11d -[NSObject
performSelector:withObject:] + 61
6 AppKit 0x00007fff89d71852
-[NSApplication sendAction:to:from:] + 139
7 AppKit 0x00007fff89e5e34f
-[NSMenuItem _corePerformAction] + 399
8 AppKit 0x00007fff89e5e086
-[NSCarbonMenuImpl performActionWithHighlightingForItemAtIndex:] + 125
9 AppKit 0x00007fff8a0f9e9c -[NSMenu
_internalPerformActionForItemAtIndex:] + 38
10 AppKit 0x00007fff89f8c3f1
-[NSCarbonMenuImpl _carbonCommandProcessEvent:handlerCallRef:] + 138
11 AppKit 0x00007fff89dd80bf
NSSLMMenuEventHandler + 339
12 HIToolbox 0x00007fff935478ec
_ZL23DispatchEventToHandlersP14EventTargetRecP14OpaqueEventRefP14HandlerCallRec
+ 1263
13 HIToolbox 0x00007fff93546ef8
_ZL30SendEventToEventTargetInternalP14OpaqueEventRefP20OpaqueEventTargetRefP14HandlerCallRec
+ 446
14 HIToolbox 0x00007fff9355dd03
SendEventToEventTarget + 76
15 HIToolbox 0x00007fff935a4249
_ZL18SendHICommandEventjPK9HICommandjjhPKvP20OpaqueEventTargetRefS5_PP14OpaqueEventRef
+ 398
16 HIToolbox 0x00007fff9368b0f1
SendMenuCommandWithContextAndModifiers + 56
17 HIToolbox 0x00007fff936d15e1
SendMenuItemSelectedEvent + 253
18 HIToolbox 0x00007fff9359d32d
_ZL19FinishMenuSelectionP13SelectionDataP10MenuResultS2_ + 101
19 HIToolbox 0x00007fff93594a75
_ZL14MenuSelectCoreP8MenuData5PointdjPP13OpaqueMenuRefPt + 600
20 HIToolbox 0x00007fff93594034
_HandleMenuSelection2 + 585
21 AppKit 0x00007fff89cd7ce1
_NSHandleCarbonMenuEvent + 250
22 AppKit 0x00007fff89c6d6c7 _DPSNextEvent + 1993
23 AppKit 0x00007fff89c6ca95
-[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 135
24 AppKit 0x00007fff89c693d6
-[NSApplication run] + 463
25 AppKit 0x00007fff89ee752a
NSApplicationMain + 867
26 MyApp 0x0000000100001f27 main + 33
27 MyApp 0x0000000100001ee4 start + 52
28 ??? 0x0000000000000001 0x0 + 1
However, when I look at -[NSException callStackReturnAddresses] or
[[exception userInfo] objectForKey:@"NSStackTraceKey"], I only get
this:
0 HIToolbox 0x7fff93547910
_ZL23DispatchEventToHandlersP14EventTargetRecP14OpaqueEventRefP14HandlerCallRec()
1 HIToolbox 0x7fff93546ef8
_ZL30SendEventToEventTargetInternalP14OpaqueEventRefP20OpaqueEventTargetRefP14HandlerCallRec()
2 HIToolbox 0x7fff9355dd03 SendEventToEventTarget()
3 HIToolbox 0x7fff935a4249
_ZL18SendHICommandEventjPK9HICommandjjhPKvP20OpaqueEventTargetRefS5_PP14OpaqueEventRef()
4 HIToolbox 0x7fff9368b0f1 SendMenuCommandWithContextAndModifiers()
5 HIToolbox 0x7fff936d15e1 SendMenuItemSelectedEvent()
6 HIToolbox 0x7fff9359d32d
_ZL19FinishMenuSelectionP13SelectionDataP10MenuResultS2_()
7 HIToolbox 0x7fff93594a75
_ZL14MenuSelectCoreP8MenuData5PointdjPP13OpaqueMenuRefPt() 8
HIToolbox 0x7fff93594034 _HandleMenuSelection2()
9 AppKit 0x7fff89cd7ce1 _NSHandleCarbonMenuEvent()
10 AppKit 0x7fff89c6d6c7 _DPSNextEvent()
11 AppKit 0x7fff89c6ca95 +[NSApplication
nextEventMatchingMask:untilDate:inMode:dequeue:]
12 AppKit 0x7fff89c693d6 +[NSApplication run]
13 AppKit 0x7fff89ee752a NSApplicationMain()
14 MyApp 0x100001f27 main()
15 MyApp 0x100001ee4 start()
16 ??? 0x000001 ??()
(I use NSExceptionHandler's exceptionHandlingMask of to handle
top-level exceptions)
To me it looks like the exception initially thrown is being caught in
_ZL23DispatchEventToHandlersP14EventTargetRecP14OpaqueEventRefP14HandlerCallRec
and a new exception is re-thrown from there, resulting in trimmed
stack trace.
Can anybody shed some light on this? I cannot seem to google anything
on the subject. Thanks!
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden