Update the API for loading properties to just pass around VariableNode pointers,...
authorRobert Sesek <rsesek@bluestatic.org>
Mon, 22 Nov 2010 12:54:30 +0000 (07:54 -0500)
committerRobert Sesek <rsesek@bluestatic.org>
Mon, 22 Nov 2010 12:54:30 +0000 (07:54 -0500)
Source/DebuggerController.h
Source/DebuggerController.m
Source/DebuggerProcessor.h
Source/DebuggerProcessor.m
Source/VariableNode.h
Source/VariableNode.m

index aaaf7d75cba6a5bd4f69c95ff50ed3640028374f..b1aaab6fcd6d8eb0a867477adfc99620bbaefb43 100644 (file)
@@ -66,6 +66,6 @@
 - (IBAction)stepOver:(id)sender;
 - (IBAction)reconnect:(id)sender;
 
-- (void)fetchProperty:(NSString*)property forNode:(VariableNode*)node;
+- (void)fetchChildProperties:(VariableNode*)node;
 
 @end
index 6ee880e83b63f038fa54faa8cc09a52da8fa38c8..923ce0f76b9a52bcd5e736b774d38a1066103fbb 100644 (file)
   [connection stepOver];
 }
 
-- (void)fetchProperty:(NSString*)property forNode:(VariableNode*)node
+- (void)fetchChildProperties:(VariableNode*)node
 {
-  NSInteger txn = [connection getProperty:property];
+  NSArray* selection = [stackArrayController selectedObjects];
+  assert([selection count] == 1);
+  NSInteger depth = [[selection objectAtIndex:0] index];
+  NSInteger txn = [connection getChildrenOfProperty:node atDepth:depth];
   [pendingProperties_ setObject:node forKey:[NSNumber numberWithInt:txn]];
 }
 
index 1059a338e4ece6633f287b87b646e92291723d20..7f6299b696e0d12655993a0bc54aa1c3f9e356ec 100644 (file)
@@ -21,6 +21,7 @@
 #import "StackFrame.h"
 
 @protocol DebuggerProcessorDelegate;
+@class VariableNode;
 
 // The DebuggerProcessor is the communication layer between the application
 // and the back-end debugger. Clients issue debugger commands via this class,
@@ -80,8 +81,9 @@
 - (void)removeBreakpoint:(Breakpoint*)bp;
 
 // Gets a property by name from the debugger engine. Returns a transaction ID
-// which used in the delegate callback.
-- (NSInteger)getProperty:(NSString*)property;
+// which used in the delegate callback. Properties must be retrieved at a
+// certain stack depth.
+- (NSInteger)getChildrenOfProperty:(VariableNode*)property atDepth:(NSInteger)depth;
 
 // Takes a partially loaded stack frame and fetches the rest of the information.
 - (void)loadStackFrame:(StackFrame*)frame;
index 8af726bc050d567606b85f5e9ffd974f386de3d2..9fc6f7d7cd9db11668a3ae0edaed1f64029c6315 100644 (file)
  * Tells the debugger engine to get a specifc property. This also takes in the NSXMLElement
  * that requested it so that the child can be attached.
  */
-- (NSInteger)getProperty:(NSString*)property
+- (NSInteger)getChildrenOfProperty:(VariableNode*)property atDepth:(NSInteger)depth;
 {
-  NSNumber* tx = [connection_ sendCommandWithFormat:@"property_get -n \"%@\"", property];
+  NSNumber* tx = [connection_ sendCommandWithFormat:@"property_get -d %d -n %@", depth, [property fullName]];
   [self recordCallback:@selector(propertiesReceived:) forTransaction:tx];
   return [tx intValue];
 }
index 0c97dd2d67022bc2bb79297871191d516fbc8418..da5adfb750360bb523ceb364d0176f4d9ec474b2 100644 (file)
@@ -29,6 +29,7 @@
   NSString* value_;
   NSMutableArray* children_;
   NSInteger childCount_;
+  NSString* address_;
 }
 
 @property (readonly, copy) NSString* name;
@@ -38,6 +39,7 @@
 @property (readonly, copy) NSString* value;
 @property (readonly, retain) NSArray* children;
 @property (readonly) NSInteger childCount;
+@property (readonly, copy) NSString* address;
 
 // Creates and initializes a new VariableNode from the XML response from the
 // debugger backend.
index 1fdcb589b1b2838b4f395f0c4702e3fbd4b8e3bb..db3236fb208a256ae0b908c80914195d4a71f7c0 100644 (file)
@@ -29,6 +29,7 @@
 @property (copy) NSString* type;
 @property (copy) NSString* value;
 @property (retain) NSMutableArray* children;
+@property (copy) NSString* address;
 
 @end
 
@@ -43,6 +44,7 @@
 @synthesize value = value_;
 @synthesize children = children_;
 @synthesize childCount = childCount_;
+@synthesize address = address_;
 
 - (id)initWithXMLNode:(NSXMLElement*)node
 {
@@ -57,6 +59,7 @@
       [self setChildrenFromXMLChildren:[node children]];
     }
     childCount_     = [[[node attributeForName:@"numchildren"] stringValue] integerValue];
+    self.address    = [[node attributeForName:@"address"] stringValue];
   }
   return self;
 }
@@ -69,6 +72,7 @@
   self.type = nil;
   self.value = nil;
   self.children = nil;
+  self.address = nil;
   [super dealloc];
 }
 
@@ -89,7 +93,7 @@
   if (![self isLeaf] && [children count] < 1) {
     // If this node has children but they haven't been loaded from the backend,
     // request them asynchronously.
-    [[AppDelegate instance].debugger fetchProperty:self.fullName forNode:self];
+    [[AppDelegate instance].debugger fetchChildProperties:self];
   }
   return children;
 }