Debugging: do CFZombieLevel and objc_exception_throw() work for you?
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