[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[NSBundle mainBundle] + gdb

From: Marcus Müller
Subject: [NSBundle mainBundle] + gdb
Date: Sun, 1 Jun 2003 17:10:24 +0200


I just discovered a problem with [NSBundle mainBundle]. Although it should work with Tool projects (by looking at the source), it doesn't - it always returns nil. I wanted to debug the issue with a new gdb (GNU gdb 2003-05-31-cvs) on my FreeBSD box (FreeBSD 4.8-RELEASE). But always, when I want to go further with 'n' the following happens:

(gdb) b main
Breakpoint 1 at 0x804b2f3: file main.m, line 6.
(gdb) r
Starting program: /usr/home/znek/Projects/unchecked/znek/GNUstep/BundleTest/ shared_debug_obj/ix86/freebsd/gnu-gnu-gnu/BundleTest

Breakpoint 1, main (argc=1, argv=0xbfbff204) at main.m:6
6           NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
(gdb) n
0x0804ae40 in _init ()
(gdb) n
Single stepping until exit from function _init,
which has no line number information.
2003-06-01 17:04:20.392 BundleTest[57242] [NSBundle mainBundle]: (nil)
2003-06-01 17:04:20.395 BundleTest[57242] [NSBundle bundleForClass:NSClassFromString(@"Test")]: (nil) 2003-06-01 17:04:20.395 BundleTest[57242] [NSBundle bundleForClass:[Test class]]: (nil)

Program exited normally.

I'm not sure whether this behaviour is unique to my release of FreeBSD as I'm not able to test against another OS currently. Please note that single stepping (via 's') does work, though. However, that's a pain in the ass.

The testcase is rather small:

Attachment: BundleTest.tar.gz
Description: GNU Zip compressed data

I've also patched NSBundle's -(NSString *)description method to be more informative (pretty similar to Apple's):

- (NSString *)description
return [NSString stringWithFormat: @"<%s 0x%lx: %@ (%@)>", object_get_class_name(self), (unsigned long)self, [self bundlePath], [self isLoaded] ? @"loaded" : @"not loaded, yet"];



Marcus Mueller  .  .  .  crack-admin/coder ;-)
Mulle kybernetiK  .
Current projects: finger address@hidden

reply via email to

[Prev in Thread] Current Thread [Next in Thread]