From d14915fe29ef756cfed1beaf87488bafb5be99ff Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Mon, 1 Feb 2010 01:05:26 -0500 Subject: [PATCH] Remove the |session| ivar from GDBpConnection. Use |transactionID| to keep track of individual message transactions with the debugger engine. --- Source/DebuggerController.m | 4 ++-- Source/GDBpConnection.h | 10 +++++++--- Source/GDBpConnection.m | 17 ++++------------- 3 files changed, 13 insertions(+), 18 deletions(-) diff --git a/Source/DebuggerController.m b/Source/DebuggerController.m index 17af9e2..b425c62 100644 --- a/Source/DebuggerController.m +++ b/Source/DebuggerController.m @@ -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]]]; } diff --git a/Source/GDBpConnection.h b/Source/GDBpConnection.h index 7c06b1f..d943345 100644 --- a/Source/GDBpConnection.h +++ b/Source/GDBpConnection.h @@ -24,9 +24,14 @@ @interface GDBpConnection : NSObject { 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 */ @@ -42,11 +47,10 @@ @property (assign) id delegate; // initializer -- (id)initWithPort:(int)aPort session:(NSString*)aSession; +- (id)initWithPort:(int)aPort; // getter - (int)port; -- (NSString*)session; - (NSString*)remoteHost; - (BOOL)isConnected; - (NSArray*)getCurrentStack; diff --git a/Source/GDBpConnection.m b/Source/GDBpConnection.m index fd5096e..d0f00c1 100644 --- a/Source/GDBpConnection.m +++ b/Source/GDBpConnection.m @@ -38,12 +38,11 @@ * 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]; } @@ -76,14 +74,6 @@ return port; } -/** - * Gets the session name - */ -- (NSString*)session -{ - return session; -} - /** * Returns the name of the remote host */ @@ -257,7 +247,7 @@ #pragma mark Private /** - * Helper method to create a string command with the -i automatically tacked on. Takes + * Helper method to create a string command with the -i automatically tacked on. Takes * a variable number of arguments and parses the given command with +[NSString stringWithFormat:] */ - (NSString*)createCommand:(NSString*)cmd, ... @@ -271,7 +261,7 @@ if ([[[[NSProcessInfo processInfo] environment] objectForKey:@"TransportDebug"] boolValue]) NSLog(@"--> %@", cmd); - return [NSString stringWithFormat:@"%@ -i %@", [format autorelease], session]; + return [NSString stringWithFormat:@"%@ -i %d", [format autorelease], transactionID++]; } /** @@ -411,6 +401,7 @@ - (void)doSocketAccept:_nil { connected = YES; + transactionID = 0; [socket receive]; [self updateStatus]; -- 2.43.5