From 99e7f1f28ae82e41d89d102c463e9429ae791d14 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Wed, 9 Jan 2008 01:05:22 -0800 Subject: [PATCH] The reconnect functionality now works * Source/DebuggerConnection.h: * Source/DebuggerConnection.m: ([DebuggerConnection reconnect]): New method that communicates the reconnect to the debugger ([Debuggerconnection refreshStatus]): If the status is "stopped", we are no longer connected * Source/DebuggerWindowController.h: * Source/DebuggerWindowController.m: ([DebuggerWindowController resetDisplays]): New method to set all the display information to be blank ([DebuggerWindowController reconnect:]): Forward the message to reconnect to the DebuggerConnection --- Source/DebuggerConnection.h | 1 + Source/DebuggerConnection.m | 18 ++++++++++++++++++ Source/DebuggerWindowController.h | 2 ++ Source/DebuggerWindowController.m | 12 +++++++++++- 4 files changed, 32 insertions(+), 1 deletion(-) diff --git a/Source/DebuggerConnection.h b/Source/DebuggerConnection.h index 0c4648b..506d350 100644 --- a/Source/DebuggerConnection.h +++ b/Source/DebuggerConnection.h @@ -42,6 +42,7 @@ - (BOOL)isConnected; // communication +- (void)reconnect; - (void)run; - (void)stepIn; - (void)stepOut; diff --git a/Source/DebuggerConnection.m b/Source/DebuggerConnection.m index cb39365..6b00c3a 100644 --- a/Source/DebuggerConnection.m +++ b/Source/DebuggerConnection.m @@ -106,6 +106,18 @@ [windowController setError:error]; } +/** + * Reestablishes communication with the remote debugger so that a new connection doesn't have to be + * created every time you want to debug a page + */ +- (void)reconnect +{ + [socket close]; + [windowController setStatus:@"Connecting"]; + [windowController resetDisplays]; + [socket connect]; +} + /** * Tells the debugger to continue running the script */ @@ -130,6 +142,12 @@ { [self updateStackTraceAndRegisters]; } + else if ([status isEqualToString:@"stopped"]) + { + connected = NO; + [socket close]; + [windowController setStatus:[status capitalizedString]]; + } } /** diff --git a/Source/DebuggerWindowController.h b/Source/DebuggerWindowController.h index ff61746..352022b 100644 --- a/Source/DebuggerWindowController.h +++ b/Source/DebuggerWindowController.h @@ -46,6 +46,8 @@ - (id)initWithPort:(int)aPort session:(NSString *)aSession; +- (void)resetDisplays; + - (void)setStatus:(NSString *)aStatus; - (void)setError:(NSString *)anError; - (void)setStack:(NSArray *)node; diff --git a/Source/DebuggerWindowController.m b/Source/DebuggerWindowController.m index 349c4e5..f1cf8f2 100644 --- a/Source/DebuggerWindowController.m +++ b/Source/DebuggerWindowController.m @@ -67,6 +67,16 @@ [[connection socket] close]; } +/** + * Resets all the displays to be empty + */ +- (void)resetDisplays +{ + [registerController setContent:nil]; + [stackController setContent:nil]; + [sourceViewer setString:@""]; +} + /** * Sets the status and clears any error message */ @@ -162,7 +172,7 @@ */ - (IBAction)reconnect:(id)sender { - + [connection reconnect]; } /** -- 2.43.5