tools for finding a bug?
tools for finding a bug?
- Subject: tools for finding a bug?
- From: Koen van der Drift <email@hidden>
- Date: Sat, 22 Feb 2003 09:22:23 -0500
Hi,
The last few days I have been tring to find a bug in my code that causes a
SIGSEGV (signal 11). Using the console output and setting breakpoints, I
figured out what line is causing the error:
unsigned i;
unichar buf;
NSString *key;
for ( i = 0; i < [name length]; i++ )
{
buf = [name characterAtIndex:i];
key = [NSString stringWithCharacters:&buf length:1];
if ( [[myDict allKeys] containsObject:key] ) <----- BOOOM
{
// do something
}
}
The variables name and myDict are initialized in init.
The crash only happens if the user changes the variable 'name' by typing in
an NSTextView, I change 'name' in the code as follows:
-(void)setName:(NSString *)s
{
[s retain];
[name release];
name = s;
}
If I add an NSLog([massDict description]), I see all the right values, so
the NSDictionary doesn't seem corrupted.
Sometimes the output in PB is:
MyApp[712] *** -[NSCFString initialize]: selector not recognized
MyApp[712] Exception raised during posting of notification. Ignored.
exception: *** -[NSCFString initialize]: selector not recognized
MyApp has exited due to signal 11 (SIGSEGV)
This is helpful info I guess, unfortunately it doesn't tell which
notification caused the error. How do I proceed tracking down this bug? Are
there any other tools, or debug commands that might be helpful?
thanks,
- Koen.
_______________________________________________
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.