track of individual message transactions with the debugger engine.
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];
- (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]]];
}
@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;
* 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
- (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];