Did you try:
NSException.h:
        void NSSetUncaughtExceptionHandler(NSUncaughtExceptionHandler *);

Be aware that I don't have any experience with this API - my implementation has 
top level exception handlers in relevant places, so I should never see an 
uncaught exception.

Jesper

On Feb 2, 2010, at 12:41 PM, Oleg Krupnov wrote:

> Good point, Jesper.
>
> But in this case, how should I catch real unhandled exceptions and
> send bug reports? What is the recommended best practice?
>
> Thanks!
>
> On Tue, Feb 2, 2010 at 10:22 PM, Jesper Storm Bache <jsba...@adobe.com> wrote:
>> My advice is: Don't do this in release builds. There is nothing that says 
>> that Apple in the future will throw more exceptions inside their 
>> implementation (in a different framework) - and you'll then have to patch 
>> your handler again.
>> Feel free to experiment with this kind of functionality in your debug builds.
>> Alternatively have a "Debug level" preference that you can have users turn 
>> on (and off). Make the default "Off".
>>
>> Jesper
>>
>> On Feb 2, 2010, at 12:18 PM, Oleg Krupnov wrote:
>>
>>> Fixed now, it worked like a charm! :)
>>>
>>> Indeed, I was intercepting exceptions from the AX framework in my -
>>> (BOOL)exceptionHandler:(NSExceptionHandler*)sender
>>> shouldHandleException:(NSException*)exception mask:(unsigned int)mask
>>> delegate method. This only occurs on Snow Leopard but not on Leopard.
>>> I was able to reproduce the bug using the Accessibility Inspector
>>> utility. And I have fixed it as advised.
>>>
>>> Thanks a ton to everybody who responded!!!
>>>
>>>
>>> On Tue, Feb 2, 2010 at 9:09 PM, Jesper Storm Bache <jsba...@adobe.com> 
>>> wrote:
>>>> Are you sure you are seeing "unhandled exceptions", or simply 
>>>> "NSExceptions" that are handled somewhere inside the Ax framework.
>>>> If it is the latter, then you'll need to allow NSExceptions from inside 
>>>> the Ax framework to propagate to their handlers (also inside the Ax 
>>>> framework).
>>>> Note: Apple does *not* guarantee that their implementation is NSException 
>>>> free; you just should not see such exceptions being thrown back to your 
>>>> code.
>>>>
>>>> For this reason I only enable NSException detection logic in my debug 
>>>> builds, and the current version of my debug handler is:
>>>>
>>>> void ExceptionCallback(id exceptionObject)
>>>> {
>>>>      bool doBreak = true;
>>>>      if ([exceptionObject isKindOfClass:[NSException class]])
>>>>      {
>>>>              NSString* name = [exceptionObject name];
>>>>
>>>>              // Ignore exceptions from the accessibility framework because 
>>>> it uses
>>>>              // exceptions for flow control
>>>>              doBreak = ![name isEqualToString:NSAccessibilityException];
>>>>      }
>>>>
>>>>      if (doBreak)
>>>>      {
>>>>              report_problem(...)
>>>>      }
>>>> }
>>>>
>>>> Jesper Storm Bache
>>>>
>>>> On Feb 2, 2010, at 10:58 AM, Oleg Krupnov wrote:
>>>>
>>>>> Thanks Ken,
>>>>>
>>>>> I don't quite understand your response though. What do you mean by
>>>>> "unexceptional exceptions"? How should I handle those exceptions, and
>>>>> why should I, if I don't make any calls to accessibility frameworks at
>>>>> all?
>>>>>
>>>>> The report I have included in the first post is all I have so far.
>>>>>
>>>>>
>>>>>
>>>>> On Tue, Feb 2, 2010 at 8:51 PM, Ken Ferry <kenfe...@gmail.com> wrote:
>>>>>> Hi Oleg,
>>>>>> Unfortunately, the accessibility mechanism uses unexceptional exceptions
>>>>>> under the hood.  These are a normal part of operation.  They shouldn't be
>>>>>> unhandled though… are you sure you're reporting what you think you are?
>>>>>> -Ken
>>>>>> On Tue, Feb 2, 2010 at 6:41 PM, Oleg Krupnov <oleg.krup...@gmail.com> 
>>>>>> wrote:
>>>>>>>
>>>>>>> Hi Corbin,
>>>>>>>
>>>>>>> Thanks for your quick response. You are right, I should have been more
>>>>>>> specific. This is not a "crash" in precise meaning. This is an
>>>>>>> unhandled exception raised by appkit's accessibility and caught by my
>>>>>>> crash reporter facility that prints the stack trace and sends it to me
>>>>>>> by e-mail. There is no real, severe crash like that one when you see
>>>>>>> the Apple's crash report dialog.
>>>>>>>
>>>>>>> The question is -- why this exception is raised? I don't even mention
>>>>>>> anything related to AX anywhere in my app. I must confess I have never
>>>>>>> even read the accessibility section of the docs and don't know what it
>>>>>>> is.
>>>>>>>
>>>>>>>> From the stack trace it appears that the exception occurs even before
>>>>>>> any of my own code is entered,  somewhere in system frameworks.
>>>>>>>
>>>>>>> And it happens only on selected Macs.
>>>>>>>
>>>>>>> Do you have any idea?
>>>>>>>
>>>>>>> Thanks.
>>>>>>>
>>>>>>> On Tue, Feb 2, 2010 at 8:34 PM, Corbin Dunn <corb...@apple.com> wrote:
>>>>>>>> Oleg,
>>>>>>>>
>>>>>>>> I think you are misinterpreting an exception being raised as a crash of
>>>>>>>> your application. The bt's below are not crashes; they are exceptions 
>>>>>>>> being
>>>>>>>> raised (and caught) by appkit's accessibility.
>>>>>>>>
>>>>>>>> I understand that you have a problem with your app crashing -- do you
>>>>>>>> have some actual crash reports? If so, reply with those to the list 
>>>>>>>> and we
>>>>>>>> may be able to help you.
>>>>>>>>
>>>>>>>> -corbin
>>>>>>>>
>>>>>>>> On Feb 2, 2010, at 10:04 AM, Oleg Krupnov wrote:
>>>>>>>>
>>>>>>>>> Hi,
>>>>>>>>>
>>>>>>>>> After publishing an update of my app, I have received quite a few
>>>>>>>>> crash dumps with very weird stack traces that I cannot understand and
>>>>>>>>> fix.
>>>>>>>>>
>>>>>>>>> Namely, the exception message says that AXTitle, or AXWindow or
>>>>>>>>> AXValue or AXDocument etc. is unsupported by NSWindow, NSOpenPanel,
>>>>>>>>> NSApplication and others. Does it have something to do with
>>>>>>>>> accessibility? In what way?
>>>>>>>>>
>>>>>>>>> If someone knows what's that supposed to mean, a quick response would
>>>>>>>>> be very much appreciated. This is an emergency for me.
>>>>>>>>>
>>>>>>>>> Here's one of those logs (All those users are running Snow Leopard
>>>>>>>>> 10.6.2):
>>>>>>>>>
>>>>>>>>> MESSAGE:
>>>>>>>>> "AXTitle" attribute unsupported by: <NSOpenPanel: 0x5bb190>
>>>>>>>>>
>>>>>>>>> STACK TRACE:
>>>>>>>>> #0  0x98b80d24 NSExceptionHandlerExceptionRaiser()
>>>>>>>>>
>>>>>>>>> (/System/Library/Frameworks/ExceptionHandling.framework/Versions/A/ExceptionHandling)
>>>>>>>>> #1  0x94bc5509 objc_exception_throw()  (/usr/lib/libobjc.A.dylib)
>>>>>>>>> #2  0x97a91a21 +[NSException raise]
>>>>>>>>>
>>>>>>>>> (/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation)
>>>>>>>>> #3  0x91d9a55c NSAccessibilityAttributeValue()
>>>>>>>>> (/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit)
>>>>>>>>> #4  0x91fb243f CopyAppKitUIElementAttributeValueNoCatch()
>>>>>>>>> (/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit)
>>>>>>>>> #5  0x91fb49d7 CopyAttributeValue()
>>>>>>>>> (/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit)
>>>>>>>>> #6  0x9476bad3 _AXXMIGCopyAttributeValue()
>>>>>>>>>
>>>>>>>>> (/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/HIServices.framework/Versions/A/HIServices)
>>>>>>>>> #7  0x94775b96 _XCopyAttributeValue()
>>>>>>>>>
>>>>>>>>> (/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/HIServices.framework/Versions/A/HIServices)
>>>>>>>>> #8  0x94747c39 mshMIGPerform()
>>>>>>>>>
>>>>>>>>> (/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/HIServices.framework/Versions/A/HIServices)
>>>>>>>>> #9  0x979b28db __CFRunLoopRun()
>>>>>>>>>
>>>>>>>>> (/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation)
>>>>>>>>> #10 0x979b0864 CFRunLoopRunSpecific()
>>>>>>>>>
>>>>>>>>> (/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation)
>>>>>>>>> #11 0x979b0691 CFRunLoopRunInMode()
>>>>>>>>>
>>>>>>>>> (/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation)
>>>>>>>>> #12 0x973c9f0c RunCurrentEventLoopInMode()
>>>>>>>>>
>>>>>>>>> (/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox)
>>>>>>>>> #13 0x973c9cc3 ReceiveNextEventCommon()
>>>>>>>>>
>>>>>>>>> (/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox)
>>>>>>>>> #14 0x973c9b48 BlockUntilNextEventMatchingListInMode()
>>>>>>>>>
>>>>>>>>> (/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox)
>>>>>>>>> #15 0x91d4eac5 _DPSNextEvent()
>>>>>>>>> (/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit)
>>>>>>>>> #16 0x91d4e306 -[NSApplication
>>>>>>>>> nextEventMatchingMask:untilDate:inMode:dequeue:]()
>>>>>>>>> (/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit)
>>>>>>>>> #17 0x13a2754b +[NSApplication
>>>>>>>>> nextEventMatchingMask:untilDate:inMode:dequeue:]
>>>>>>>>> (/Library/PreferencePanes/Smart Scroll.prefPane/Contents/MacOS/Smart
>>>>>>>>> Scroll.bundle/Contents/MacOS/Smart Scroll)
>>>>>>>>> #18 0x91d1049f +[NSApplication run]
>>>>>>>>> (/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit)
>>>>>>>>> #19 0x91d08535 NSApplicationMain()
>>>>>>>>> (/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit)
>>>>>>>>> #20 0x0022ca start()
>>>>>>>>> (/Applications/DaisyDisk.app/Contents/MacOS/DaisyDisk)
>>>>>>>>> #21 0x000002 ??()  (??)
>>>>>>>>>
>>>>>>>>> Here is another:
>>>>>>>>>
>>>>>>>>> MESSAGE:
>>>>>>>>> "AXValue" attribute unsupported by: <NSButtonCell: 0x5cd0d0>
>>>>>>>>>
>>>>>>>>> STACK TRACE:
>>>>>>>>> #0  0x95d86d24 NSExceptionHandlerExceptionRaiser()
>>>>>>>>>
>>>>>>>>> (/System/Library/Frameworks/ExceptionHandling.framework/Versions/A/ExceptionHandling)
>>>>>>>>> #1  0x9212d509 objc_exception_throw()  (/usr/lib/libobjc.A.dylib)
>>>>>>>>> #2  0x94dcba21 +[NSException raise]
>>>>>>>>>
>>>>>>>>> (/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation)
>>>>>>>>> #3  0x938de55c NSAccessibilityAttributeValue()
>>>>>>>>> (/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit)
>>>>>>>>> #4  0x93af643f CopyAppKitUIElementAttributeValueNoCatch()
>>>>>>>>> (/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit)
>>>>>>>>> #5  0x93af89d7 CopyAttributeValue()
>>>>>>>>> (/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit)
>>>>>>>>> #6  0x90b34ad3 _AXXMIGCopyAttributeValue()
>>>>>>>>>
>>>>>>>>> (/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/HIServices.framework/Versions/A/HIServices)
>>>>>>>>> #7  0x90b3eb96 _XCopyAttributeValue()
>>>>>>>>>
>>>>>>>>> (/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/HIServices.framework/Versions/A/HIServices)
>>>>>>>>> #8  0x90b10c39 mshMIGPerform()
>>>>>>>>>
>>>>>>>>> (/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/HIServices.framework/Versions/A/HIServices)
>>>>>>>>> #9  0x94cec8db __CFRunLoopRun()
>>>>>>>>>
>>>>>>>>> (/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation)
>>>>>>>>> #10 0x94cea864 CFRunLoopRunSpecific()
>>>>>>>>>
>>>>>>>>> (/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation)
>>>>>>>>> #11 0x94cea691 CFRunLoopRunInMode()
>>>>>>>>>
>>>>>>>>> (/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation)
>>>>>>>>> #12 0x98525f0c RunCurrentEventLoopInMode()
>>>>>>>>>
>>>>>>>>> (/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox)
>>>>>>>>> #13 0x98525bff ReceiveNextEventCommon()
>>>>>>>>>
>>>>>>>>> (/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox)
>>>>>>>>> #14 0x98525b48 BlockUntilNextEventMatchingListInMode()
>>>>>>>>>
>>>>>>>>> (/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox)
>>>>>>>>> #15 0x93892ac5 _DPSNextEvent()
>>>>>>>>> (/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit)
>>>>>>>>> #16 0x93892306 +[NSApplication
>>>>>>>>> nextEventMatchingMask:untilDate:inMode:dequeue:]
>>>>>>>>> (/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit)
>>>>>>>>> #17 0x9385449f +[NSApplication run]
>>>>>>>>> (/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit)
>>>>>>>>> #18 0x9384c535 NSApplicationMain()
>>>>>>>>> (/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit)
>>>>>>>>> #19 0x0022ca start()
>>>>>>>>> (/Applications/DaisyDisk.app/Contents/MacOS/DaisyDisk)
>>>>>>>>> #20 0x000002 ??()  (??)
>>>>>>>>>
>>>>>>>>> Here's yet another:
>>>>>>>>>
>>>>>>>>> MESSAGE:
>>>>>>>>> "AXValue" attribute unsupported by: <MainWindow: 0x227270>
>>>>>>>>>
>>>>>>>>> STACK TRACE:
>>>>>>>>> #0  0x95d86d24 NSExceptionHandlerExceptionRaiser()
>>>>>>>>>
>>>>>>>>> (/System/Library/Frameworks/ExceptionHandling.framework/Versions/A/ExceptionHandling)
>>>>>>>>> #1  0x9212d509 objc_exception_throw()  (/usr/lib/libobjc.A.dylib)
>>>>>>>>> #2  0x94dcba21 +[NSException raise]
>>>>>>>>>
>>>>>>>>> (/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation)
>>>>>>>>> #3  0x938de55c NSAccessibilityAttributeValue()
>>>>>>>>> (/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit)
>>>>>>>>> #4  0x93af643f CopyAppKitUIElementAttributeValueNoCatch()
>>>>>>>>> (/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit)
>>>>>>>>> #5  0x93af89d7 CopyAttributeValue()
>>>>>>>>> (/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit)
>>>>>>>>> #6  0x90b34ad3 _AXXMIGCopyAttributeValue()
>>>>>>>>>
>>>>>>>>> (/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/HIServices.framework/Versions/A/HIServices)
>>>>>>>>> #7  0x90b3eb96 _XCopyAttributeValue()
>>>>>>>>>
>>>>>>>>> (/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/HIServices.framework/Versions/A/HIServices)
>>>>>>>>> #8  0x90b10c39 mshMIGPerform()
>>>>>>>>>
>>>>>>>>> (/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/HIServices.framework/Versions/A/HIServices)
>>>>>>>>> #9  0x94cec8db __CFRunLoopRun()
>>>>>>>>>
>>>>>>>>> (/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation)
>>>>>>>>> #10 0x94cea864 CFRunLoopRunSpecific()
>>>>>>>>>
>>>>>>>>> (/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation)
>>>>>>>>> #11 0x94cea691 CFRunLoopRunInMode()
>>>>>>>>>
>>>>>>>>> (/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation)
>>>>>>>>> #12 0x98525f0c RunCurrentEventLoopInMode()
>>>>>>>>>
>>>>>>>>> (/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox)
>>>>>>>>> #13 0x98525cc3 ReceiveNextEventCommon()
>>>>>>>>>
>>>>>>>>> (/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox)
>>>>>>>>> #14 0x98525b48 BlockUntilNextEventMatchingListInMode()
>>>>>>>>>
>>>>>>>>> (/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox)
>>>>>>>>> #15 0x93892ac5 _DPSNextEvent()
>>>>>>>>> (/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit)
>>>>>>>>> #16 0x93892306 +[NSApplication
>>>>>>>>> nextEventMatchingMask:untilDate:inMode:dequeue:]
>>>>>>>>> (/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit)
>>>>>>>>> #17 0x9385449f +[NSApplication run]
>>>>>>>>> (/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit)
>>>>>>>>> #18 0x9384c535 NSApplicationMain()
>>>>>>>>> (/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit)
>>>>>>>>> #19 0x0022ca start()
>>>>>>>>> (/Applications/DaisyDisk.app/Contents/MacOS/DaisyDisk)
>>>>>>>>> #20 0x000002 ??()  (??)
>>>>>>>>>
>>>>>>>>> Thanks!
>>>>>>>>
>>>>>>>>
>>>>>>> _______________________________________________
>>>>>>>
>>>>>>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>>>>>>>
>>>>>>> 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:
>>>>>>> http://lists.apple.com/mailman/options/cocoa-dev/kenferry%40gmail.com
>>>>>>>
>>>>>>> This email sent to kenfe...@gmail.com
>>>>>>
>>>>>>
>>>>> _______________________________________________
>>>>>
>>>>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>>>>>
>>>>> 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:
>>>>> http://lists.apple.com/mailman/options/cocoa-dev/jsbache%40adobe.com
>>>>>
>>>>> This email sent to jsba...@adobe.com
>>>>
>>>>
>>
>>

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to