Remove the |session| ivar from GDBpConnection. Use |transactionID| to keep
authorRobert Sesek <rsesek@bluestatic.org>
Mon, 1 Feb 2010 06:05:26 +0000 (01:05 -0500)
committerRobert Sesek <rsesek@bluestatic.org>
Mon, 1 Feb 2010 06:05:26 +0000 (01:05 -0500)
track of individual message transactions with the debugger engine.

Source/DebuggerController.m
Source/GDBpConnection.h
Source/GDBpConnection.m

index 17af9e26fea0033dc9ca40ca5601b4c5ea897200..b425c62d9dbf61b3b6106692f62fc856470607b6 100644 (file)
@@ -41,7 +41,7 @@
                stackController = [[StackController alloc] init];
                
                NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
-               connection = [[GDBpConnection alloc] initWithPort:[defaults integerForKey:@"Port"] session:[defaults stringForKey:@"IDEKey"]];
+               connection = [[GDBpConnection alloc] initWithPort:[defaults integerForKey:@"Port"] ideKey:[defaults stringForKey:@"IDEKey"]];
                connection.delegate = self;
                expandedVariables = [[NSMutableSet alloc] init];
                [[self window] makeKeyAndOrderFront:nil];
@@ -70,7 +70,7 @@
 - (void)awakeFromNib
 {
        [[self window] setExcludedFromWindowsMenu:YES];
-       [[self window] setTitle:[NSString stringWithFormat:@"GDBp @ %@:%d/%@", [connection remoteHost], [connection port], [connection session]]];
+       [[self window] setTitle:[NSString stringWithFormat:@"GDBp @ %@:%d/%@", [connection remoteHost], [connection port], [connection ideKey]]];
        [sourceViewer setDelegate:self];
        [stackArrayController setSortDescriptors:[NSArray arrayWithObject:[[[NSSortDescriptor alloc] initWithKey:@"index" ascending:YES] autorelease]]];
 }
index 7c06b1f7969e99a85b574e5a4d3657577184ed1d..d943345b23c813230010d5fb7eac16d90915d490 100644 (file)
 @interface GDBpConnection : NSObject <SocketWrapperDelegate>
 {
        int port;
-       NSString* session;
        BOOL connected;
        
+       /**
+        * An ever-increasing integer that gives each transaction a unique ID for
+        * the debugging engine. Managed by |-createCommand:|.
+        */
+       int transactionID;
+       
        /**
         * Human-readable status of the connection
         */
 @property (assign) id <GDBpConnectionDelegate> delegate;
 
 // initializer
-- (id)initWithPort:(int)aPort session:(NSString*)aSession;
+- (id)initWithPort:(int)aPort;
 
 // getter
 - (int)port;
-- (NSString*)session;
 - (NSString*)remoteHost;
 - (BOOL)isConnected;
 - (NSArray*)getCurrentStack;
index fd5096ee676a64f3bc5d29ad124f1ccd9deea436..d0f00c168f6537a05384cc19f8bf73e50658403a 100644 (file)
  * Creates a new DebuggerConnection and initializes the socket from the given connection
  * paramters.
  */
-- (id)initWithPort:(int)aPort session:(NSString*)aSession;
+- (id)initWithPort:(int)aPort
 {
        if (self = [super init])
        {
                port = aPort;
-               session = [aSession retain];
                connected = NO;
                
                // now that we have our host information, open the socket
@@ -64,7 +63,6 @@
 - (void)dealloc
 {
        [socket release];
-       [session release];
        [super dealloc];
 }
 
        return port;
 }
 
-/**
- * Gets the session name
- */
-- (NSString*)session
-{
-       return session;
-}
-
 /**
  * Returns the name of the remote host
  */
 #pragma mark Private
 
 /**
- * Helper method to create a string command with the -i <session> automatically tacked on. Takes
+ * Helper method to create a string command with the -i <transaction id> automatically tacked on. Takes
  * a variable number of arguments and parses the given command with +[NSString stringWithFormat:]
  */
 - (NSString*)createCommand:(NSString*)cmd, ...
        if ([[[[NSProcessInfo processInfo] environment] objectForKey:@"TransportDebug"] boolValue])
                NSLog(@"--> %@", cmd);
        
-       return [NSString stringWithFormat:@"%@ -i %@", [format autorelease], session];
+       return [NSString stringWithFormat:@"%@ -i %d", [format autorelease], transactionID++];
 }
 
 /**
 - (void)doSocketAccept:_nil
 {
        connected = YES;
+       transactionID = 0;
        [socket receive];
        [self updateStatus];