* Framework/PCEditorManager.m: Remove log.

* Modules/Debuggers/ProjectCenter/GNUmakefile: Added new images
	to resource list.
	* Modules/Debuggers/ProjectCenter/PCDebugger.[hm]: Added setStatus:
	method to manage status field.
	* Modules/Debuggers/ProjectCenter/PCDebuggerView.m: Added code
	to handle the toolbar.
	* Modules/Debuggers/ProjectCenter/PTYView.[hm]: Added method called
	"terminate" so that subclasses can override how the process is
	terminated.
	* Modules/Debuggers/ProjectCenter/Resources/PCDebugger.gorm: Added
	status line.
	* Modules/Debuggers/ProjectCenter/Resources/go_button.png
	* Modules/Debuggers/ProjectCenter/Resources/next_button.png
	* Modules/Debuggers/ProjectCenter/Resources/pause_button.png
	* Modules/Debuggers/ProjectCenter/Resources/restart_button.png
	* Modules/Debuggers/ProjectCenter/Resources/stepin_button.png
	* Modules/Debuggers/ProjectCenter/Resources/stepout_button.png:
	Images for debugger toolbar.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/projectcenter/trunk@27440 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2008-12-28 07:19:45 +00:00
parent 96c021a74f
commit eefe748587
17 changed files with 297 additions and 23 deletions

View file

@ -1,3 +1,25 @@
2008-12-28 02:23-EST Gregory John Casamento <greg_casamento@yahoo.com>
* Framework/PCEditorManager.m: Remove log.
* Modules/Debuggers/ProjectCenter/GNUmakefile: Added new images
to resource list.
* Modules/Debuggers/ProjectCenter/PCDebugger.[hm]: Added setStatus:
method to manage status field.
* Modules/Debuggers/ProjectCenter/PCDebuggerView.m: Added code
to handle the toolbar.
* Modules/Debuggers/ProjectCenter/PTYView.[hm]: Added method called
"terminate" so that subclasses can override how the process is
terminated.
* Modules/Debuggers/ProjectCenter/Resources/PCDebugger.gorm: Added
status line.
* Modules/Debuggers/ProjectCenter/Resources/go_button.png
* Modules/Debuggers/ProjectCenter/Resources/next_button.png
* Modules/Debuggers/ProjectCenter/Resources/pause_button.png
* Modules/Debuggers/ProjectCenter/Resources/restart_button.png
* Modules/Debuggers/ProjectCenter/Resources/stepin_button.png
* Modules/Debuggers/ProjectCenter/Resources/stepout_button.png:
Images for debugger toolbar.
2008-12-27 00:47-EST Gregory John Casamento <greg_casamento@yahoo.com>
* Framework/PCEditorManager.m: Changed code to use the filePath

View file

@ -398,7 +398,7 @@ NSString *PCEditorDidResignActiveNotification =
editable: YES
windowed: NO];
[editor scrollToLineNumber: [line intValue]];
NSLog(@"object = %@", [aNotif object]);
// NSLog(@"object = %@", [aNotif object]);
}
@end

View file

@ -21,7 +21,14 @@ ProjectCenter_LIBRARIES_DEPEND_UPON +=
#
ProjectCenter_RESOURCE_FILES= \
Resources/PCDebugger.gorm \
Resources/Info.table
Resources/Info.table \
Resources/go_button.png \
Resources/pause_button.png \
Resources/restart_button.png \
Resources/next_button.png \
Resources/stepin_button.png \
Resources/stepout_button.png
#
# Header files
#

View file

@ -31,10 +31,11 @@
{
id debuggerView;
id debuggerWindow;
id statusField;
NSString *path;
NSString *debuggerPath;
// BOOL _isLogging;
// BOOL _isErrorLogging;
// FILE *std_input;
}
- (void) setStatus: (NSString *) status;
- (NSString *) status;
@end

View file

@ -28,7 +28,55 @@
#define NOTIFICATION_CENTER [NSNotificationCenter defaultCenter]
#endif
static NSImage *goImage = nil;
static NSImage *pauseImage = nil;
static NSImage *restartImage = nil;
static NSImage *nextImage = nil;
static NSImage *stepInImage = nil;
static NSImage *stepOutImage = nil;
@implementation PCDebugger
+ (void) initialize
{
if (self == [PCDebugger class])
{
NSBundle *bundle;
NSString *path;
bundle = [NSBundle bundleForClass: self];
path = [bundle pathForImageResource: @"go_button"];
if (path != nil)
{
goImage = [[NSImage alloc] initWithContentsOfFile: path];
}
path = [bundle pathForImageResource: @"pause_button"];
if (path != nil)
{
pauseImage = [[NSImage alloc] initWithContentsOfFile: path];
}
path = [bundle pathForImageResource: @"restart_button"];
if (path != nil)
{
restartImage = [[NSImage alloc] initWithContentsOfFile: path];
}
path = [bundle pathForImageResource: @"next_button"];
if (path != nil)
{
nextImage = [[NSImage alloc] initWithContentsOfFile: path];
}
path = [bundle pathForImageResource: @"stepin_button"];
if (path != nil)
{
stepInImage = [[NSImage alloc] initWithContentsOfFile: path];
}
path = [bundle pathForImageResource: @"stepout_button"];
if (path != nil)
{
stepOutImage = [[NSImage alloc] initWithContentsOfFile: path];
}
}
}
- (id) init
{
if((self = [super init]) != nil)
@ -69,8 +117,16 @@
- (void) awakeFromNib
{
NSToolbar *toolbar = [(NSToolbar *)[NSToolbar alloc] initWithIdentifier: @"PCDebuggerToolbar"];
[toolbar setAllowsUserCustomization: NO];
[toolbar setDelegate: self];
[debuggerWindow setToolbar: toolbar];
RELEASE(toolbar);
[toolbar setUsesStandardBackgroundColor: YES];
[debuggerView setFont: [NSFont userFixedPitchFontOfSize: 0]];
[debuggerWindow setFrameAutosaveName: @"PCDebuggerWindow"];
[self setStatus: @"Idle."];
}
- (NSWindow *)debuggerWindow
@ -102,4 +158,145 @@
{
ASSIGN(path,p);
}
// action methods for toolbar...
- (void) go: (id) sender
{
[self setStatus: @"Running..."];
[debuggerView putString: @"run\n"];
}
- (void) pause: (id) sender
{
}
- (void) restart: (id) sender
{
[self setStatus: @"Running..."];
[debuggerView putString: @"run\n"];
}
- (void) next: (id) sender
{
[self setStatus: @"Going to next line."];
[debuggerView putString: @"next\n"];
}
- (void) stepInto: (id) sender
{
[self setStatus: @"Stepping into method."];
[debuggerView putString: @"step\n"];
}
- (void) stepOut: (id) sender
{
[self setStatus: @"Finishing method."];
[debuggerView putString: @"finish\n"];
}
// Status..
- (void) setStatus: (NSString *) status
{
[statusField setStringValue: status];
}
- (NSString *) status
{
return [statusField stringValue];
}
@end
@implementation PCDebugger (NSToolbarDelegate)
- (NSToolbarItem*)toolbar: (NSToolbar*)toolbar
itemForItemIdentifier: (NSString*)itemIdentifier
willBeInsertedIntoToolbar: (BOOL)flag
{
NSToolbarItem *toolbarItem = AUTORELEASE([[NSToolbarItem alloc]
initWithItemIdentifier: itemIdentifier]);
if([itemIdentifier isEqual: @"GoItem"])
{
[toolbarItem setLabel: @"Go"];
[toolbarItem setImage: goImage];
[toolbarItem setTarget: self];
[toolbarItem setAction: @selector(go:)];
[toolbarItem setTag: 0];
}
else if([itemIdentifier isEqual: @"PauseItem"])
{
[toolbarItem setLabel: @"Pause"];
[toolbarItem setImage: pauseImage];
[toolbarItem setTarget: self];
[toolbarItem setAction: @selector(pause:)];
[toolbarItem setTag: 1];
}
else if([itemIdentifier isEqual: @"RestartItem"])
{
[toolbarItem setLabel: @"Restart"];
[toolbarItem setImage: restartImage];
[toolbarItem setTarget: self];
[toolbarItem setAction: @selector(restart:)];
[toolbarItem setTag: 1];
}
else if([itemIdentifier isEqual: @"NextItem"])
{
[toolbarItem setLabel: @"Next"];
[toolbarItem setImage: nextImage];
[toolbarItem setTarget: self];
[toolbarItem setAction: @selector(next:)];
[toolbarItem setTag: 2];
}
else if([itemIdentifier isEqual: @"StepIntoItem"])
{
[toolbarItem setLabel: @"Step Into"];
[toolbarItem setImage: stepInImage];
[toolbarItem setTarget: self];
[toolbarItem setAction: @selector(stepInto:)];
[toolbarItem setTag: 3];
}
else if([itemIdentifier isEqual: @"StepOutItem"])
{
[toolbarItem setLabel: @"Step Out"];
[toolbarItem setImage: stepOutImage];
[toolbarItem setTarget: self];
[toolbarItem setAction: @selector(stepOut:)];
[toolbarItem setTag: 4];
}
return toolbarItem;
}
- (NSArray*) toolbarAllowedItemIdentifiers: (NSToolbar*)toolbar
{
return [NSArray arrayWithObjects: @"GoItem",
@"PauseItem",
@"RestartItem",
@"NextItem",
@"StepIntoItem",
@"StepOutItem",
nil];
}
- (NSArray*) toolbarDefaultItemIdentifiers: (NSToolbar*)toolbar
{
return [NSArray arrayWithObjects: @"GoItem",
@"PauseItem",
@"RestartItem",
@"NextItem",
@"StepIntoItem",
@"StepOutItem",
nil];
}
- (NSArray*) toolbarSelectableItemIdentifiers: (NSToolbar*)toolbar
{
return [NSArray arrayWithObjects: @"GoItem",
@"PauseItem",
@"RestartItem",
@"NextItem",
@"StepIntoItem",
@"StepOutItem",
nil];
}
@end

View file

@ -21,27 +21,19 @@
*/
#include "PCDebuggerView.h"
#include "PCDebugger.h"
#include <ProjectCenter/PCProject.h>
#include <Foundation/NSScanner.h>
#include <unistd.h>
#include <signal.h>
#ifndef NOTIFICATION_CENTER
#define NOTIFICATION_CENTER [NSNotificationCenter defaultCenter]
#endif
@implementation PCDebuggerView
/*
- (void) runProgram: (NSString *)path
inCurrentDirectory: (NSString *)directory
withArguments: (NSArray *)array
logStandardError: (BOOL)logError
{
[super runProgram: path
inCurrentDirectory: directory
withArguments: array
logStandardError: logError];
[self putString: @"set annotate 3\n"];
}
*/
-(void)setDebugger:(PCDebugger *)theDebugger
{
@ -87,7 +79,9 @@
NSDictionary *dict = [NSDictionary
dictionaryWithObjectsAndKeys:
file, @"file", line, @"line", nil];
NSLog(@"dict = %@", dict);
NSString *statusString = [NSString stringWithFormat: @"Stopped, %@:%@",file,line];
[debugger setStatus: statusString];
[NOTIFICATION_CENTER
postNotificationName: PCProjectBreakpointNotification
object: dict];
@ -121,4 +115,48 @@
{
return currentFile;
}
/**
* lookup the process id.
*/
/*
- (int) lookupProcessId
{
int task_pid = [task processIdentifier];
int child_pid = 0;
NSArray *entries = [[NSFileManager defaultManager] directoryContentsAtPath: @"/proc"];
NSEnumerator *en = [entries objectEnumerator];
NSString *entry = nil;
// FIXME: I'm looking for a generic way to do this, what we have here is very /proc specific.
// which I don't like since it ties this functionality to systems which have /proc.
while((entry = [en nextObject]) != nil)
{
int pid = [entry intValue];
if (pid != 0)
{
int ppid = getppid(pid);
if (ppid == task_pid)
{
child_pid = pid;
break;
}
}
}
return child_pid;
}
- (void) interrupt
{
int pid = [self lookupProcessId];
kill(pid,SIGINT);
}
*/
- (void) terminate
{
[super terminate];
[debugger setStatus: @"Process ended."];
}
@end

View file

@ -58,6 +58,8 @@
- (void) terminate;
- (void) interrupt;
- (void) putString: (NSString *)string;
- (void) putChar:(unichar)ch;

View file

@ -25,6 +25,7 @@
#include <fcntl.h>
#include <sys/stat.h>
#include <unistd.h>
#include <signal.h>
#ifndef NOTIFICATION_CENTER
#define NOTIFICATION_CENTER [NSNotificationCenter defaultCenter]
@ -115,8 +116,8 @@
//
// Is it backspace? If so, remove one character from the terminal to reflect
// the deletion. For some reason backspace sends "\b \b", so I have to remove
// four characters in order to appropriately delete from the buffer.
// the deletion. For some reason backspace sends multiple characters, so I have to remove
// one more character than what is sent in order to appropriately delete from the buffer.
//
range = [str rangeOfString: @"\b"];
if (range.location != NSNotFound)
@ -332,6 +333,11 @@
[master_handle writeData: data];
}
- (void) interrupt
{
[task interrupt];
}
/**
* Respond to key events and pipe them down to the debugger
*/
@ -347,7 +353,7 @@
if (c == 3) // ETX, Control-C
{
[task interrupt]; // send the interrupt signal to the subtask
[self interrupt]; // send the interrupt signal to the subtask
}
else
{

View file

@ -5,7 +5,8 @@
);
Outlets = (
debuggerView,
debuggerWindow
debuggerWindow,
statusField
);
Super = NSObject;
};

Binary file not shown.

After

Width:  |  Height:  |  Size: 757 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 545 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 495 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 535 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 537 B