printing a stack trace to the console
printing a stack trace to the console
- Subject: printing a stack trace to the console
- From: Jonathan Sand <email@hidden>
- Date: Wed, 31 Mar 2004 00:44:22 -0800
Does anyone know the magic incantation to create a string of a stack
trace? I'd like to "instrument" my code to print a stack trace to the
console at a particular point in my code. I want to who is calling it
-- there are an ungodly number of suspects. Gdb isn't a good candidate
because I need to send this code to a client, upon whom I'd prefer not
to foist gdb's learning curve.
I've looked into "defaults write NSGlobalDomain NSExceptionHandlingMask
63" but defaults apparently doesn't work quite that way anymore. If it
did, I could write the following objective-C method:
- (void)printStackTrace {
NS_DURING
[NSException raise:0 format:@"stack trace requested!"];
NS_HANDLER
NSLog(@"%@", [localException userInfo]);
NS_ENDHANDLER
}
This would be a rather nifty thing -- if the defaults exception
handling mask could be set, says the Apple Developer documentation, the
userInfo would contain a stack trace.
Jonathan Sand
(: enlightenment would be nice :)
email@hidden
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.