diff --git a/ChangeLog b/ChangeLog index 045e9cc..28139c8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2008-12-28 11:25-EST Gregory John Casamento + + * Modules/Debuggers/ProjectCenter/PCDebugger.m: Added code + to do the restart and pause actions in the debugger. + * Modules/Debuggers/ProjectCenter/PCDebuggerView.[hm]: Added + method subProcessId and an ivar and the logic to parse the + process id from debugger output. + 2008-12-28 02:23-EST Gregory John Casamento * Framework/PCEditorManager.m: Remove log. diff --git a/Modules/Debuggers/ProjectCenter/PCDebugger.m b/Modules/Debuggers/ProjectCenter/PCDebugger.m index 45c5c62..b0aed4b 100644 --- a/Modules/Debuggers/ProjectCenter/PCDebugger.m +++ b/Modules/Debuggers/ProjectCenter/PCDebugger.m @@ -168,12 +168,16 @@ static NSImage *stepOutImage = nil; - (void) pause: (id) sender { + [self setStatus: @"Stopped."]; + [debuggerView interrupt]; } - (void) restart: (id) sender { - [self setStatus: @"Running..."]; + [self setStatus: @"Restarting..."]; + [debuggerView interrupt]; [debuggerView putString: @"run\n"]; + [self setStatus: @"Running..."]; } - (void) next: (id) sender diff --git a/Modules/Debuggers/ProjectCenter/PCDebuggerView.h b/Modules/Debuggers/ProjectCenter/PCDebuggerView.h index 50dc263..93cb6cb 100644 --- a/Modules/Debuggers/ProjectCenter/PCDebuggerView.h +++ b/Modules/Debuggers/ProjectCenter/PCDebuggerView.h @@ -25,20 +25,15 @@ @class PCDebugger; @class NSString; -typedef enum _PCDebuggerState { - PCDebuggerPrePrompt, - PCDebuggerPrompt, - PCDebuggerPostPrompt -} PCDebuggerState; - @interface PCDebuggerView : PTYView { PCDebugger *debugger; NSString *currentFile; - PCDebuggerState debuggerState; + int subProcessId; } - (void) setDebugger:(PCDebugger *)theDebugger; - (void) setCurrentFile: (NSString *)fileName; - (NSString *) currentFile; +- (int) subProcessId; @end diff --git a/Modules/Debuggers/ProjectCenter/PCDebuggerView.m b/Modules/Debuggers/ProjectCenter/PCDebuggerView.m index 6841a36..f5ca187 100644 --- a/Modules/Debuggers/ProjectCenter/PCDebuggerView.m +++ b/Modules/Debuggers/ProjectCenter/PCDebuggerView.m @@ -92,6 +92,20 @@ } } + // NOTE: This works on certain versions of gdb, but we need to come up with another way of getting + // the process id in a more generic way. + range = [str rangeOfString: @"[New Thread"]; + if (range.location != NSNotFound) + { + NSScanner *scanner = [NSScanner scannerWithString: str]; + NSString *process = nil; + + [scanner scanUpToString: @"(LWP" intoString: NULL]; + [scanner scanString: @"(LWP" intoString: NULL]; + [scanner scanUpToString: @")" intoString: &process]; + subProcessId = [process intValue]; + } + // FIXME: Filter this error, until we find a better way to deal with it. range = [str rangeOfString: @"[tcsetpgrp failed in terminal_inferior:"]; if (range.location != NSNotFound) @@ -120,7 +134,7 @@ * lookup the process id. */ /* -- (int) lookupProcessId +- (int) subProcessId { int task_pid = [task processIdentifier]; int child_pid = 0; @@ -146,13 +160,18 @@ return child_pid; } +*/ + +- (int) subProcessId +{ + return subProcessId; +} - (void) interrupt { - int pid = [self lookupProcessId]; + int pid = [self subProcessId]; kill(pid,SIGINT); } -*/ - (void) terminate {