retained
- Fix: #160 The code pane could be unpopulated after the debugging the same
script a subsequent time
+- Fix: After using the run command, the stack will now be properly updated
1.2.1
*/
- (IBAction)run:(id)sender
{
- StackFrame *frame = [connection run];
- [stackController pop];
+ NSArray *frames = [connection run];
- if ([connection isConnected] && frame != nil)
+ if ([connection isConnected] && frames != nil)
{
- [stackController push:frame];
+ [stackController.stack removeAllObjects];
+ [stackController.stack addObjectsFromArray:frames];
[self updateStackViewer];
+ [self updateSourceViewer];
}
}
}
/**
- * Tells the debugger to continue running the script
+ * Tells the debugger to continue running the script. Returns an NSArray of the new stack
*/
-- (StackFrame *)run
+- (NSArray *)run
{
[socket send:[self createCommand:@"run"]];
[socket receive];
if (!connected)
return nil;
- return [self createCurrentStackFrame];
+ // get the total stack depth
+ [socket send:[self createCommand:@"stack_depth"]];
+ NSXMLDocument *doc = [self processData:[socket receive]];
+ int depth = [[[[doc rootElement] attributeForName:@"depth"] stringValue] intValue];
+
+ // get all stack frames
+ NSMutableArray *stack = [NSMutableArray arrayWithCapacity:depth];
+ for (int i = 0; i < depth; i++)
+ {
+ StackFrame *frame = [self createStackFrame:i];
+ [stack insertObject:frame atIndex:i];
+ }
+
+ return stack;
}
/**
// create stack frame
StackFrame *frame = [[StackFrame alloc]
- initWithIndex:0
+ initWithIndex:stackDepth
withFilename:filename
withSource:source
atLine:[[[xmlframe attributeForName:@"lineno"] stringValue] intValue]