• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
printing a stack trace to the console
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


  • Follow-Ups:
    • Re: printing a stack trace to the console
      • From: Allan Odgaard <email@hidden>
    • Re: printing a stack trace to the console
      • From: j o a r <email@hidden>
  • Prev by Date: Re: Distributed Objects pitfalls and strategies (SOLUTION (?))
  • Next by Date: Re: printing a stack trace to the console
  • Previous by thread: Re: Incompatible types error using vImage
  • Next by thread: Re: printing a stack trace to the console
  • Index(es):
    • Date
    • Thread