Index: NSApplication.m =================================================================== RCS file: /cvsroot/gnustep/gnustep/core/gui/Source/NSApplication.m,v retrieving revision 1.251 diff -u -r1.251 NSApplication.m --- NSApplication.m 21 Sep 2003 02:27:50 -0000 1.251 +++ NSApplication.m 19 Oct 2003 20:52:52 -0000 @@ -111,11 +111,7 @@ @"%@: %@", _(@"Abort"), _(@"Ignore"), -#ifdef DEBUG _(@"Debug"), -#else - nil, -#endif [exception name], [exception reason]); @@ -129,12 +125,54 @@ else if (retVal == NSAlertOther) { /* Debug button: abort so we can trace the error in gdb */ - abort(); + GSDebugCurrentProcessInGDB(); } /* The user said to go on - more fun I guess - turn the AppKit exception handler on again */ NSSetUncaughtExceptionHandler (_NSAppKitUncaughtExceptionHandler); +} + address@hidden Terminal +-(BOOL) terminalRunProgram: (NSString *)path + withArguments: (NSArray *)args + inDirectory: (NSString *)directory + properties: (NSDictionary *)properties; address@hidden + +void GSDebugCurrentProcessInGDB(void) +{ + NSString *gdbPath; + NSArray *args; + NSTask *task; + NSDistantObject *terminal; + + int pid; + + pid = [[NSProcessInfo processInfo] processIdentifier]; + + /* Get the Terminal application */ + terminal = (NSDistantObject *)[NSConnection rootProxyForConnectionWithRegisteredName:@"Terminal" host:nil]; + + task = [[NSTask alloc] init]; + [task setLaunchPath:@"gdb"]; + gdbPath = RETAIN([task validatedLaunchPath]); + RELEASE(task); + + args = [NSArray arrayWithObjects: + [NSString stringWithFormat:@"--pid=%i", pid], + [NSString stringWithFormat:@"--exec=%@", + [[NSBundle mainBundle] executablePath]], + nil]; + + /* Launch gdb in the Terminal */ + + [terminal terminalRunProgram: AUTORELEASE(gdbPath) + withArguments: args + inDirectory: nil + properties: nil]; + + NSLog(@"Launched gdb in Terminal.app"); } /* This is the bundle from where we load localization of messages. */