diff --git a/Modules/Debuggers/ProjectCenter/GDBWrapper.h b/Modules/Debuggers/ProjectCenter/GDBWrapper.h index 447ffc4..8733664 100644 --- a/Modules/Debuggers/ProjectCenter/GDBWrapper.h +++ b/Modules/Debuggers/ProjectCenter/GDBWrapper.h @@ -44,6 +44,7 @@ typedef enum PCDebuggerOutputType_enum { @interface GDBWrapper : NSObject { + NSString *debuggerPath; PCDebugger *debugger; NSTextView *tView; NSTask *task; diff --git a/Modules/Debuggers/ProjectCenter/GDBWrapper.m b/Modules/Debuggers/ProjectCenter/GDBWrapper.m index b63d72e..7dbb9bf 100644 --- a/Modules/Debuggers/ProjectCenter/GDBWrapper.m +++ b/Modules/Debuggers/ProjectCenter/GDBWrapper.m @@ -91,6 +91,21 @@ } } +- (NSString *)debuggerPath +{ + return debuggerPath; +} + +- (void)setDebuggerPath:(NSString *)path +{ + if (debuggerPath != path) + { + [debuggerPath release]; + debuggerPath = path; + [debuggerPath retain]; + } +} + - (BOOL)debuggerStarted { return debuggerStarted; @@ -677,16 +692,19 @@ */ - (void) runProgram: (NSString *)path inCurrentDirectory: (NSString *)directory - withArguments: (NSArray *)array logStandardError: (BOOL)logError { NSPipe *inPipe; NSPipe *outPipe; + NSArray *argArray; + + argArray = [[NSArray alloc] initWithObjects: @"--interpreter=mi", @"-f", path, nil]; task = [[NSTask alloc] init]; - [task setArguments: array]; + [task setArguments: argArray]; + [argArray release]; [task setCurrentDirectoryPath: directory]; - [task setLaunchPath: path]; + [task setLaunchPath: debuggerPath]; inPipe = [NSPipe pipe]; outPipe = [NSPipe pipe]; @@ -767,6 +785,7 @@ [debuggerColor release]; [messageColor release]; [errorColor release]; + [debuggerPath release]; [debugger release]; [tView release]; [super dealloc]; diff --git a/Modules/Debuggers/ProjectCenter/PCDebugger.h b/Modules/Debuggers/ProjectCenter/PCDebugger.h index da8a07a..f37e309 100644 --- a/Modules/Debuggers/ProjectCenter/PCDebugger.h +++ b/Modules/Debuggers/ProjectCenter/PCDebugger.h @@ -44,7 +44,6 @@ extern NSString *PCDBDebuggerStartedNotification; id debuggerWindow; id statusField; NSString *executablePath; - NSString *debuggerPath; int subProcessId; NSDictionary *lastInfoParsed; NSString *lastFileNameParsed; diff --git a/Modules/Debuggers/ProjectCenter/PCDebugger.m b/Modules/Debuggers/ProjectCenter/PCDebugger.m index c63a590..fb23ff0 100644 --- a/Modules/Debuggers/ProjectCenter/PCDebugger.m +++ b/Modules/Debuggers/ProjectCenter/PCDebugger.m @@ -171,7 +171,7 @@ NSString *PCDBDebuggerStartedNotification = @"PCDBDebuggerStartedNotification"; withDebugger: (NSString *)debugger { ASSIGN(executablePath,filePath); - ASSIGN(debuggerPath,debugger); + [debuggerWrapper setDebuggerPath: debugger]; [debuggerWindow setTitle: [NSString stringWithFormat: @"Debugger (%@)",filePath]]; [self show]; } @@ -185,9 +185,8 @@ NSString *PCDBDebuggerStartedNotification = @"PCDBDebuggerStartedNotification"; - (void) startDebugger { - [debuggerView runProgram: debuggerPath + [debuggerView runProgram: executablePath inCurrentDirectory: [executablePath stringByDeletingLastPathComponent] - withArguments: [[NSArray alloc] initWithObjects: @"--interpreter=mi", @"-f", executablePath, nil] // FIXME gdb dependent - should be generalized in the wrapepr logStandardError: YES]; } diff --git a/Modules/Debuggers/ProjectCenter/PCDebuggerView.h b/Modules/Debuggers/ProjectCenter/PCDebuggerView.h index 0802d23..86f2850 100644 --- a/Modules/Debuggers/ProjectCenter/PCDebuggerView.h +++ b/Modules/Debuggers/ProjectCenter/PCDebuggerView.h @@ -39,7 +39,6 @@ - (void) runProgram: (NSString *)path inCurrentDirectory: (NSString *)directory - withArguments: (NSArray *)array logStandardError: (BOOL)logError; - (void) putString: (NSString *)string; diff --git a/Modules/Debuggers/ProjectCenter/PCDebuggerView.m b/Modules/Debuggers/ProjectCenter/PCDebuggerView.m index e9ca717..e8216cc 100644 --- a/Modules/Debuggers/ProjectCenter/PCDebuggerView.m +++ b/Modules/Debuggers/ProjectCenter/PCDebuggerView.m @@ -72,12 +72,10 @@ */ - (void) runProgram: (NSString *)path inCurrentDirectory: (NSString *)directory - withArguments: (NSArray *)array logStandardError: (BOOL)logError { [[debugger debuggerWrapper] runProgram: path inCurrentDirectory: directory - withArguments: array logStandardError: logError]; } diff --git a/Modules/Debuggers/ProjectCenter/PCDebuggerWrapperProtocol.h b/Modules/Debuggers/ProjectCenter/PCDebuggerWrapperProtocol.h index 986327f..adc971c 100644 --- a/Modules/Debuggers/ProjectCenter/PCDebuggerWrapperProtocol.h +++ b/Modules/Debuggers/ProjectCenter/PCDebuggerWrapperProtocol.h @@ -42,11 +42,13 @@ - (PCDebugger *)debugger; - (void)setDebugger:(PCDebugger *)dbg; +- (NSString *)debuggerPath; +- (void)setDebuggerPath:(NSString *)path; + - (BOOL)debuggerStarted; - (void) runProgram: (NSString *)path inCurrentDirectory: (NSString *)directory - withArguments: (NSArray *)array logStandardError: (BOOL)logError; - (void)logString:(NSString *)str