Change -[createStackFrame] to take a depth and create private -[createCurrentStackFra...
authorRobert Sesek <rsesek@bluestatic.org>
Sat, 4 Apr 2009 19:28:59 +0000 (15:28 -0400)
committerRobert Sesek <rsesek@bluestatic.org>
Sun, 10 May 2009 05:48:10 +0000 (01:48 -0400)
* Source/GDBpConnection.m:
(createStackFrame:): Take a new depth argument
(createCurrentStackFrame): New method to call above with 0

Source/GDBpConnection.m

index 3ef84a5950908031f39b4385843288852d3f5904..47295047a02c29582ced8d06be5c8dc12cc5a00c 100644 (file)
@@ -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
  */