Rather than having GDBpConnection tell the window controller to change status, cache...
authorRobert Sesek <rsesek@bluestatic.org>
Mon, 1 Dec 2008 04:06:34 +0000 (23:06 -0500)
committerRobert Sesek <rsesek@bluestatic.org>
Mon, 1 Dec 2008 04:06:34 +0000 (23:06 -0500)
* Source/GDBpConnection.h: Define the status ivar and make it a prop
* Source/GDBpConnection.m:
(refreshStatus): Remove most of the status-updating code
(updateStatus): New method to fetch and set the status ivar
* English.lproj/Debugger.xib: Bind the status text to GDBpConnection's new status ivar

English.lproj/Debugger.xib
Source/GDBpConnection.h
Source/GDBpConnection.m

index 4df873c7489daa365c3851dbddf4e86b94097067..e9e66b9d5253fa1cd0c281ec3ed274ae92d4bdfb 100644 (file)
@@ -8,7 +8,7 @@
                <string key="IBDocument.HIToolboxVersion">352.00</string>
                <object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
                        <bool key="EncodedWithXMLCoder">YES</bool>
-                       <integer value="15"/>
+                       <integer value="8"/>
                </object>
                <object class="NSArray" key="IBDocument.PluginDependencies">
                        <bool key="EncodedWithXMLCoder">YES</bool>
@@ -1216,7 +1216,7 @@ ELIAAAAAAAgACAAIAAgAAQABAAEAAQ</bytes>
                                                        <string key="NSKeyPath">arrangedObjects.index</string>
                                                        <object class="NSDictionary" key="NSOptions">
                                                                <string key="NS.key.0">NSConditionallySetsEditable</string>
-                                                               <integer value="1" key="NS.object.0" id="5"/>
+                                                               <integer value="1" key="NS.object.0" id="9"/>
                                                        </object>
                                                        <int key="NSNibBindingConnectorVersion">2</int>
                                                </object>
@@ -1236,7 +1236,7 @@ ELIAAAAAAAgACAAIAAgAAQABAAEAAQ</bytes>
                                                        <string key="NSKeyPath">arrangedObjects.lineNumber</string>
                                                        <object class="NSDictionary" key="NSOptions">
                                                                <string key="NS.key.0">NSConditionallySetsEditable</string>
-                                                               <reference key="NS.object.0" ref="5"/>
+                                                               <reference key="NS.object.0" ref="9"/>
                                                        </object>
                                                        <int key="NSNibBindingConnectorVersion">2</int>
                                                </object>
@@ -1256,7 +1256,7 @@ ELIAAAAAAAgACAAIAAgAAQABAAEAAQ</bytes>
                                                        <string key="NSKeyPath">arrangedObjects.function</string>
                                                        <object class="NSDictionary" key="NSOptions">
                                                                <string key="NS.key.0">NSConditionallySetsEditable</string>
-                                                               <reference key="NS.object.0" ref="5"/>
+                                                               <reference key="NS.object.0" ref="9"/>
                                                        </object>
                                                        <int key="NSNibBindingConnectorVersion">2</int>
                                                </object>
@@ -1271,6 +1271,22 @@ ELIAAAAAAAgACAAIAAgAAQABAAEAAQ</bytes>
                                        </object>
                                        <int key="connectionID">563</int>
                                </object>
+                               <object class="IBConnectionRecord">
+                                       <object class="IBBindingConnection" key="connection">
+                                               <string key="label">value: connection.status</string>
+                                               <reference key="source" ref="915016159"/>
+                                               <reference key="destination" ref="78922448"/>
+                                               <object class="NSNibBindingConnector" key="connector">
+                                                       <reference key="NSSource" ref="915016159"/>
+                                                       <reference key="NSDestination" ref="78922448"/>
+                                                       <string key="NSLabel">value: connection.status</string>
+                                                       <string key="NSBinding">value</string>
+                                                       <string key="NSKeyPath">connection.status</string>
+                                                       <int key="NSNibBindingConnectorVersion">2</int>
+                                               </object>
+                                       </object>
+                                       <int key="connectionID">564</int>
+                               </object>
                        </object>
                        <object class="IBMutableOrderedSet" key="objectRecords">
                                <object class="NSArray" key="orderedObjects">
@@ -1713,7 +1729,7 @@ ELIAAAAAAAgACAAIAAgAAQABAAEAAQ</bytes>
                                        <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
                                        <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
                                        <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
-                                       <integer value="1" id="9"/>
+                                       <reference ref="9"/>
                                        <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
                                        <reference ref="9"/>
                                        <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -1808,7 +1824,7 @@ ELIAAAAAAAgACAAIAAgAAQABAAEAAQ</bytes>
                                </object>
                        </object>
                        <nil key="sourceID"/>
-                       <int key="maxID">563</int>
+                       <int key="maxID">564</int>
                </object>
                <object class="IBClassDescriber" key="IBDocument.Classes">
                        <object class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -1874,7 +1890,6 @@ ELIAAAAAAAgACAAIAAgAAQABAAEAAQ</bytes>
                                                        <string>runButton</string>
                                                        <string>sourceViewer</string>
                                                        <string>stackArrayController</string>
-                                                       <string>stackController2</string>
                                                        <string>statusmsg</string>
                                                        <string>stepInButton</string>
                                                        <string>stepOutButton</string>
@@ -1889,7 +1904,6 @@ ELIAAAAAAAgACAAIAAgAAQABAAEAAQ</bytes>
                                                        <string>NSToolbarItem</string>
                                                        <string>BSSourceView</string>
                                                        <string>NSArrayController</string>
-                                                       <string>NSArrayController</string>
                                                        <string>NSTextField</string>
                                                        <string>NSToolbarItem</string>
                                                        <string>NSToolbarItem</string>
index e2ab9846e3d8d74f3281b0e508a8a6d90598272b..d939c41a21e47b89edfcb85a8f3881793e7c146b 100644 (file)
@@ -28,11 +28,17 @@ extern NSString *kErrorOccurredNotif;
        NSString *session;
        BOOL connected;
        
+       /**
+        * Human-readable status of the connection
+        */
+       NSString *status;
+       
        DebuggerController *windowController;
        
        SocketWrapper *socket;
 }
 
+@property(readonly, copy) NSString *status;
 @property(readonly) SocketWrapper *socket;
 @property(readonly) DebuggerController *windowController;
 
index 31faa62b61ac6d3089785b85a606c4236e0aae7a..da3ff9c1ded1cbe10c18ab89f3463c258211347a 100644 (file)
 
 NSString *kErrorOccurredNotif = @"GDBpConnection_ErrorOccured_Notification";
 
-@interface GDBpConnection (Private)
+@interface GDBpConnection()
+@property(readwrite, copy) NSString *status;
+
 - (NSString *)createCommand:(NSString *)cmd;
 - (NSXMLDocument *)processData:(NSString *)data;
 - (StackFrame *)createStackFrame;
+- (void)updateStatus;
 @end
 
 @implementation GDBpConnection
 
-@synthesize socket, windowController;
+@synthesize socket, windowController, status;
 
 /**
  * Creates a new DebuggerConnection and initializes the socket from the given connection
@@ -160,22 +163,11 @@ NSString *kErrorOccurredNotif = @"GDBpConnection_ErrorOccured_Notification";
  */
 - (void)refreshStatus
 {
-       [socket send:[self createCommand:@"status"]];
-       
-       NSXMLDocument *doc = [self processData:[socket receive]];
-       NSString *status = [[[doc rootElement] attributeForName:@"status"] stringValue];
-       [windowController setStatus:[status capitalizedString]];
-       
-       if ([status isEqualToString:@"break"])
+       [self updateStatus];
+       if ([status isEqualToString:@"Break"])
        {
                [self updateStackTraceAndRegisters];
        }
-       else if ([status isEqualToString:@"stopped"] || [status isEqualToString:@"stopping"])
-       {
-               connected = NO;
-               [socket close];
-               [windowController setStatus:@"Stopped"];
-       }
 }
 
 /**
@@ -345,4 +337,21 @@ NSString *kErrorOccurredNotif = @"GDBpConnection_ErrorOccured_Notification";
        return [frame autorelease];
 }
 
+/**
+ * Fetches the value of and sets the status instance variable
+ */
+- (void)updateStatus
+{
+       [socket send:[self createCommand:@"status"]];
+       NSXMLDocument *doc = [self processData:[socket receive]];
+       self.status = [[[[doc rootElement] attributeForName:@"status"] stringValue] capitalizedString];
+       
+       if ([status isEqualToString:@"Stopped"] || [status isEqualToString:@"Stopping"])
+       {
+               connected = NO;
+               [socket close];
+               self.status = @"Stopped";
+       }
+}
+
 @end