diff --git a/ChangeLog b/ChangeLog index 42b709d03..d887c825c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,7 +4,8 @@ gdomap. * Source/NSDistributedNotification.m: Improved warnings about launching gdnc. - * Source/NSException.m: Log uncaught exceptions using NSLog() + * Source/NSException.m: Log uncaught exceptions with executable name. + * Source/NSProcessInfo.m: New private function for exception msg. * Source/GSString.m: Applied fix by Malexander Malmberg for transmuting strings where the default encoding is not the same as the internal 8-bit encoding. diff --git a/Source/NSException.m b/Source/NSException.m index b7a7e3ea3..7cef54bbf 100644 --- a/Source/NSException.m +++ b/Source/NSException.m @@ -46,12 +46,13 @@ _preventRecursion (NSException *exception) static void _NSFoundationUncaughtExceptionHandler (NSException *exception) { - BOOL a; + BOOL a; + extern const char* GSArgZero(); _NSUncaughtExceptionHandler = _preventRecursion; -#if 0 - fprintf(stderr, "%s: Uncaught exception %s, reason: %s\n", - [[exception name] lossyCString], [[exception reason] lossyCString]); +#if 1 + fprintf(stderr, "%s: Uncaught exception %s, reason: %s\n", GSArgZero(), + [[exception name] lossyCString], [[exception reason] lossyCString]); fflush(stderr); /* NEEDED UNDER MINGW */ #else NSLog("Uncaught exception %@, reason: %@", diff --git a/Source/NSProcessInfo.m b/Source/NSProcessInfo.m index 2b62d1cf8..d819b89dc 100644 --- a/Source/NSProcessInfo.m +++ b/Source/NSProcessInfo.m @@ -145,6 +145,8 @@ static NSProcessInfo *_gnu_sharedProcessInfoObject = nil; // Host name of the CPU executing the process static NSString *_gnu_hostName = nil; +static const char *_gnu_arg_zero = nil; + // Current process name static NSString *_gnu_processName = nil; @@ -167,6 +169,8 @@ _gnu_process_args(int argc, char *argv[], char *env[]) NSAutoreleasePool *arp = [NSAutoreleasePool new]; int i; + _gnu_arg_zero = argv[0]; + /* Getting the process name */ _gnu_processName = [[NSString stringWithCString: argv[0]] lastPathComponent]; IF_NO_GC(RETAIN(_gnu_processName)); @@ -811,3 +815,15 @@ GSEnvironmentFlag(const char *name, BOOL def) return a; } +const char* +GSArgZero() +{ + if (_gnu_arg_zero == 0) + [NSProcessInfo class]; + if (_gnu_arg_zero == 0) + return ""; + else + return _gnu_arg_zero; +} + + diff --git a/Testing/nsbundle.m b/Testing/nsbundle.m index e93facecf..041cb64a9 100644 --- a/Testing/nsbundle.m +++ b/Testing/nsbundle.m @@ -33,6 +33,8 @@ main(int argc, char *argv[], char **env) #endif arp = [NSAutoreleasePool new]; + printf(" GNUstep bundle directory is %s\n", [[[NSBundle gnustepBundle] bundlePath] cString]); + main = [NSBundle mainBundle]; printf("Looking for main bundle...\n"); if (!main) {