• 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: Breakpoint on @throw?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Breakpoint on @throw?


  • Subject: Re: Breakpoint on @throw?
  • From: Brendan Younger <email@hidden>
  • Date: Mon, 17 Jan 2005 13:26:19 -0600

This takes all of two minutes to figure out with "otool -V -t product_name" and vi. You can set a break for objc_exception_throw(). Or, since the Objective-C exception handling is binary compatible with the old NS_DURING, etc., you can always set a break for _setjmp() as well.

Brendan Younger

On Jan 17, 2005, at 12:57 PM, Prachi Gauriar wrote:

On Jan 17, 2005, at 1:24 PM, Steven Kramer wrote:

Op 17-jan-05 om 18:23 heeft Aaron Hillegass het volgende geschreven:

So, to stop on exceptional conditions in gdb, I'd create a breakpoint:

> fb - [NSException raise]

This works great, but with new style exceptions the raise becomes an @throw:

if (x == 13) {
NSException *badness = [NSException exceptionWithName:@"BadLuckException"
reason:@"13 is unlucky"
userInfo:nil];
@throw badness;
}
(Don't forget "-fobjc-exceptions" when you build.)


Does anyone know how to put a breakpoint on @throw? Thanks.

@throw is mostly syntactic sugar for [NSException raise]. You can still break on raise.

@throw can throw arbitrary objects (you can @throw strings or arrays or whatever), so breaking on raise in these cases doesn't work. Of course, writing up a quick test shows that this doesn't even work when you @throw an NSException.


AFAIK, there is no way to break on an @throw. Hopefully I'm wrong. I'm not sure if @throw still uses setjmp and longjmp like NSException. If so, I've seen no good arguments as to why @throw is better than -raise et al for NSExceptions, so I suggest just not using @throw in this case. Obviously if you're @throwing a generic object, this isn't an option.

_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Breakpoint on @throw? (From: Aaron Hillegass <email@hidden>)
 >Re: Breakpoint on @throw? (From: Steven Kramer <email@hidden>)
 >Re: Breakpoint on @throw? (From: Prachi Gauriar <email@hidden>)

  • Prev by Date: Re: [NSString initWithData: encoding:]
  • Next by Date: Japanese characters appearing in my apps name?
  • Previous by thread: Re: Breakpoint on @throw?
  • Next by thread: Re: Breakpoint on @throw?
  • Index(es):
    • Date
    • Thread