From cc3b46f232d6af84b346cf14e460c4b83a973380 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sun, 12 Apr 2020 12:54:41 -0400 Subject: [PATCH] Do not attempt to preserve stack frames. Doing so means the variable contents in previously-loaded stack frames does not update. --- Source/DebuggerModel.m | 28 ++-------------------------- 1 file changed, 2 insertions(+), 26 deletions(-) diff --git a/Source/DebuggerModel.m b/Source/DebuggerModel.m index f409e83..3d0bbdf 100644 --- a/Source/DebuggerModel.m +++ b/Source/DebuggerModel.m @@ -57,34 +57,10 @@ } - (void)updateStack:(NSArray*)newStack { - // Iterate, in reverse order from the bottom to the top, both stacks to find - // the point of divergence. - NSEnumerator* itNewStack = [newStack reverseObjectEnumerator]; - NSEnumerator* itOldStack = [self.stack reverseObjectEnumerator]; - - StackFrame* frameNew; - StackFrame* frameOld = [itOldStack nextObject]; - NSUInteger oldStackOffset = self.stack.count; - while (frameNew = [itNewStack nextObject]) { - if ([frameNew isEqual:frameOld]) { - --oldStackOffset; - frameOld = [itOldStack nextObject]; - } else { - break; - } - } - [self willChangeValueForKey:@"stack"]; - // Remove any frames from the top of the stack that are not shared with the - // new stack. - [_stack removeObjectsInRange:NSMakeRange(0, oldStackOffset)]; - - // Continue inserting objects to update the stack with the new frames. - while (frameNew) { - [_stack insertObject:frameNew atIndex:0]; - frameNew = [itNewStack nextObject]; - } + [_stack removeAllObjects]; + [_stack addObjectsFromArray:newStack]; // Renumber the stack. for (NSUInteger i = 0; i < self.stack.count; ++i) -- 2.43.5