From ae546e2b16471732bc1c0633fbe914a6f0a61ae8 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sat, 4 Apr 2009 15:28:59 -0400 Subject: [PATCH] Change -[createStackFrame] to take a depth and create private -[createCurrentStackFrame] to call it with depth 0 * Source/GDBpConnection.m: (createStackFrame:): Take a new depth argument (createCurrentStackFrame): New method to call above with 0 --- Source/GDBpConnection.m | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/Source/GDBpConnection.m b/Source/GDBpConnection.m index 3ef84a5..4729504 100644 --- a/Source/GDBpConnection.m +++ b/Source/GDBpConnection.m @@ -24,7 +24,8 @@ NSString *kErrorOccurredNotif = @"GDBpConnection_ErrorOccured_Notification"; - (NSString *)createCommand:(NSString *)cmd, ...; - (NSXMLDocument *)processData:(NSString *)data; -- (StackFrame *)createStackFrame; +- (StackFrame *)createStackFrame:(int)depth; +- (StackFrame *)createCurrentStackFrame; - (void)updateStatus; @end @@ -161,7 +162,7 @@ NSString *kErrorOccurredNotif = @"GDBpConnection_ErrorOccured_Notification"; if (!connected) return nil; - return [self createStackFrame]; + return [self createCurrentStackFrame]; } /** @@ -177,7 +178,7 @@ NSString *kErrorOccurredNotif = @"GDBpConnection_ErrorOccured_Notification"; if (!connected) return nil; - return [self createStackFrame]; + return [self createCurrentStackFrame]; } /** @@ -193,7 +194,7 @@ NSString *kErrorOccurredNotif = @"GDBpConnection_ErrorOccured_Notification"; if (!connected) return nil; - return [self createStackFrame]; + return [self createCurrentStackFrame]; } /** @@ -209,7 +210,7 @@ NSString *kErrorOccurredNotif = @"GDBpConnection_ErrorOccured_Notification"; if (!connected) return nil; - return [self createStackFrame]; + return [self createCurrentStackFrame]; } /** @@ -317,12 +318,12 @@ NSString *kErrorOccurredNotif = @"GDBpConnection_ErrorOccured_Notification"; } /** - * Creates a StackFrame based on the current position in the debugger + * Generates a stack frame for the given depth */ -- (StackFrame *)createStackFrame +- (StackFrame *)createStackFrame:(int)stackDepth { // get the stack frame - [socket send:[self createCommand:@"stack_get -d 0"]]; + [socket send:[self createCommand:@"stack_get -d %d", stackDepth]]; NSXMLDocument *doc = [self processData:[socket receive]]; if (doc == nil) return nil; @@ -339,7 +340,7 @@ NSString *kErrorOccurredNotif = @"GDBpConnection_ErrorOccured_Notification"; int cid = [[[context attributeForName:@"id"] stringValue] intValue]; // fetch the contexts - [socket send:[self createCommand:[NSString stringWithFormat:@"context_get -d 0 -c %d", cid]]]; + [socket send:[self createCommand:[NSString stringWithFormat:@"context_get -d %d -c %d", stackDepth, cid]]]; NSArray *addVars = [[[self processData:[socket receive]] rootElement] children]; if (addVars != nil && name != nil) [variables addObjectsFromArray:addVars]; @@ -363,6 +364,14 @@ NSString *kErrorOccurredNotif = @"GDBpConnection_ErrorOccured_Notification"; return [frame autorelease]; } +/** + * Creates a StackFrame based on the current position in the debugger + */ +- (StackFrame *)createCurrentStackFrame +{ + return [self createStackFrame:0]; +} + /** * Fetches the value of and sets the status instance variable */ -- 2.22.5