*/
- (IBAction)run:(id)sender
{
- [connection run];
+ StackFrame *frame = [connection run];
+ [stackController pop];
+
+ if ([connection isConnected] && frame != nil)
+ {
+ [stackController push:frame];
+ [self updateStackViewer];
+ }
}
/**
/**
* Tells the debugger to continue running the script
*/
-- (void)run
+- (StackFrame *)run
{
[socket send:[self createCommand:@"run"]];
[socket receive];
+
[self updateStatus];
+
+ if (!connected)
+ return nil;
+
+ return [self createStackFrame];
}
/**
*/
- (NSXMLDocument *)processData:(NSString *)data
{
+ if (data == nil)
+ return nil;
+
NSError *parseError = nil;
NSXMLDocument *doc = [[NSXMLDocument alloc] initWithXMLString:data options:0 error:&parseError];
if (parseError)
// get the stack frame
[socket send:[self createCommand:@"stack_get -d 0"]];
NSXMLDocument *doc = [self processData:[socket receive]];
+ if (doc == nil)
+ return nil;
+
NSXMLElement *xmlframe = [[[doc rootElement] children] objectAtIndex:0];
// get the names of all the contexts
NSXMLDocument *doc = [self processData:[socket receive]];
self.status = [[[[doc rootElement] attributeForName:@"status"] stringValue] capitalizedString];
- if ([status isEqualToString:@"Stopped"] || [status isEqualToString:@"Stopping"])
+ if (status == nil || [status isEqualToString:@"Stopped"] || [status isEqualToString:@"Stopping"])
{
connected = NO;
[socket close];
// take the received data and put it into an NSData
NSMutableString *str = [NSMutableString string];
+ if (recvd == -1)
+ return nil;
+
// strip the length from the packet, and clear the null byte then add it to the NSData
char packetLength[8];
memset(packetLength, '\0', sizeof(packetLength));