• 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
Re: printing a stack trace to the console
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: printing a stack trace to the console


  • Subject: Re: printing a stack trace to the console
  • From: j o a r <email@hidden>
  • Date: Wed, 31 Mar 2004 11:04:48 +0200

Read the headers for the ExceptionHandling.framework.
It's really easy to grab out backtraces on exceptions using this
framework.

j o a r

On 2004-03-31, at 10.44, Jonathan Sand wrote:

> 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.

[demime 0.98b removed an attachment of type application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
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.


References: 
 >printing a stack trace to the console (From: Jonathan Sand <email@hidden>)

  • Prev by Date: printing a stack trace to the console
  • Next by Date: Re: printing a stack trace to the console
  • Previous by thread: printing a stack trace to the console
  • Next by thread: Re: printing a stack trace to the console
  • Index(es):
    • Date
    • Thread