The Best Practice for Logging Uncaught Exceptions?
The Best Practice for Logging Uncaught Exceptions?
- Subject: The Best Practice for Logging Uncaught Exceptions?
- From: "Oleg Krupnov" <email@hidden>
- Date: Sun, 23 Nov 2008 12:56:07 +0200
I need to do what seems a very basic thing, but the more I read on the
topic, the more confused I get. I wonder how you folks manage the
following task.
I want my program to log all *uncaught* exceptions, with their stack
traces, so that I could decipher them upon receipt, using the symbol
files that I've got on the developer computer, and debug.
Basically, I'm interested in failed assertions, framework exceptions
(like index out of bounds etc.) and system crashes.
There is NSSetUncaughtExceptionHandler, but as the doc says,
"Exceptions on the main thread of a Cocoa application do not typically
rise to the level of the uncaught exception handler because
NSApplication catches all such exceptions.". Is there a way to
override this behavior?
Also there is -[NSExceptionHandler setExceptionHandlingMask], but it
will intercept even handled exceptions, which is not desired. For
example, some frameworks are known to use exceptions in their normal
work, so I would not like to interfere globally with them.
In addition there is CrashReporter, but it is not clear in what cases
it is triggered (see the doc quote above) and how I (not Apple!) can
get that crash dump.
So the question is: what is the recommended way to intercept all
uncaught exceptions for logging purposes?
Next, I will need to decipher the stack trace. Upon catching an
uncaught exception, I'd get the numeric addresses like this:
NSString* stack = [[exception userInfo] objectForKey:NSStackTraceKey];
Then this string is sent to me from the remote computer, and I need to
get the decorated names on my computer. How do I do this, using atos
or anything like that? Does it matter for atos that the debugged
program is not currently running?
Also, I may be working on a newer version of the program already. Do I
have to archive both source code of the previous version and the
distributed executable, or only the executable and its symbol (asym)
file to be able to see the stack trace and debug?
_______________________________________________
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