• 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
Debugging: do CFZombieLevel and objc_exception_throw() work for you?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Debugging: do CFZombieLevel and objc_exception_throw() work for you?


  • Subject: Debugging: do CFZombieLevel and objc_exception_throw() work for you?
  • From: Scott Ellsworth <email@hidden>
  • Date: Tue, 11 Jul 2006 12:55:20 -0700

Hi, all.

I am putting together a Cocoaheads presentation, and ran into two interesting things.

First off, when I use NSZombieEnabled, it acts as expected with non bridged objects. I hit a breakpoint at the point where my code uses a zombie:

	NSLog(@"Using zombie object");
	Worker * worker = [[Worker alloc] init];
	[worker release];
	int i = [worker addOne:1];

I tried the same thing with an NSString, and with CFZombieLevel (1, 19, 5, and a few other values based on the tech note), and all I got were bad access exceptions.

	NSString * string = [[NSString alloc] initWithFormat:@"String %d", 12];
	[string release];
	[string length];

Should I have expected this?

Question two:

Setting a breakpoint on -[NSException raise] works great - the following code breaks where I expect:

NSLog(@"Raising exception");
NSException *badness = [NSException exceptionWithName:@"RaisedException"
reason:@"Raised an exception"
userInfo:nil];
[badness raise];


Setting a breakpoint on objc_exception_throw() does not work with the following code. I end up breaking in [NSException raise] called from mouseDown, not in my action method.

NSLog(@"Throwing exception");
NSException *badness = [NSException exceptionWithName:@"ThrownException"
reason:@"Threw an exception"
userInfo:nil];

@throw badness;


Latest xcode, version 2.3, MacBook Pro, 10.4.7.

Scott


--- email@hidden "When a great many people are unable to find work, unemployment results" - Calvin Coolidge, (Stanley Walker, City Editor, p. 131 (1934))

_______________________________________________
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


  • Follow-Ups:
    • Re: Debugging: do CFZombieLevel and objc_exception_throw() work for you?
      • From: Chris Suter <email@hidden>
    • Re: Debugging: do CFZombieLevel and objc_exception_throw() work for you?
      • From: Nick Zitzmann <email@hidden>
  • Prev by Date: Re: Out-of-order Undos and NSTextField [SOLVED, well sort of]
  • Next by Date: Re: Debugging: do CFZombieLevel and objc_exception_throw() work for you?
  • Previous by thread: Re: Best way to discover resource forks?
  • Next by thread: Re: Debugging: do CFZombieLevel and objc_exception_throw() work for you?
  • Index(es):
    • Date
    • Thread