From 802d50d70b29418eaae3c5724fbc73f96f83ee93 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sun, 5 Aug 2007 14:04:34 -0700 Subject: [PATCH 01/16] Working around an extremely annoying apple bug in NSTreeController and an NSOutlineView. When the contentArray is bound on an NSTreeController, the observing can go haywire and just crash randomly. * English.lproj/Debugger.nib: Unbinding RegisterController's content array * Source/DebuggerConnection.m: ([DebuggerConnection registerRecieved:]): Sending [_windowController setRegister:] the entire document instead of the rootElement * Source/DebuggerWindowController.h: Removed _register ivar and changed setRegister: to take an NSXMLDocument * Source/DebuggerWindowController.m: ([DebuggerWindowController setRegister:]): Instead of changing a property and letting KVO do the work (and subsequently and randomly crash), force the controller to have new content --- English.lproj/Debugger.nib/keyedobjects.nib | Bin 16828 -> 16676 bytes Source/DebuggerConnection.m | 2 +- Source/DebuggerWindowController.h | 3 +-- Source/DebuggerWindowController.m | 24 +++++++++++++------- 4 files changed, 18 insertions(+), 11 deletions(-) diff --git a/English.lproj/Debugger.nib/keyedobjects.nib b/English.lproj/Debugger.nib/keyedobjects.nib index 191f5ec6e84574e32bc71e010dc4962423680c27..16861e8125f57d210f2d64e02900f1628c085992 100644 GIT binary patch delta 6019 zcmZWr2Y3`!*WTIOneDr?z4zW`X6I4@k=|P9***cQeg~V8kImjNcqbN5 z2aQ1!&;qmt?La5c8DxWQpa;kWy}@8G7EA>1f=S>#Fd0k%Q^9ml0cL^OU=ElI=7VLR z3M>cJU=14Af{(!_G;Ri;f*ol59P9*pz+P|w90W(fF>o530T;kUa0Oficfb>*@dtPg z{=|84oR6pB02kmwT!f2pC8)wxxEeR1(TrPgHyS;-7o5gJIE^!SZM+Vifxm$_!JFc( z@YeVMd=UOFz6Ae_KZpMVz7_v3z75-iZ^w7wpW{2x$``x`_%8fQd^f%a-^-ta@HoVJ3TcRD&p6Ebi5*>+7L}#K4kwtVR z-XyY#ZbS~zo#>IwOtYBylZbp`FfoKEAchi!L=iEJC??8?5ya??i_->UzD5bGGJ$nZ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&_viQr_(%Cm{Wbo{ z{zd-n{+<5a{x|%4{rmj;{g?gM{PzO7fFWQG*aFUgJKzmG6&MlV0#gIe2WAE0a{_Y% z^8(uf#{-Rln}Kfvw*x-}ehT~?R0Tu9*1@*H>|jnXH<%YJ3>F1P21fMWufOoOGCRtyF+h=_QpeRh4zQu2^|g{4ZR;a8~QYKIdnC2Ep$C}JM>fNVHkw* zuso~{+rs{EX1E|cG(0{$H#|R_4A+O3hL?v|gx?OI3;!7YIs9w*Uid-yVFZh~B5fms zB10m>A|oQBB4Z-sB6B0JMh-*{Mc#`Xi=2p@jGT^q8%>Lyoek@7L%jN60(%6A)h6uk#Ca+$alzh z$@j>kDxWH#`cng`A=IciRYxtMmQyRK zSE;qs2I_Tc3)MjFr1nsIskfNxcQb(;E!I!9fgE>SnBpJQn;P0SIC##+ZZ z#(Ks2$414fVu{$|*t*!(*tXb?*uL1?v4gSWbOxPCx1rn7Idm@FiSA5yqkGW3=st8m zdH_9$9zqw=@gjNzT}+RrOXyO%jIN-o=?U~R^t1F7I!;fer_(d(+4LOxC3*q9h_0uX z(97wS^eTEay_ViUZ=^TVTj>UR2fd4agWgN;qYu!>n3hZ?)0W9*IxwA>E=+f(CzH<< zFawyuOd&IzDQ3nnR1C?WMVC>jdidt*2DVP02^W> zEXl@LhHb{SU^CcEwhf!bX0thLE}O^pV0*Cx*+J}3b~HPN9miI)6M0P^KL62*zwl^% I{L9YzKLtAzOaK4? diff --git a/Source/DebuggerConnection.m b/Source/DebuggerConnection.m index 32fb186..a8cd955 100644 --- a/Source/DebuggerConnection.m +++ b/Source/DebuggerConnection.m @@ -263,7 +263,7 @@ - (void)registerReceived: (NSData *)packet { NSXMLDocument *doc = [[NSXMLDocument alloc] initWithData: packet options: NSXMLDocumentTidyXML error: nil]; - [_windowController setRegister: [doc rootElement]]; + [_windowController setRegister: doc]; [doc release]; } diff --git a/Source/DebuggerWindowController.h b/Source/DebuggerWindowController.h index 26a20fc..e8cfea5 100644 --- a/Source/DebuggerWindowController.h +++ b/Source/DebuggerWindowController.h @@ -25,7 +25,6 @@ IBOutlet NSArrayController *_stackController; NSArray *_stack; - NSXMLElement *_register; IBOutlet NSTreeController *_registerController; IBOutlet NSTextField *_status; @@ -45,7 +44,7 @@ - (void)setStatus: (NSString *)status; - (void)setError: (NSString *)error; - (void)setStack: (NSArray *)node; -- (void)setRegister: (NSXMLElement *)reg; +- (void)setRegister: (NSXMLDocument *)reg; - (void)addChildren: (NSArray *)children toNode: (id)node; diff --git a/Source/DebuggerWindowController.m b/Source/DebuggerWindowController.m index 86482f8..897ea82 100644 --- a/Source/DebuggerWindowController.m +++ b/Source/DebuggerWindowController.m @@ -123,15 +123,23 @@ /** * Sets the stack root element so that the NSOutlineView can display it */ -- (void)setRegister: (NSXMLElement *)elm +- (void)setRegister: (NSXMLDocument *)elm { - if (_register != nil) - { - [_register release]; - } - - _register = elm; - [_register retain]; + /* + [_registerController willChangeValueForKey: @"rootElement.children"]; + [_registerController unbind: @"contentArray"]; + [_registerController bind: @"contentArray" toObject: elm withKeyPath: @"rootElement.children" options: nil]; + [_registerController didChangeValueForKey: @"rootElement.children"]; + */ + // XXX: Doing anything short of this will cause bindings to crash spectacularly for no reason whatsoever, and + // in seemingly arbitrary places. The class that crashes is _NSKeyValueObservationInfoCreateByRemoving. + // http://boredzo.org/blog/archives/2006-01-29/have-you-seen-this-crash says that this means nothing is + // being observed, but I doubt that he was using an NSOutlineView which seems to be one f!cking piece of + // sh!t when used with NSTreeController. http://www.cocoadev.com/index.pl?NSTreeControllerBugOrDeveloperError + // was the inspiration for this fix (below) but the author says that inserting does not work too well, but + // that's okay for us as we just need to replace the entire thing. + [_registerController setContent: nil]; + [_registerController setContent: [[elm rootElement] children]]; } /** -- 2.22.5 From 8f185269a8de47298873dbfbd2132e78384d3da4 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Mon, 6 Aug 2007 09:57:57 -0700 Subject: [PATCH 02/16] We now remember which items in the register have been expanded so they stay open * Source/DebuggerWindowController.h: Adding an _registerView outlet and an _expandedRegisters array * Source/DebuggerWindowController.m: ([DebuggerWindowController initWithConnection:]): Initialize _expandedRegisters ([DebuggerWindowController dealloc]): Release _expandedRegisters ([DebuggerWindowController setRegister:]): When we set the register, go through all the items and see if any of them should be expanded ([DebuggerWindowController outlineViewItemDidExpand:]): Add the expanded object to _expandedRegisters ([DebuggerWindowController outlineViewItemDidCollapse:]): Remove the object from _expandedRegisters * English.lproj/Debugger.nib: Hooking up the _registerView outlet --- English.lproj/Debugger.nib/classes.nib | 1 + English.lproj/Debugger.nib/keyedobjects.nib | Bin 16676 -> 16759 bytes Source/DebuggerWindowController.h | 2 ++ Source/DebuggerWindowController.m | 21 ++++++++++++++++++++ 4 files changed, 24 insertions(+) diff --git a/English.lproj/Debugger.nib/classes.nib b/English.lproj/Debugger.nib/classes.nib index 96eae4b..568b744 100644 --- a/English.lproj/Debugger.nib/classes.nib +++ b/English.lproj/Debugger.nib/classes.nib @@ -7,6 +7,7 @@ OUTLETS = { "_error" = NSTextField; "_registerController" = NSTreeController; + "_registerView" = NSOutlineView; "_runButton" = NSButton; "_sourceViewer" = NSTextView; "_sourceViewerScroller" = NSScrollView; diff --git a/English.lproj/Debugger.nib/keyedobjects.nib b/English.lproj/Debugger.nib/keyedobjects.nib index 16861e8125f57d210f2d64e02900f1628c085992..c3914bb0668c83d8530cc6d28128afbce6335f52 100644 GIT binary patch delta 6017 zcmZWs2Y3|K7T($1JKJ|>d+)u@?A$}30bNAje_muxX=g!&H6R?L9u(`R|!fitjVDb8( zDQE^-fp(xh=m_2eT|o}$0s4Y|U>Fz&rhutn8ki3L0cL=iU^bWwD#3iP04xMcz$#D$ zR)aO5njJTR&0rTh?gk%$f3o8N@Go!#d8{If4q8-!7NBLapF0qLEglJ4gA5MEG-EC?7Z`5W zKE);dN=l30>@NhFwGa51%QX*V_lXr16%@UZQ=l{G!YO6A%vI(Wrcvjj()#Ukc*W!}ch&K5R zPP1|J2kBq{7+4z(1qOk^oG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l(Lc#Q*+0cU%|FBcfBtX$_XE;^KTto=AcsC>pNkZ}v71D%sAw#HEs8gsQR1_K! z8XX!Jnh@ec%R*a2r$gU`&V??9E{Cp$u7^R`8jgjTM3@U#3)cwO54R6@40jH933m_65bKs8Qv5AI=nx8E_^S1Kl~v4F#I?okAx$! z2pfTs8j;jU?MQZHL}Y5@!^q0WN0Bv=wUJLE8zP$`TO$9B?2a6W9F81~oQRx?T#Q_e z{2WOhOsq|;U94lQb1W;?E!HD8CRP@!h*ic`#XgFyjeQZ@5!)5p6Z<-LKK5hmr`RvC zN3ka~pmnr?Hq%zxPRHnabOX9E-84Zrr#sU9=p1?wJ($j;C(x7WujpO$9{Ou~KYf5c zL?5A#(#PqO^lAD#`g{63eUbiwzCvH4Z_u~sJM@qAPxJ%&A^n(sNy zbf!Jik?F)_GFePFrU%oD>CNuzohg zMp=gC*y?O5o5t2-8?sH<=4>mrE!&>WU^CgSY!5b@?aSt{gVj$7ivIE>ec*Nr!bw~V)nw~c4U_r~|f55^D2zl|S@pNOB1pN*f3UyT0{ zzY@O|zY)J3zZ<_F|2h6k{89W#{I~e?_zMo>1RUTt^ z!d>TXad)}<+ym|r_mq3a{Q)tU0!b)_GN^=VsDnmmfp+MEUKoI37=tW?um-FJ>%jW3 z5o`)uz}7Gwc7UB=7uXH Date: Sat, 11 Aug 2007 12:54:55 -0700 Subject: [PATCH 03/16] We previously were leaking all over the place due to improper use of memory management techniques and circular references * English.lproj/Debugger.nib: Setting DebuggerWindowController as the window's delgate * Source/AppDelegate.h: Adding a connections ivar * Source/AppDelegate.m: ([AppDelegate init]): New method to initialize the connections array ([AppDelegate applicationWillTerminate:]): Frees the connections array ([AppDelegate registerConnection:]): New method to register a DebuggerConnection ([AppDelegate unregisterConnection:]): Unregisters a DebuggerConnection * Source/ConnectWindowController.m: ([ConnectWindowController connect:]): We weren't properly release'ing the connection, so now we register it with the delegate and release it in the connect method * Source/DeubggerConnection.h: Added a windowDidClose method so that the window controller can forward the message * Source/DebuggerConnection.m: ([DebuggerConnection windowDidClose]): New method to forward the windowWillClose notification ([DebuggerConnection initWithPort:session:]): We no longer have to register for NSApplicationWillTerminate ([DebuggerConnection applicationWillTerminate:]): Removed ([DebuggerConnection dealloc]): Release _windowController * Source/DebuggerWindowController.m: ([DebuggerWindowController initWithConnection:]): No longer retain the connection as it creates a circular ref ([DebuggerWindowController windowWillClose:]): Use this delegate method to buble the notification to the controller ([DebuggerWindowController dealloc]): Since we don't retain _connection, don't release it * Source/SocketWrapper.m: ([SocketWrapper dealloc]): Remove ourselves as a notification observer so we don't have a nil reference --- English.lproj/Debugger.nib/keyedobjects.nib | Bin 16759 -> 16826 bytes Source/AppDelegate.h | 10 ++++-- Source/AppDelegate.m | 36 ++++++++++++++++++++ Source/ConnectWindowController.m | 5 ++- Source/DebuggerConnection.h | 2 ++ Source/DebuggerConnection.m | 15 ++++---- Source/DebuggerWindowController.m | 12 +++++-- Source/SocketWrapper.m | 1 + 8 files changed, 67 insertions(+), 14 deletions(-) diff --git a/English.lproj/Debugger.nib/keyedobjects.nib b/English.lproj/Debugger.nib/keyedobjects.nib index c3914bb0668c83d8530cc6d28128afbce6335f52..4da3cc61873392b8ec73848edff28a25b4ea58ff 100644 GIT binary patch delta 5866 zcmZWr2YeLO_TJgtx!ZSVd+$5jcV~8HA)y2Ufj}S-dhZe-1QJN0$b+4w_qLQk=)DsV z0YM%hB1I9U2!etrf~d$tK@e2_H}L`feLKIM`@4J2ne(0RyJz-1nTQ>lgv~F+s`d;$ ziY4lUrXU-%0C}Jd=m0u`ZlF8p1^R;lU>KMHrh(~T2ABzEf!SaVm96Ro?zZm=J%2f#sa6s^a=aqs~+1wI1jzy)v-Tm_$l8{j6m4Za0Gg5QwG z3!H~zI6r{{9LFIp!o|1*m*Q%$0oUMK+=5msZo^5mdT}4PiihzS&fw{I2A+vG!n5&a zcrM-w&&S&#TW7osufS9I4*Vqk0e%WUji15K;-|2E_=o%@{QLMv{3ZA~{A2t){t4QB zieKP8#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i4nGV(3O@}$k023qq)wz>Bs0=Dk{xLlX%QJ7;Ukri?U5ak z_aeI@yCZudA4c{^4n__~jz_+UoQ|A{oQ<4|T#MX}B%ef)s3bOu z9g^{m@z>*h;)U^%@zQu%ygWWLzAU~XzB0Z#UKQUF-y8oW{%ibU{89W#{8{`3g;Hr0 zMu{mYC8v~>n$l1@%0QVY3uU96l#B9EKFUu8sW26z>Qb3hb7}&Wq7PXREO;u6rs14L6>K$qewT;?A?WA^7`>EU1UFsfnpL#(3 zMm?sUQqO7O?LpqvIwyK2 zh9rs-BNL^G@reluE-^FlIPo;`oIx4Dh#489U{nmwXc;|YWXz0>aWDkqX1t7_2{K_O z%1}&#NoO*c`boK>+JR?nJPE9+ogte5q(AvVfVEW_4e>#><^ zV>X*@&c4RBVcWAE+0JY(+k@@R_G1UKdF(Lu4YrUS$(FLC*|F?+Hpxy(U2S4Wu3^`* z>)DO$X11E$%5G=hW#40Wv;SiEvLCYlW7_5c6? diff --git a/Source/AppDelegate.h b/Source/AppDelegate.h index 338f8ba..29eafb7 100644 --- a/Source/AppDelegate.h +++ b/Source/AppDelegate.h @@ -15,10 +15,16 @@ */ #import - +#import "DebuggerConnection.h" @interface AppDelegate : NSObject -{} +{ + NSMutableArray *connections; +} + + +- (void)registerConnection: (DebuggerConnection *)cnx; +- (void)unregisterConnection: (DebuggerConnection *)cnx; - (IBAction)showConnectionWindow: (id)sender; diff --git a/Source/AppDelegate.m b/Source/AppDelegate.m index 2be8057..668ab00 100644 --- a/Source/AppDelegate.m +++ b/Source/AppDelegate.m @@ -19,6 +19,26 @@ @implementation AppDelegate +/** + * Initializes + */ +- (id)init +{ + if (self = [super init]) + { + connections = [[NSMutableArray alloc] init]; + } + return self; +} + +/** + * Called when the application is going to go away + */ +- (void)applicationWillTerminate: (NSNotification *)aNotification +{ + [connections release]; +} + /** * When the application has finished loading, show the connection dialog */ @@ -27,6 +47,22 @@ [self showConnectionWindow: self]; } +/** + * Adds an object to the connections array + */ +- (void)registerConnection: (DebuggerConnection *)cnx +{ + [connections addObject: cnx]; +} + +/** + * Removes a given connection from the connections array + */ +- (void)unregisterConnection: (DebuggerConnection *)cnx +{ + [connections removeObject: cnx]; +} + /** * Shows the connection window */ diff --git a/Source/ConnectWindowController.m b/Source/ConnectWindowController.m index dfa93c4..872b398 100644 --- a/Source/ConnectWindowController.m +++ b/Source/ConnectWindowController.m @@ -16,6 +16,7 @@ #import "ConnectWindowController.h" #import "DebuggerConnection.h" +#import "AppDelegate.h" @implementation ConnectWindowController @@ -52,7 +53,9 @@ */ - (IBAction)connect: (id)sender { - [[DebuggerConnection alloc] initWithPort: [_port intValue] session: [_session stringValue]]; + DebuggerConnection *cnx = [[DebuggerConnection alloc] initWithPort: [_port intValue] session: [_session stringValue]]; + [[NSApp delegate] registerConnection: cnx]; + [cnx release]; [[self window] orderOut: self]; } diff --git a/Source/DebuggerConnection.h b/Source/DebuggerConnection.h index 7d848ef..1a31084 100644 --- a/Source/DebuggerConnection.h +++ b/Source/DebuggerConnection.h @@ -34,6 +34,8 @@ // initializer - (id)initWithPort: (int)port session: (NSString *)session; +- (void)windowDidClose; + // getter - (int)port; - (NSString *)session; diff --git a/Source/DebuggerConnection.m b/Source/DebuggerConnection.m index a8cd955..b6d5f4d 100644 --- a/Source/DebuggerConnection.m +++ b/Source/DebuggerConnection.m @@ -15,6 +15,7 @@ */ #import "DebuggerConnection.h" +#import "AppDelegate.h" @interface DebuggerConnection (Private) @@ -44,22 +45,17 @@ [_socket setDelegate: self]; [_windowController setStatus: @"Connecting"]; [_socket connect]; - - // clean up after ourselves - [[NSNotificationCenter defaultCenter] addObserver: self - selector: @selector(applicationWillTerminate:) - name: NSApplicationWillTerminateNotification - object: NSApp]; } return self; } /** - * Release ourselves when we're about to die + * This is a forwarded message from DebuggerWindowController that tells the connection to prepare to + * close */ -- (void)applicationWillTerminate: (NSNotification *)notif +- (void)windowDidClose { - [self release]; + [[NSApp delegate] unregisterConnection: self]; } /** @@ -69,6 +65,7 @@ { [_session release]; [_socket release]; + [_windowController release]; [super dealloc]; } diff --git a/Source/DebuggerWindowController.m b/Source/DebuggerWindowController.m index f0483e4..08a9529 100644 --- a/Source/DebuggerWindowController.m +++ b/Source/DebuggerWindowController.m @@ -17,6 +17,7 @@ #import "DebuggerWindowController.h" #import "DebuggerConnection.h" #import "NSXMLElementAdditions.h" +#import "AppDelegate.h" @interface DebuggerWindowController (Private) @@ -33,7 +34,7 @@ { if (self = [super initWithWindowNibName: @"Debugger"]) { - _connection = [cnx retain]; + _connection = cnx; _expandedRegisters = [[NSMutableArray alloc] init]; } return self; @@ -53,12 +54,19 @@ [_sourceViewerScroller display]; } +/** + * Called when the window is going to be closed so we can clean up all of our stuff + */ +- (void)windowWillClose: (NSNotification *)aNotification +{ + [_connection windowDidClose]; +} + /** * Release object members */ - (void)dealloc { - [_connection release]; [_expandedRegisters release]; [super dealloc]; diff --git a/Source/SocketWrapper.m b/Source/SocketWrapper.m index 91c8b32..80dc779 100644 --- a/Source/SocketWrapper.m +++ b/Source/SocketWrapper.m @@ -60,6 +60,7 @@ NSString *NsockDataSent = @"SocketWrapper_DataSent"; */ - (void)dealloc { + [[NSNotificationCenter defaultCenter] removeObserver: self]; close(_socket); [super dealloc]; -- 2.22.5 From 2dc3c0152e2e997c64caeb7483055944edaf79b7 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sat, 11 Aug 2007 15:33:24 -0700 Subject: [PATCH 04/16] Chaning all the delivery methods to accept NSXMLDocument instead of NSData and changing dataReceived: to create the NSXMLDocument * Source/DebuggerConnection.m --- Source/DebuggerConnection.m | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/Source/DebuggerConnection.m b/Source/DebuggerConnection.m index b6d5f4d..db5f329 100644 --- a/Source/DebuggerConnection.m +++ b/Source/DebuggerConnection.m @@ -111,11 +111,15 @@ */ - (void)dataReceived: (NSData *)response deliverTo: (SEL)selector { + NSXMLDocument *doc = [[NSXMLDocument alloc] initWithData: response options: NSXMLDocumentTidyXML error: nil]; + // if the caller of [_socket receive:] specified a deliverTo, just forward the message to them if (selector != nil) { - [self performSelector: selector withObject: response]; + [self performSelector: selector withObject: doc]; } + + [doc release]; } /** @@ -149,7 +153,7 @@ * The initial packet handshake. This allows us to set things like the title of the window * and glean information about hte server we are debugging */ -- (void)handshake: (NSData *)packet +- (void)handshake: (NSXMLDocument *)doc { [self refreshStatus]; } @@ -158,11 +162,9 @@ * Handler used by dataReceived:deliverTo: for anytime the status command is issued. It sets * the window controller's status text */ -- (void)updateStatus: (NSData *)packet +- (void)updateStatus: (NSXMLDocument *)doc { - NSXMLDocument *doc = [[NSXMLDocument alloc] initWithData: packet options: NSXMLDocumentTidyXML error: nil]; [_windowController setStatus: [[[[doc rootElement] attributeForName: @"status"] stringValue] capitalizedString]]; - [doc release]; } /** @@ -234,9 +236,8 @@ * Called by the dataReceived delivery delegate. This updates the window controller's data * for the stack trace */ -- (void)stackReceived: (NSData *)packet +- (void)stackReceived: (NSXMLDocument *)doc { - NSXMLDocument *doc = [[NSXMLDocument alloc] initWithData: packet options: NSXMLDocumentTidyXML error: nil]; NSArray *children = [[doc rootElement] children]; NSMutableArray *stack = [NSMutableArray array]; NSMutableDictionary *dict = [NSMutableDictionary dictionary]; @@ -251,17 +252,14 @@ dict = [NSMutableDictionary dictionary]; } [_windowController setStack: stack]; - [doc release]; } /** * Called when we have a new register to display */ -- (void)registerReceived: (NSData *)packet +- (void)registerReceived: (NSXMLDocument *)doc { - NSXMLDocument *doc = [[NSXMLDocument alloc] initWithData: packet options: NSXMLDocumentTidyXML error: nil]; [_windowController setRegister: doc]; - [doc release]; } /** @@ -278,9 +276,8 @@ /** * Called when a property is received. This then adds the result as children to the passed object */ -- (void)propertyReceived: (NSData *)packet +- (void)propertyReceived: (NSXMLDocument *)doc { - NSXMLDocument *doc = [[NSXMLDocument alloc] initWithData: packet options: NSXMLDocumentTidyXML error: nil]; /* @@ -295,7 +292,6 @@ [parent setChildren: nil]; [_windowController addChildren: children toNode: _depthFetchElement]; _depthFetchElement = nil; - [doc release]; } /** -- 2.22.5 From 911aae12785addfc349c9066617fad4c9f79b1af Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sat, 11 Aug 2007 15:52:36 -0700 Subject: [PATCH 05/16] In the dataReceived: method if an error is in the response, set the error on the window * Source/DebuggerConnection.m: ([DebuggerConnection dataReceived:deliverTo:]): If the response XML contains an error tag, set the error of the window to be the error message --- Source/DebuggerConnection.m | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Source/DebuggerConnection.m b/Source/DebuggerConnection.m index db5f329..d4b6d18 100644 --- a/Source/DebuggerConnection.m +++ b/Source/DebuggerConnection.m @@ -113,6 +113,14 @@ { NSXMLDocument *doc = [[NSXMLDocument alloc] initWithData: response options: NSXMLDocumentTidyXML error: nil]; + // check and see if there's an error + NSArray *error = [[doc rootElement] elementsForName: @"error"]; + if ([error count] > 0) + { + [_windowController setError: [[[[error objectAtIndex: 0] children] objectAtIndex: 0] stringValue]]; + return; + } + // if the caller of [_socket receive:] specified a deliverTo, just forward the message to them if (selector != nil) { -- 2.22.5 From 9eada60a32b2fe25980571aa198f81c9df52c6f9 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sat, 11 Aug 2007 15:57:23 -0700 Subject: [PATCH 06/16] Allow the connection socket to be reused in SocketWrapper * Source/SocketWrapper.m: ([SocketWrapper connect:]): Allow the socketOpen to reuse addresses, making the bind errors less common --- Source/SocketWrapper.m | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Source/SocketWrapper.m b/Source/SocketWrapper.m index 80dc779..5e80c25 100644 --- a/Source/SocketWrapper.m +++ b/Source/SocketWrapper.m @@ -160,6 +160,10 @@ NSString *NsockDataSent = @"SocketWrapper_DataSent"; address.sin_addr.s_addr = htonl(INADDR_ANY); memset(address.sin_zero, '\0', sizeof(address.sin_zero)); + // allow an already-opened socket to be reused + int yes = 1; + setsockopt(socketOpen, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(int)); + // bind the socket... and don't give up until we've tried for a while int tries = 0; while (bind(socketOpen, (struct sockaddr *)&address, sizeof(address)) < 0) -- 2.22.5 From cd0ce3240dffeadab249944519ffdf3d9837009a Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sat, 11 Aug 2007 16:21:03 -0700 Subject: [PATCH 07/16] Renaming the "Refresh" butto to be "Re-Connect" and hooking it up (though it does nothing at the moment) * English.lproj/Debugger.nib: Renaming the "Run" button and hooking it up to DebuggerWindowController * Source/DebuggerWindowController.m|h: Adding a _reconnectButton outlet and a reconnect: action ([DebuggerWindowController reconnect:]): New method --- English.lproj/Debugger.nib/classes.nib | 3 ++- English.lproj/Debugger.nib/keyedobjects.nib | Bin 16826 -> 16996 bytes Source/DebuggerWindowController.h | 2 ++ Source/DebuggerWindowController.m | 13 +++++++++++++ 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/English.lproj/Debugger.nib/classes.nib b/English.lproj/Debugger.nib/classes.nib index 568b744..3f5d4fa 100644 --- a/English.lproj/Debugger.nib/classes.nib +++ b/English.lproj/Debugger.nib/classes.nib @@ -1,11 +1,12 @@ { IBClasses = ( { - ACTIONS = {run = id; stepIn = id; stepOut = id; stepOver = id; }; + ACTIONS = {reconnect = id; run = id; stepIn = id; stepOut = id; stepOver = id; }; CLASS = DebuggerWindowController; LANGUAGE = ObjC; OUTLETS = { "_error" = NSTextField; + "_reconnectButton" = NSButton; "_registerController" = NSTreeController; "_registerView" = NSOutlineView; "_runButton" = NSButton; diff --git a/English.lproj/Debugger.nib/keyedobjects.nib b/English.lproj/Debugger.nib/keyedobjects.nib index 4da3cc61873392b8ec73848edff28a25b4ea58ff..a031f086720c4e93b09fc382a7f3c63a9247b1ec 100644 GIT binary patch delta 6240 zcmZWr2Y?er7tZEpHp!)JdQUcG)5~Ue>HR>Y9!T%)I1zz6xIz&zyL6Bqj^2-6JdoZ& z!GgblhzKHx4G)keA{LN;a;Mm`m(1;aQ{MaD_h#OK3D`Fi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$9%^^$7074$1=wX$12Ba$5zKl$0^5Y#~H`#jyD}YIevEBcl_%3&5``W$#e3Z zz^QP0oTSt53_8Qkgfq+8(%H(H<813}=N#j#a8@~MoRgeMC+D2(oZ+11-0a-ye8IWH zxyxDa-0M8)9$72|Nnq=l$4w#rvuEGw*fp4ewXpuf5-T zZ+n06-u2%1KJflQVk97iq=b}{1gRnQq=~eW4$@7MWPl8j&B;8n3)zS4M-CtdkwcPX z30XnbkPFE*WIef;+)o}L50NLx_sH|)`{ak@N93pE9r8!=E_sjqh5W-O^eKEkUsK;x zzUICxUrS#*Uy-lOH_x}+x6)VVTkTupTj$&0d(C&%5Bx5F3x5y)aDRnA<)7@I;-BiD z=AZ7L>7VVNpYWgYzwQ6Pf6M=a|0nfluLM31+zettd(av51bx9^FdU2q z3xXqqGlH{%bAtW1 ze~1ZUFeZvgVzQVy7LG+@bc~55VmYzyvBG4mcdT!$e{4joCRQ7p6ysu(V@qP2Vq0P_ z#CF7X#g4|_j-8F2i(QC)5W7klDKllI?39yoQ(nqP1*i}ep<)zGF;s$TLS<6Ts20@I zR5sO`YD48x?Wqn_K2<<r!};WHqa*8LfdEu?V>$2N&D#_9j2o+ zMaOBD&Y+vpPtnckEIOOcq4VildJ>(Yr_wX%+4MYmA)Tg|(JSfa=r#0udK0~s-cIjI z(tGIr^g;SCeT+Uqze8W9zozfg5989fEgp&|;;rKa@qY2)@#^@T_>%b2_=@rLGeIWI#F#jfV45;dG0mAQrX|yg$zj?u?U@ctN2Y-3!gObPGQF9;On+t& zGlVH-Mld6p(aad8f=N~}06Um1Vu!OM+0pD6 zwvrvk*09gANp>~?k+yNBJ+9%K)*$Ji6> zDfU(Nb@naxEc+gNo_(MFko}0g%znaNWv{WHvtO`ZvNzdp*jwyv_73|adzZb({=zyp&;I~{`P^Rs diff --git a/Source/DebuggerWindowController.h b/Source/DebuggerWindowController.h index 7e6c601..9cef6d8 100644 --- a/Source/DebuggerWindowController.h +++ b/Source/DebuggerWindowController.h @@ -39,6 +39,7 @@ IBOutlet NSButton *_stepOutButton; IBOutlet NSButton *_stepOverButton; IBOutlet NSButton *_runButton; + IBOutlet NSButton *_reconnectButton; } - (id)initWithConnection: (DebuggerConnection *)cnx; @@ -54,5 +55,6 @@ - (IBAction)stepIn: (id)sender; - (IBAction)stepOut: (id)sender; - (IBAction)stepOver: (id)sender; +- (IBAction)reconnect: (id)sender; @end diff --git a/Source/DebuggerWindowController.m b/Source/DebuggerWindowController.m index 08a9529..f649f19 100644 --- a/Source/DebuggerWindowController.m +++ b/Source/DebuggerWindowController.m @@ -85,6 +85,7 @@ [_stepOutButton setEnabled: NO]; [_stepOverButton setEnabled: NO]; [_runButton setEnabled: NO]; + [_reconnectButton setEnabled: NO]; if ([_connection isConnected]) { @@ -94,6 +95,10 @@ [_runButton setEnabled: YES]; } } + else + { + [_reconnectButton setEnabled: YES]; + } } /** @@ -169,6 +174,14 @@ [_connection run]; } +/** + * Tells the connection to ask the server to reconnect + */ +- (IBAction)reconnect: (id)sender +{ + +} + /** * Forwards the message to "step in" to the connection */ -- 2.22.5 From dd15c2a58155b630e340811e55add835cb55e5f8 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Fri, 24 Aug 2007 22:00:15 -0700 Subject: [PATCH 08/16] Removing the NSLog that was being called everytime we sent a command * Source/DebuggerConnection.m ([DebuggerConnection dataSent:]) --- Source/DebuggerConnection.m | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Source/DebuggerConnection.m b/Source/DebuggerConnection.m index d4b6d18..d84b7cf 100644 --- a/Source/DebuggerConnection.m +++ b/Source/DebuggerConnection.m @@ -135,9 +135,7 @@ * isn't useful for much. */ - (void)dataSent: (NSString *)data -{ - NSLog(@"send = %@", data); -} +{} /** * Called by SocketWrapper after the connection is successful. This immediately calls -- 2.22.5 From d03a57afdc14caeeef2de85c18afeedef3140194 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Fri, 24 Aug 2007 22:09:59 -0700 Subject: [PATCH 09/16] Removing a puts statement from the shell script that creates the build version * MacGDBp.xcodeproj --- MacGDBp.xcodeproj/project.pbxproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MacGDBp.xcodeproj/project.pbxproj b/MacGDBp.xcodeproj/project.pbxproj index a9c4e98..9be65f3 100644 --- a/MacGDBp.xcodeproj/project.pbxproj +++ b/MacGDBp.xcodeproj/project.pbxproj @@ -215,7 +215,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /usr/bin/ruby; - shellScript = "require \"ftools\"\nrequire \"Time\"\n\nhash = %x{/usr/local/bin/git log -1 --pretty=format:%h}\ntimestamp = %x{/usr/local/bin/git log -1 --pretty=format:%ct}\ntime = Time.at(timestamp.to_i)\n\nbuild = (\"%02d\" % time.year) + (\"%02d\" % time.month) + (\"%02d\" % time.day) + \".\" + hash\n\ninfopath = ENV[\"CONFIGURATION_BUILD_DIR\"] + \"/\" + ENV[\"INFOPLIST_PATH\"]\n\nputs infopath\n\nfile = \"\"\nio = File.new(infopath)\nlastline = \"\"\nwhile line = io.gets do\n\tif lastline.match(\"CFBundleVersion\")\n\t\tfile += \"\\t#{build}\\n\"\n\telse\n\t\tfile += line\n\tend\n\tlastline = line\nend\nio.close\n\nio = File.new(infopath, \"w\")\nio.write(file)\nio.close"; + shellScript = "require \"ftools\"\nrequire \"Time\"\n\nhash = %x{/usr/local/bin/git log -1 --pretty=format:%h}\ntimestamp = %x{/usr/local/bin/git log -1 --pretty=format:%ct}\ntime = Time.at(timestamp.to_i)\n\nbuild = (\"%02d\" % time.year) + (\"%02d\" % time.month) + (\"%02d\" % time.day) + \".\" + hash\n\ninfopath = ENV[\"CONFIGURATION_BUILD_DIR\"] + \"/\" + ENV[\"INFOPLIST_PATH\"]\n\nfile = \"\"\nio = File.new(infopath)\nlastline = \"\"\nwhile line = io.gets do\n\tif lastline.match(\"CFBundleVersion\")\n\t\tfile += \"\\t#{build}\\n\"\n\telse\n\t\tfile += line\n\tend\n\tlastline = line\nend\nio.close\n\nio = File.new(infopath, \"w\")\nio.write(file)\nio.close"; }; /* End PBXShellScriptBuildPhase section */ -- 2.22.5 From 332bcf2cb67195ddf13929828b7b06862e6d7311 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Fri, 24 Aug 2007 22:36:12 -0700 Subject: [PATCH 10/16] Improving the way we handle updating the stack and registers. Instead of updating them after we send step/run commands, only update the stacks and registers if the status (in updateStatus:) is on "break" * Source/DebuggerConnection.m --- Source/DebuggerConnection.m | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Source/DebuggerConnection.m b/Source/DebuggerConnection.m index d84b7cf..7b1aef7 100644 --- a/Source/DebuggerConnection.m +++ b/Source/DebuggerConnection.m @@ -170,7 +170,13 @@ */ - (void)updateStatus: (NSXMLDocument *)doc { - [_windowController setStatus: [[[[doc rootElement] attributeForName: @"status"] stringValue] capitalizedString]]; + NSString *status = [[[doc rootElement] attributeForName: @"status"] stringValue]; + [_windowController setStatus: [status capitalizedString]]; + + if ([status isEqualToString: @"break"]) + { + [self updateStackTraceAndRegisters]; + } } /** @@ -200,7 +206,6 @@ [_socket send: [self createCommand: @"step_into"]]; [_socket receive: nil]; [self refreshStatus]; - [self updateStackTraceAndRegisters]; } /** @@ -211,7 +216,6 @@ [_socket send: [self createCommand: @"step_out"]]; [_socket receive: nil]; [self refreshStatus]; - [self updateStackTraceAndRegisters]; } /** @@ -222,7 +226,6 @@ [_socket send: [self createCommand: @"step_over"]]; [_socket receive: nil]; [self refreshStatus]; - [self updateStackTraceAndRegisters]; } /** -- 2.22.5 From 5cc647ff54ab4ca3b72b7929f9503310412b2bce Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Fri, 24 Aug 2007 22:38:26 -0700 Subject: [PATCH 11/16] Removing another NSLog when the stack's selection changes * Source/DebuggerWindowController.m ([DebuggerWindowController tableViewSelectionDidChange:]) --- Source/DebuggerWindowController.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/DebuggerWindowController.m b/Source/DebuggerWindowController.m index f649f19..4558657 100644 --- a/Source/DebuggerWindowController.m +++ b/Source/DebuggerWindowController.m @@ -212,9 +212,9 @@ */ - (void)tableViewSelectionDidChange: (NSNotification *)notif { - NSLog(@"selection changed"); [self updateSourceViewer]; } + /** * Does the actual updating of the source viewer by reading in the file */ -- 2.22.5 From f876d212be7ee8ca25f254247e1170bf6a3c581d Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Fri, 24 Aug 2007 23:11:11 -0700 Subject: [PATCH 12/16] Changing the version number from alpha to Beta 1 * Info.plist --- Info.plist | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Info.plist b/Info.plist index b9dc9a4..5354199 100644 --- a/Info.plist +++ b/Info.plist @@ -7,7 +7,7 @@ CFBundleExecutable ${EXECUTABLE_NAME} CFBundleGetInfoString - ${EXECUTABLE_NAME} 1.0α, Copyright 2007 Blue Static + ${EXECUTABLE_NAME} 1.0 Beta 1, Copyright 2007 Blue Static CFBundleIconFile CFBundleIdentifier @@ -23,7 +23,7 @@ CFBundleVersion 1.0 CFBundleShortVersionString - 1.0α + 1.0 Beta 1 NSMainNibFile MainMenu NSPrincipalClass -- 2.22.5 From 3d09629d393d9dea0d9a162e10bcc8bf8bb63600 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sat, 27 Oct 2007 19:30:04 -0400 Subject: [PATCH 13/16] Minor upgrades to the project due to Xcode 3.0 --- MacGDBp.xcodeproj/project.pbxproj | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MacGDBp.xcodeproj/project.pbxproj b/MacGDBp.xcodeproj/project.pbxproj index 9be65f3..1b0c461 100644 --- a/MacGDBp.xcodeproj/project.pbxproj +++ b/MacGDBp.xcodeproj/project.pbxproj @@ -180,9 +180,11 @@ 29B97313FDCFA39411CA2CEA /* Project object */ = { isa = PBXProject; buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "MacGDBp" */; + compatibilityVersion = "Xcode 2.4"; hasScannedForEncodings = 1; mainGroup = 29B97314FDCFA39411CA2CEA /* MacGDBp */; projectDirPath = ""; + projectRoot = ""; targets = ( 8D1107260486CEB800E47090 /* MacGDBp */, ); -- 2.22.5 From 45e742eb7cf0ac3bc6989b2a6edd552d9b08b9e5 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Fri, 4 Jan 2008 01:44:14 -0800 Subject: [PATCH 14/16] Update MacGDBp.xcodeproj/.gitignore for Xcode v3 --- MacGDBp.xcodeproj/.gitignore | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/MacGDBp.xcodeproj/.gitignore b/MacGDBp.xcodeproj/.gitignore index cfd830c..412ee3f 100644 --- a/MacGDBp.xcodeproj/.gitignore +++ b/MacGDBp.xcodeproj/.gitignore @@ -1,2 +1,4 @@ *.perspective -*.pbxuser \ No newline at end of file +*.pbxuser +*.mode1v3 +*.perspectivev3 \ No newline at end of file -- 2.22.5 From da2d78a8682588dcb2f24b792cfa5c4024cba3f6 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Fri, 4 Jan 2008 01:50:27 -0800 Subject: [PATCH 15/16] Add some test code to see how Leopard behaves * MacGDBp.xcodeproj: Change to the 10.5 SDK * Source/DebuggerWindowController.m: Play with the new and improved NSTreeController --- MacGDBp.xcodeproj/project.pbxproj | 4 ++-- Source/DebuggerWindowController.m | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/MacGDBp.xcodeproj/project.pbxproj b/MacGDBp.xcodeproj/project.pbxproj index 1b0c461..b520caa 100644 --- a/MacGDBp.xcodeproj/project.pbxproj +++ b/MacGDBp.xcodeproj/project.pbxproj @@ -314,7 +314,7 @@ GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; PREBINDING = NO; - SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk; + SDKROOT = /Developer/SDKs/MacOSX10.5.sdk; }; name = Debug; }; @@ -325,7 +325,7 @@ GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; PREBINDING = NO; - SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk; + SDKROOT = /Developer/SDKs/MacOSX10.5.sdk; }; name = Release; }; diff --git a/Source/DebuggerWindowController.m b/Source/DebuggerWindowController.m index 4558657..d2ea2bd 100644 --- a/Source/DebuggerWindowController.m +++ b/Source/DebuggerWindowController.m @@ -261,6 +261,7 @@ */ - (void)outlineViewItemDidExpand: (NSNotification *)notif { + NSLog(@"notification expanded: %@", notif); // XXX: This very well may break because NSTreeController sends us a _NSArrayControllerTreeNode object // which is presumably private, and thus this is not a reliable method for getting the object. But // we damn well need it, so f!ck the rules and we're using it. @@ -279,9 +280,10 @@ /** * Called when an item was collapsed. This allows us to remove it from the list of expanded items */ -- (void)outlineViewItemDidCollapse: (NSNotification *)notif +- (void)outlineViewItemDidCollapse: (id)notif { [_expandedRegisters removeObject: [[[[notif userInfo] objectForKey: @"NSObject"] observedObject] variable]]; + NSLog(@"outlineViewDidCollapse: %@", notif); } /** @@ -289,6 +291,7 @@ */ - (void)addChildren: (NSArray *)children toNode: (id)node { + NSLog(@"addChildren node: %@", node); // XXX: this may break like in outlineViewItemDidExpand: NSIndexPath *masterPath = [node indexPath]; for (int i = 0; i < [children count]; i++) -- 2.22.5 From 48022096ee56de046900df9d3fedafe3e650c87b Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Fri, 4 Jan 2008 02:03:38 -0800 Subject: [PATCH 16/16] Removing the extra spacing after colons in function arguments --- Source/AppDelegate.h | 6 +- Source/AppDelegate.m | 18 ++-- Source/ConnectWindowController.h | 2 +- Source/ConnectWindowController.m | 20 ++--- Source/DebuggerConnection.h | 4 +- Source/DebuggerConnection.m | 102 +++++++++++----------- Source/DebuggerWindowController.h | 22 ++--- Source/DebuggerWindowController.m | 140 +++++++++++++++--------------- Source/NSXMLElementAdditions.m | 14 +-- Source/SocketWrapper.h | 14 +-- Source/SocketWrapper.m | 78 ++++++++--------- 11 files changed, 210 insertions(+), 210 deletions(-) diff --git a/Source/AppDelegate.h b/Source/AppDelegate.h index 29eafb7..9e1b352 100644 --- a/Source/AppDelegate.h +++ b/Source/AppDelegate.h @@ -23,9 +23,9 @@ } -- (void)registerConnection: (DebuggerConnection *)cnx; -- (void)unregisterConnection: (DebuggerConnection *)cnx; +- (void)registerConnection:(DebuggerConnection *)cnx; +- (void)unregisterConnection:(DebuggerConnection *)cnx; -- (IBAction)showConnectionWindow: (id)sender; +- (IBAction)showConnectionWindow:(id)sender; @end diff --git a/Source/AppDelegate.m b/Source/AppDelegate.m index 668ab00..1d1ebf2 100644 --- a/Source/AppDelegate.m +++ b/Source/AppDelegate.m @@ -34,7 +34,7 @@ /** * Called when the application is going to go away */ -- (void)applicationWillTerminate: (NSNotification *)aNotification +- (void)applicationWillTerminate:(NSNotification *)aNotification { [connections release]; } @@ -42,33 +42,33 @@ /** * When the application has finished loading, show the connection dialog */ -- (void)applicationDidFinishLaunching: (NSNotification *)notif +- (void)applicationDidFinishLaunching:(NSNotification *)notif { - [self showConnectionWindow: self]; + [self showConnectionWindow:self]; } /** * Adds an object to the connections array */ -- (void)registerConnection: (DebuggerConnection *)cnx +- (void)registerConnection:(DebuggerConnection *)cnx { - [connections addObject: cnx]; + [connections addObject:cnx]; } /** * Removes a given connection from the connections array */ -- (void)unregisterConnection: (DebuggerConnection *)cnx +- (void)unregisterConnection:(DebuggerConnection *)cnx { - [connections removeObject: cnx]; + [connections removeObject:cnx]; } /** * Shows the connection window */ -- (IBAction)showConnectionWindow: (id)sender +- (IBAction)showConnectionWindow:(id)sender { - [[[ConnectWindowController sharedController] window] makeKeyAndOrderFront: self]; + [[[ConnectWindowController sharedController] window] makeKeyAndOrderFront:self]; } @end diff --git a/Source/ConnectWindowController.h b/Source/ConnectWindowController.h index f69bce7..bbdb704 100644 --- a/Source/ConnectWindowController.h +++ b/Source/ConnectWindowController.h @@ -25,6 +25,6 @@ + (id)sharedController; -- (IBAction)connect: (id)sender; +- (IBAction)connect:(id)sender; @end diff --git a/Source/ConnectWindowController.m b/Source/ConnectWindowController.m index 872b398..4d24eef 100644 --- a/Source/ConnectWindowController.m +++ b/Source/ConnectWindowController.m @@ -28,13 +28,13 @@ static id instance = nil; if (!instance) { - instance = [[ConnectWindowController alloc] initWithWindowNibName: @"Connect"]; + instance = [[ConnectWindowController alloc] initWithWindowNibName:@"Connect"]; [instance window]; - [[NSNotificationCenter defaultCenter] addObserver: instance - selector: @selector(applicationWillTerminate:) - name: NSApplicationWillTerminateNotification - object: NSApp]; + [[NSNotificationCenter defaultCenter] addObserver:instance + selector:@selector(applicationWillTerminate:) + name:NSApplicationWillTerminateNotification + object:NSApp]; } return instance; @@ -43,7 +43,7 @@ /** * Called when the applicaion is about to terminate so we can release itself */ -- (void)applicationWillTerminate: (NSNotification *)notif +- (void)applicationWillTerminate:(NSNotification *)notif { [self release]; } @@ -51,12 +51,12 @@ /** * Creates a new DebuggerConnection object (and then completely forgets about it) and then close the window */ -- (IBAction)connect: (id)sender +- (IBAction)connect:(id)sender { - DebuggerConnection *cnx = [[DebuggerConnection alloc] initWithPort: [_port intValue] session: [_session stringValue]]; - [[NSApp delegate] registerConnection: cnx]; + DebuggerConnection *cnx = [[DebuggerConnection alloc] initWithPort:[_port intValue] session:[_session stringValue]]; + [[NSApp delegate] registerConnection:cnx]; [cnx release]; - [[self window] orderOut: self]; + [[self window] orderOut:self]; } @end diff --git a/Source/DebuggerConnection.h b/Source/DebuggerConnection.h index 1a31084..0531ce8 100644 --- a/Source/DebuggerConnection.h +++ b/Source/DebuggerConnection.h @@ -32,7 +32,7 @@ } // initializer -- (id)initWithPort: (int)port session: (NSString *)session; +- (id)initWithPort:(int)port session:(NSString *)session; - (void)windowDidClose; @@ -51,6 +51,6 @@ - (void)updateStackTraceAndRegisters; // helpers -- (void)getProperty: (NSString *)property forElement: (NSXMLElement *)elm; +- (void)getProperty:(NSString *)property forElement:(NSXMLElement *)elm; @end diff --git a/Source/DebuggerConnection.m b/Source/DebuggerConnection.m index 7b1aef7..b2d3da5 100644 --- a/Source/DebuggerConnection.m +++ b/Source/DebuggerConnection.m @@ -19,7 +19,7 @@ @interface DebuggerConnection (Private) -- (NSString *)createCommand: (NSString *)cmd; +- (NSString *)createCommand:(NSString *)cmd; @end @@ -29,7 +29,7 @@ * Creates a new DebuggerConnection and initializes the socket from the given connection * paramters. */ -- (id)initWithPort: (int)port session: (NSString *)session +- (id)initWithPort:(int)port session:(NSString *)session { if (self = [super init]) { @@ -37,13 +37,13 @@ _session = [session retain]; _connected = NO; - _windowController = [[DebuggerWindowController alloc] initWithConnection: self]; - [[_windowController window] makeKeyAndOrderFront: self]; + _windowController = [[DebuggerWindowController alloc] initWithConnection:self]; + [[_windowController window] makeKeyAndOrderFront:self]; // now that we have our host information, open the socket - _socket = [[SocketWrapper alloc] initWithPort: port]; - [_socket setDelegate: self]; - [_windowController setStatus: @"Connecting"]; + _socket = [[SocketWrapper alloc] initWithPort:port]; + [_socket setDelegate:self]; + [_windowController setStatus:@"Connecting"]; [_socket connect]; } return self; @@ -55,7 +55,7 @@ */ - (void)windowDidClose { - [[NSApp delegate] unregisterConnection: self]; + [[NSApp delegate] unregisterConnection:self]; } /** @@ -109,22 +109,22 @@ /** * SocketWrapper delegate method that is called whenever new data is received */ -- (void)dataReceived: (NSData *)response deliverTo: (SEL)selector +- (void)dataReceived:(NSData *)response deliverTo:(SEL)selector { - NSXMLDocument *doc = [[NSXMLDocument alloc] initWithData: response options: NSXMLDocumentTidyXML error: nil]; + NSXMLDocument *doc = [[NSXMLDocument alloc] initWithData:response options:NSXMLDocumentTidyXML error:nil]; // check and see if there's an error - NSArray *error = [[doc rootElement] elementsForName: @"error"]; + NSArray *error = [[doc rootElement] elementsForName:@"error"]; if ([error count] > 0) { - [_windowController setError: [[[[error objectAtIndex: 0] children] objectAtIndex: 0] stringValue]]; + [_windowController setError:[[[[error objectAtIndex:0] children] objectAtIndex:0] stringValue]]; return; } // if the caller of [_socket receive:] specified a deliverTo, just forward the message to them if (selector != nil) { - [self performSelector: selector withObject: doc]; + [self performSelector:selector withObject:doc]; } [doc release]; @@ -134,7 +134,7 @@ * SocketWrapper delegate method that is called after data is sent. This really * isn't useful for much. */ -- (void)dataSent: (NSString *)data +- (void)dataSent:(NSString *)data {} /** @@ -144,22 +144,22 @@ - (void)socketDidAccept { _connected = YES; - [_socket receive: @selector(handshake:)]; + [_socket receive:@selector(handshake:)]; } /** * Receives errors from the SocketWrapper and updates the display */ -- (void)errorEncountered: (NSError *)error +- (void)errorEncountered:(NSError *)error { - [_windowController setError: [error domain]]; + [_windowController setError:[error domain]]; } /** * The initial packet handshake. This allows us to set things like the title of the window * and glean information about hte server we are debugging */ -- (void)handshake: (NSXMLDocument *)doc +- (void)handshake:(NSXMLDocument *)doc { [self refreshStatus]; } @@ -168,12 +168,12 @@ * Handler used by dataReceived:deliverTo: for anytime the status command is issued. It sets * the window controller's status text */ -- (void)updateStatus: (NSXMLDocument *)doc +- (void)updateStatus:(NSXMLDocument *)doc { - NSString *status = [[[doc rootElement] attributeForName: @"status"] stringValue]; - [_windowController setStatus: [status capitalizedString]]; + NSString *status = [[[doc rootElement] attributeForName:@"status"] stringValue]; + [_windowController setStatus:[status capitalizedString]]; - if ([status isEqualToString: @"break"]) + if ([status isEqualToString:@"break"]) { [self updateStackTraceAndRegisters]; } @@ -184,7 +184,7 @@ */ - (void)run { - [_socket send: [self createCommand: @"run"]]; + [_socket send:[self createCommand:@"run"]]; [self refreshStatus]; } @@ -194,8 +194,8 @@ */ - (void)refreshStatus { - [_socket send: [self createCommand: @"status"]]; - [_socket receive: @selector(updateStatus:)]; + [_socket send:[self createCommand:@"status"]]; + [_socket receive:@selector(updateStatus:)]; } /** @@ -203,8 +203,8 @@ */ - (void)stepIn { - [_socket send: [self createCommand: @"step_into"]]; - [_socket receive: nil]; + [_socket send:[self createCommand:@"step_into"]]; + [_socket receive:nil]; [self refreshStatus]; } @@ -213,8 +213,8 @@ */ - (void)stepOut { - [_socket send: [self createCommand: @"step_out"]]; - [_socket receive: nil]; + [_socket send:[self createCommand:@"step_out"]]; + [_socket receive:nil]; [self refreshStatus]; } @@ -223,8 +223,8 @@ */ - (void)stepOver { - [_socket send: [self createCommand: @"step_over"]]; - [_socket receive: nil]; + [_socket send:[self createCommand:@"step_over"]]; + [_socket receive:nil]; [self refreshStatus]; } @@ -234,58 +234,58 @@ */ - (void)updateStackTraceAndRegisters { - [_socket send: [self createCommand: @"stack_get"]]; - [_socket receive: @selector(stackReceived:)]; + [_socket send:[self createCommand:@"stack_get"]]; + [_socket receive:@selector(stackReceived:)]; - [_socket send: [self createCommand: @"context_get"]]; - [_socket receive: @selector(registerReceived:)]; + [_socket send:[self createCommand:@"context_get"]]; + [_socket receive:@selector(registerReceived:)]; } /** * Called by the dataReceived delivery delegate. This updates the window controller's data * for the stack trace */ -- (void)stackReceived: (NSXMLDocument *)doc +- (void)stackReceived:(NSXMLDocument *)doc { NSArray *children = [[doc rootElement] children]; NSMutableArray *stack = [NSMutableArray array]; NSMutableDictionary *dict = [NSMutableDictionary dictionary]; for (int i = 0; i < [children count]; i++) { - NSArray *attrs = [[children objectAtIndex: i] attributes]; + NSArray *attrs = [[children objectAtIndex:i] attributes]; for (int j = 0; j < [attrs count]; j++) { - [dict setValue: [[attrs objectAtIndex: j] stringValue] forKey: [[attrs objectAtIndex: j] name]]; + [dict setValue:[[attrs objectAtIndex:j] stringValue] forKey:[[attrs objectAtIndex:j] name]]; } - [stack addObject: dict]; + [stack addObject:dict]; dict = [NSMutableDictionary dictionary]; } - [_windowController setStack: stack]; + [_windowController setStack:stack]; } /** * Called when we have a new register to display */ -- (void)registerReceived: (NSXMLDocument *)doc +- (void)registerReceived:(NSXMLDocument *)doc { - [_windowController setRegister: doc]; + [_windowController setRegister:doc]; } /** * Tells the debugger engine to get a specifc property. This also takes in the NSXMLElement * that requested it so that the child can be attached in the delivery. */ -- (void)getProperty: (NSString *)property forElement: (NSXMLElement *)elm +- (void)getProperty:(NSString *)property forElement:(NSXMLElement *)elm { - [_socket send: [self createCommand: [NSString stringWithFormat: @"property_get -n \"%@\"", property]]]; + [_socket send:[self createCommand:[NSString stringWithFormat:@"property_get -n \"%@\"", property]]]; _depthFetchElement = elm; - [_socket receive: @selector(propertyReceived:)]; + [_socket receive:@selector(propertyReceived:)]; } /** * Called when a property is received. This then adds the result as children to the passed object */ -- (void)propertyReceived: (NSXMLDocument *)doc +- (void)propertyReceived:(NSXMLDocument *)doc { /* @@ -296,19 +296,19 @@ */ // we now have to detach all the children so we can insert them into another document - NSXMLElement *parent = (NSXMLElement *)[[doc rootElement] childAtIndex: 0]; + NSXMLElement *parent = (NSXMLElement *)[[doc rootElement] childAtIndex:0]; NSArray *children = [parent children]; - [parent setChildren: nil]; - [_windowController addChildren: children toNode: _depthFetchElement]; + [parent setChildren:nil]; + [_windowController addChildren:children toNode:_depthFetchElement]; _depthFetchElement = nil; } /** * Helper method to create a string command with the -i automatically tacked on */ -- (NSString *)createCommand: (NSString *)cmd +- (NSString *)createCommand:(NSString *)cmd { - return [NSString stringWithFormat: @"%@ -i %@", cmd, _session]; + return [NSString stringWithFormat:@"%@ -i %@", cmd, _session]; } @end diff --git a/Source/DebuggerWindowController.h b/Source/DebuggerWindowController.h index 9cef6d8..e5ee466 100644 --- a/Source/DebuggerWindowController.h +++ b/Source/DebuggerWindowController.h @@ -42,19 +42,19 @@ IBOutlet NSButton *_reconnectButton; } -- (id)initWithConnection: (DebuggerConnection *)cnx; +- (id)initWithConnection:(DebuggerConnection *)cnx; -- (void)setStatus: (NSString *)status; -- (void)setError: (NSString *)error; -- (void)setStack: (NSArray *)node; -- (void)setRegister: (NSXMLDocument *)reg; +- (void)setStatus:(NSString *)status; +- (void)setError:(NSString *)error; +- (void)setStack:(NSArray *)node; +- (void)setRegister:(NSXMLDocument *)reg; -- (void)addChildren: (NSArray *)children toNode: (id)node; +- (void)addChildren:(NSArray *)children toNode:(id)node; -- (IBAction)run: (id)sender; -- (IBAction)stepIn: (id)sender; -- (IBAction)stepOut: (id)sender; -- (IBAction)stepOver: (id)sender; -- (IBAction)reconnect: (id)sender; +- (IBAction)run:(id)sender; +- (IBAction)stepIn:(id)sender; +- (IBAction)stepOut:(id)sender; +- (IBAction)stepOver:(id)sender; +- (IBAction)reconnect:(id)sender; @end diff --git a/Source/DebuggerWindowController.m b/Source/DebuggerWindowController.m index d2ea2bd..38748e3 100644 --- a/Source/DebuggerWindowController.m +++ b/Source/DebuggerWindowController.m @@ -30,9 +30,9 @@ /** * Initializes the window controller and sets the connection */ -- (id)initWithConnection: (DebuggerConnection *)cnx +- (id)initWithConnection:(DebuggerConnection *)cnx { - if (self = [super initWithWindowNibName: @"Debugger"]) + if (self = [super initWithWindowNibName:@"Debugger"]) { _connection = cnx; _expandedRegisters = [[NSMutableArray alloc] init]; @@ -46,18 +46,18 @@ - (void)awakeFromNib { // set up the scroller for the source viewer - [_sourceViewer setMaxSize: NSMakeSize(FLT_MAX, FLT_MAX)]; - [[_sourceViewer textContainer] setContainerSize: NSMakeSize(FLT_MAX, FLT_MAX)]; - [[_sourceViewer textContainer] setWidthTracksTextView: NO]; - [_sourceViewer setHorizontallyResizable: YES]; - [_sourceViewerScroller setHasHorizontalScroller: YES]; + [_sourceViewer setMaxSize:NSMakeSize(FLT_MAX, FLT_MAX)]; + [[_sourceViewer textContainer] setContainerSize:NSMakeSize(FLT_MAX, FLT_MAX)]; + [[_sourceViewer textContainer] setWidthTracksTextView:NO]; + [_sourceViewer setHorizontallyResizable:YES]; + [_sourceViewerScroller setHasHorizontalScroller:YES]; [_sourceViewerScroller display]; } /** * Called when the window is going to be closed so we can clean up all of our stuff */ -- (void)windowWillClose: (NSNotification *)aNotification +- (void)windowWillClose:(NSNotification *)aNotification { [_connection windowDidClose]; } @@ -75,46 +75,46 @@ /** * Sets the status and clears any error message */ -- (void)setStatus: (NSString *)status +- (void)setStatus:(NSString *)status { - [_error setHidden: YES]; - [_status setStringValue: status]; - [[self window] setTitle: [NSString stringWithFormat: @"GDBp @ %@:%d/%@", [_connection remoteHost], [_connection port], [_connection session]]]; + [_error setHidden:YES]; + [_status setStringValue:status]; + [[self window] setTitle:[NSString stringWithFormat:@"GDBp @ %@:%d/%@", [_connection remoteHost], [_connection port], [_connection session]]]; - [_stepInButton setEnabled: NO]; - [_stepOutButton setEnabled: NO]; - [_stepOverButton setEnabled: NO]; - [_runButton setEnabled: NO]; - [_reconnectButton setEnabled: NO]; + [_stepInButton setEnabled:NO]; + [_stepOutButton setEnabled:NO]; + [_stepOverButton setEnabled:NO]; + [_runButton setEnabled:NO]; + [_reconnectButton setEnabled:NO]; if ([_connection isConnected]) { - if ([status isEqualToString: @"Starting"]) + if ([status isEqualToString:@"Starting"]) { - [_stepInButton setEnabled: YES]; - [_runButton setEnabled: YES]; + [_stepInButton setEnabled:YES]; + [_runButton setEnabled:YES]; } } else { - [_reconnectButton setEnabled: YES]; + [_reconnectButton setEnabled:YES]; } } /** * Sets the status to be "Error" and then displays the error message */ -- (void)setError: (NSString *)error +- (void)setError:(NSString *)error { - [_error setStringValue: error]; - [self setStatus: @"Error"]; - [_error setHidden: NO]; + [_error setStringValue:error]; + [self setStatus:@"Error"]; + [_error setHidden:NO]; } /** * Sets the root node element of the stacktrace */ -- (void)setStack: (NSArray *)stack +- (void)setStack:(NSArray *)stack { if (_stack != nil) { @@ -126,11 +126,11 @@ if ([_stack count] > 1) { - [_stepOutButton setEnabled: YES]; + [_stepOutButton setEnabled:YES]; } - [_stepInButton setEnabled: YES]; - [_stepOverButton setEnabled: YES]; - [_runButton setEnabled: YES]; + [_stepInButton setEnabled:YES]; + [_stepOverButton setEnabled:YES]; + [_runButton setEnabled:YES]; [self updateSourceViewer]; } @@ -138,13 +138,13 @@ /** * Sets the stack root element so that the NSOutlineView can display it */ -- (void)setRegister: (NSXMLDocument *)elm +- (void)setRegister:(NSXMLDocument *)elm { /* - [_registerController willChangeValueForKey: @"rootElement.children"]; - [_registerController unbind: @"contentArray"]; - [_registerController bind: @"contentArray" toObject: elm withKeyPath: @"rootElement.children" options: nil]; - [_registerController didChangeValueForKey: @"rootElement.children"]; + [_registerController willChangeValueForKey:@"rootElement.children"]; + [_registerController unbind:@"contentArray"]; + [_registerController bind:@"contentArray" toObject:elm withKeyPath:@"rootElement.children" options:nil]; + [_registerController didChangeValueForKey:@"rootElement.children"]; */ // XXX: Doing anything short of this will cause bindings to crash spectacularly for no reason whatsoever, and // in seemingly arbitrary places. The class that crashes is _NSKeyValueObservationInfoCreateByRemoving. @@ -153,15 +153,15 @@ // sh!t when used with NSTreeController. http://www.cocoadev.com/index.pl?NSTreeControllerBugOrDeveloperError // was the inspiration for this fix (below) but the author says that inserting does not work too well, but // that's okay for us as we just need to replace the entire thing. - [_registerController setContent: nil]; - [_registerController setContent: [[elm rootElement] children]]; + [_registerController setContent:nil]; + [_registerController setContent:[[elm rootElement] children]]; for (int i = 0; i < [_registerView numberOfRows]; i++) { - int index = [_expandedRegisters indexOfObject: [[[_registerView itemAtRow: i] observedObject] variable]]; + int index = [_expandedRegisters indexOfObject:[[[_registerView itemAtRow:i] observedObject] variable]]; if (index != NSNotFound) { - [_registerView expandItem: [_registerView itemAtRow: i]]; + [_registerView expandItem:[_registerView itemAtRow:i]]; } } } @@ -169,7 +169,7 @@ /** * Forwards the message to run script execution to the connection */ -- (IBAction)run: (id)sender +- (IBAction)run:(id)sender { [_connection run]; } @@ -177,7 +177,7 @@ /** * Tells the connection to ask the server to reconnect */ -- (IBAction)reconnect: (id)sender +- (IBAction)reconnect:(id)sender { } @@ -185,7 +185,7 @@ /** * Forwards the message to "step in" to the connection */ -- (IBAction)stepIn: (id)sender +- (IBAction)stepIn:(id)sender { [_connection stepIn]; } @@ -193,7 +193,7 @@ /** * Forwards the message to "step out" to the connection */ -- (IBAction)stepOut: (id)sender +- (IBAction)stepOut:(id)sender { [_connection stepOut]; } @@ -201,7 +201,7 @@ /** * Forwards the message to "step over" to the connection */ -- (IBAction)stepOver: (id)sender +- (IBAction)stepOver:(id)sender { [_connection stepOver]; } @@ -210,7 +210,7 @@ * NSTableView delegate method that informs the controller that the stack selection did change and that * we should update the source viewer */ -- (void)tableViewSelectionDidChange: (NSNotification *)notif +- (void)tableViewSelectionDidChange:(NSNotification *)notif { [self updateSourceViewer]; } @@ -223,80 +223,80 @@ int selection = [_stackController selectionIndex]; if (selection == NSNotFound) { - [_sourceViewer setString: @""]; + [_sourceViewer setString:@""]; return; } // get the filename and then set the text - NSString *filename = [[_stack objectAtIndex: selection] valueForKey: @"filename"]; - filename = [[NSURL URLWithString: filename] path]; - NSString *text = [NSString stringWithContentsOfFile: filename]; - [_sourceViewer setString: text]; + NSString *filename = [[_stack objectAtIndex:selection] valueForKey:@"filename"]; + filename = [[NSURL URLWithString:filename] path]; + NSString *text = [NSString stringWithContentsOfFile:filename]; + [_sourceViewer setString:text]; // go through the document until we find the NSRange for the line we want - int destination = [[[_stack objectAtIndex: selection] valueForKey: @"lineno"] intValue]; + int destination = [[[_stack objectAtIndex:selection] valueForKey:@"lineno"] intValue]; int rangeIndex = 0; for (int line = 0; line < destination; line++) { - rangeIndex = NSMaxRange([text lineRangeForRange: NSMakeRange(rangeIndex, 0)]); + rangeIndex = NSMaxRange([text lineRangeForRange:NSMakeRange(rangeIndex, 0)]); } // now get the true start/end markers for it unsigned lineStart, lineEnd; - [text getLineStart: &lineStart end: NULL contentsEnd: &lineEnd forRange: NSMakeRange(rangeIndex - 1, 0)]; + [text getLineStart:&lineStart end:NULL contentsEnd:&lineEnd forRange:NSMakeRange(rangeIndex - 1, 0)]; NSRange lineRange = NSMakeRange(lineStart, lineEnd - lineStart); // colorize it so the user knows which line we're on in the stack - [[_sourceViewer textStorage] setAttributes: [NSDictionary dictionaryWithObjects: [NSArray arrayWithObjects: [NSColor redColor], [NSColor yellowColor], nil] - forKeys: [NSArray arrayWithObjects: NSForegroundColorAttributeName, NSBackgroundColorAttributeName, nil]] - range: lineRange]; - [_sourceViewer scrollRangeToVisible: [text lineRangeForRange: NSMakeRange(lineStart, lineEnd - lineStart)]]; + [[_sourceViewer textStorage] setAttributes:[NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:[NSColor redColor], [NSColor yellowColor], nil] + forKeys:[NSArray arrayWithObjects:NSForegroundColorAttributeName, NSBackgroundColorAttributeName, nil]] + range:lineRange]; + [_sourceViewer scrollRangeToVisible:[text lineRangeForRange:NSMakeRange(lineStart, lineEnd - lineStart)]]; // make sure the font stays Monaco - [_sourceViewer setFont: [NSFont fontWithName: @"Monaco" size: 10.0]]; + [_sourceViewer setFont:[NSFont fontWithName:@"Monaco" size:10.0]]; } /** * Called whenver an item is expanded. This allows us to determine if we need to fetch deeper */ -- (void)outlineViewItemDidExpand: (NSNotification *)notif +- (void)outlineViewItemDidExpand:(NSNotification *)notif { - NSLog(@"notification expanded: %@", notif); + NSLog(@"notification expanded:%@", notif); // XXX: This very well may break because NSTreeController sends us a _NSArrayControllerTreeNode object // which is presumably private, and thus this is not a reliable method for getting the object. But // we damn well need it, so f!ck the rules and we're using it. - id notifObj = [[notif userInfo] objectForKey: @"NSObject"]; + id notifObj = [[notif userInfo] objectForKey:@"NSObject"]; NSXMLElement *obj = [notifObj observedObject]; // we're not a leaf but have no children. this must be beyond our depth, so go make us deeper if (![obj isLeaf] && [[obj children] count] < 1) { - [_connection getProperty: [[obj attributeForName: @"fullname"] stringValue] forElement: notifObj]; + [_connection getProperty:[[obj attributeForName:@"fullname"] stringValue] forElement:notifObj]; } - [_expandedRegisters addObject: [obj variable]]; + [_expandedRegisters addObject:[obj variable]]; } /** * Called when an item was collapsed. This allows us to remove it from the list of expanded items */ -- (void)outlineViewItemDidCollapse: (id)notif +- (void)outlineViewItemDidCollapse:(id)notif { - [_expandedRegisters removeObject: [[[[notif userInfo] objectForKey: @"NSObject"] observedObject] variable]]; - NSLog(@"outlineViewDidCollapse: %@", notif); + [_expandedRegisters removeObject:[[[[notif userInfo] objectForKey:@"NSObject"] observedObject] variable]]; + NSLog(@"outlineViewDidCollapse:%@", notif); } /** * Updates the register view by reinserting a given node back into the outline view */ -- (void)addChildren: (NSArray *)children toNode: (id)node +- (void)addChildren:(NSArray *)children toNode:(id)node { - NSLog(@"addChildren node: %@", node); - // XXX: this may break like in outlineViewItemDidExpand: + NSLog(@"addChildren node:%@", node); + // XXX: this may break like in outlineViewItemDidExpand: NSIndexPath *masterPath = [node indexPath]; for (int i = 0; i < [children count]; i++) { - [_registerController insertObject: [children objectAtIndex: i] atArrangedObjectIndexPath: [masterPath indexPathByAddingIndex: i]]; + [_registerController insertObject:[children objectAtIndex:i] atArrangedObjectIndexPath:[masterPath indexPathByAddingIndex:i]]; } [_registerController rearrangeObjects]; diff --git a/Source/NSXMLElementAdditions.m b/Source/NSXMLElementAdditions.m index c9451ed..3010a12 100644 --- a/Source/NSXMLElementAdditions.m +++ b/Source/NSXMLElementAdditions.m @@ -24,7 +24,7 @@ */ - (NSString *)variable { - return [[self attributeForName: @"name"] stringValue]; + return [[self attributeForName:@"name"] stringValue]; } /** @@ -32,7 +32,7 @@ */ - (BOOL)isLeaf { - return ([[[self attributeForName: @"children"] stringValue] intValue] == 0); + return ([[[self attributeForName:@"children"] stringValue] intValue] == 0); } /** @@ -47,10 +47,10 @@ } // base64 encoded data - if ([[[self attributeForName: @"encoding"] stringValue] isEqualToString: @"base64"]) + if ([[[self attributeForName:@"encoding"] stringValue] isEqualToString:@"base64"]) { - char *str = (char *)[[self stringValue] cStringUsingEncoding: NSASCIIStringEncoding]; - int strlen = [[self stringValue] lengthOfBytesUsingEncoding: NSASCIIStringEncoding]; + char *str = (char *)[[self stringValue] cStringUsingEncoding:NSASCIIStringEncoding]; + int strlen = [[self stringValue] lengthOfBytesUsingEncoding:NSASCIIStringEncoding]; char *data; size_t datalen; @@ -60,7 +60,7 @@ NSLog(@"error in converting %@ to base64", self); } - return [NSString stringWithCString: data length: datalen]; + return [NSString stringWithCString:data length:datalen]; } // just a normal string @@ -72,7 +72,7 @@ */ - (NSString *)type { - return [[self attributeForName: @"type"] stringValue]; + return [[self attributeForName:@"type"] stringValue]; } @end diff --git a/Source/SocketWrapper.h b/Source/SocketWrapper.h index da3a8e7..ae5116c 100644 --- a/Source/SocketWrapper.h +++ b/Source/SocketWrapper.h @@ -24,14 +24,14 @@ id _delegate; } -- (id)initWithPort: (int)port; +- (id)initWithPort:(int)port; - (id)delegate; -- (void)setDelegate: (id)delegate; +- (void)setDelegate:(id)delegate; - (void)connect; -- (void)receive: (SEL)selector; -- (void)send: (NSString *)data; +- (void)receive:(SEL)selector; +- (void)send:(NSString *)data; - (NSString *)remoteHost; @@ -40,14 +40,14 @@ @interface NSObject (SocketWrapperDelegate) // error -- (void)errorEncountered: (NSError *)error; +- (void)errorEncountered:(NSError *)error; // connection components - (void)socketDidBind; - (void)socketDidAccept; // data handlers -- (void)dataReceived: (NSData *)response deliverTo: (SEL)selector; -- (void)dataSent: (NSString *)sent; +- (void)dataReceived:(NSData *)response deliverTo:(SEL)selector; +- (void)dataSent:(NSString *)sent; @end diff --git a/Source/SocketWrapper.m b/Source/SocketWrapper.m index 5e80c25..097e719 100644 --- a/Source/SocketWrapper.m +++ b/Source/SocketWrapper.m @@ -30,9 +30,9 @@ NSString *NsockDataSent = @"SocketWrapper_DataSent"; @interface SocketWrapper (Private) -- (void)connect: (id)obj; -- (void)postNotification: (NSString *)name withObject: (id)obj; -- (void)postNotification: (NSString *)name withObject: (id)obj withDict: (NSMutableDictionary *)dict; +- (void)connect:(id)obj; +- (void)postNotification:(NSString *)name withObject:(id)obj; +- (void)postNotification:(NSString *)name withObject:(id)obj withDict:(NSMutableDictionary *)dict; @end @@ -41,7 +41,7 @@ NSString *NsockDataSent = @"SocketWrapper_DataSent"; /** * Initializes the socket wrapper with a host and port */ -- (id)initWithPort: (int)port +- (id)initWithPort:(int)port { if (self = [super init]) { @@ -50,7 +50,7 @@ NSString *NsockDataSent = @"SocketWrapper_DataSent"; // the delegate notifications work funky because of threads. we register ourselves as the // observer and then pass up the messages that are actually from this object (as we can't only observe self due to threads) // to our delegate, and not to all delegates - [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(sendMessageToDelegate:) name: nil object: nil]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(sendMessageToDelegate:) name:nil object:nil]; } return self; } @@ -60,7 +60,7 @@ NSString *NsockDataSent = @"SocketWrapper_DataSent"; */ - (void)dealloc { - [[NSNotificationCenter defaultCenter] removeObserver: self]; + [[NSNotificationCenter defaultCenter] removeObserver:self]; close(_socket); [super dealloc]; @@ -77,7 +77,7 @@ NSString *NsockDataSent = @"SocketWrapper_DataSent"; /** * Sets the delegate but does *not* retain it */ -- (void)setDelegate: (id)delegate +- (void)setDelegate:(id)delegate { _delegate = delegate; } @@ -92,12 +92,12 @@ NSString *NsockDataSent = @"SocketWrapper_DataSent"; if (getpeername(_socket, (struct sockaddr *)&addr, &addrLength) < 0) { - [self postNotification: NsockError withObject: [NSError errorWithDomain: @"Could not get remote hostname." code: -1 userInfo: nil]]; + [self postNotification:NsockError withObject:[NSError errorWithDomain:@"Could not get remote hostname." code:-1 userInfo:nil]]; } char *name = inet_ntoa(addr.sin_addr); - return [NSString stringWithUTF8String: name]; + return [NSString stringWithUTF8String:name]; } /** @@ -106,10 +106,10 @@ NSString *NsockDataSent = @"SocketWrapper_DataSent"; * then the notification was sent from the same object in another thread and it passes the message along to the object's * delegate. Complicated enough? */ -- (void)sendMessageToDelegate: (NSNotification *)notif +- (void)sendMessageToDelegate:(NSNotification *)notif { // this isn't us, so there's no point in continuing - if ([[notif userInfo] objectForKey: sockNotificationDebuggerConnection] != _delegate) + if ([[notif userInfo] objectForKey:sockNotificationDebuggerConnection] != _delegate) { return; } @@ -122,15 +122,15 @@ NSString *NsockDataSent = @"SocketWrapper_DataSent"; } else if (name == NsockDataReceived) { - [_delegate dataReceived: [notif object] deliverTo: NSSelectorFromString([[notif userInfo] objectForKey: sockNotificationReceiver])]; + [_delegate dataReceived:[notif object] deliverTo:NSSelectorFromString([[notif userInfo] objectForKey:sockNotificationReceiver])]; } else if (name == NsockDataSent) { - [_delegate dataSent: [notif object]]; + [_delegate dataSent:[notif object]]; } else if (name == NsockError) { - [_delegate errorEncountered: [NSError errorWithDomain: [notif object] code: -1 userInfo: nil]]; + [_delegate errorEncountered:[NSError errorWithDomain:[notif object] code:-1 userInfo:nil]]; } } @@ -140,13 +140,13 @@ NSString *NsockDataSent = @"SocketWrapper_DataSent"; */ - (void)connect { - [NSThread detachNewThreadSelector: @selector(connect:) toTarget: self withObject: nil]; + [NSThread detachNewThreadSelector:@selector(connect:) toTarget:self withObject:nil]; } /** * This does the actual dirty work (in a separate thread) of connecting to a socket */ -- (void)connect: (id)obj +- (void)connect:(id)obj { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; @@ -171,7 +171,7 @@ NSString *NsockDataSent = @"SocketWrapper_DataSent"; if (tries >= 5) { close(socketOpen); - [self postNotification: NsockError withObject: @"Could not bind to socket"]; + [self postNotification:NsockError withObject:@"Could not bind to socket"]; return; } NSLog(@"couldn't bind to the socket... trying again in 5"); @@ -182,7 +182,7 @@ NSString *NsockDataSent = @"SocketWrapper_DataSent"; // now we just have to keep our ears open if (listen(socketOpen, 0) == -1) { - [self postNotification: NsockError withObject: @"Could not use bound socket for listening"]; + [self postNotification:NsockError withObject:@"Could not use bound socket for listening"]; } // accept a connection @@ -192,14 +192,14 @@ NSString *NsockDataSent = @"SocketWrapper_DataSent"; if (_socket < 0) { close(socketOpen); - [self postNotification: NsockError withObject: @"Client failed to accept remote socket"]; + [self postNotification:NsockError withObject:@"Client failed to accept remote socket"]; return; } // we're done listening now that we have a connection close(socketOpen); - [self postNotification: NsockDidAccept withObject: nil]; + [self postNotification:NsockDidAccept withObject:nil]; [pool release]; } @@ -212,7 +212,7 @@ NSString *NsockDataSent = @"SocketWrapper_DataSent"; * * The paramater is an optional selector which the delegate method dataReceived:deliverTo: should forward to */ -- (void)receive: (SEL)selector +- (void)receive:(SEL)selector { // create a buffer char buffer[1024]; @@ -245,7 +245,7 @@ NSString *NsockDataSent = @"SocketWrapper_DataSent"; memmove(packet, &buffer[i], recvd - i); // convert bytes to NSData - [data appendBytes: packet length: recvd - i]; + [data appendBytes:packet length:recvd - i]; // check if we have a partial packet if (length + i > sizeof(buffer)) @@ -255,65 +255,65 @@ NSString *NsockDataSent = @"SocketWrapper_DataSent"; int latest = recv(_socket, &buffer, sizeof(buffer), 0); if (latest < 1) { - [self postNotification: NsockError withObject: @"Socket closed or could not be read"]; + [self postNotification:NsockError withObject:@"Socket closed or could not be read"]; return; } - [data appendBytes: buffer length: latest]; + [data appendBytes:buffer length:latest]; recvd += latest; } } - //NSLog(@"data = %@", [[[NSString alloc] initWithData: data encoding: NSUTF8StringEncoding] autorelease]); + //NSLog(@"data = %@", [[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding] autorelease]); if (selector != nil) { - [self postNotification: NsockDataReceived - withObject: data - withDict: [NSMutableDictionary dictionaryWithObject: NSStringFromSelector(selector) forKey: sockNotificationReceiver]]; + [self postNotification:NsockDataReceived + withObject:data + withDict:[NSMutableDictionary dictionaryWithObject:NSStringFromSelector(selector) forKey:sockNotificationReceiver]]; } else { - [self postNotification: NsockDataReceived withObject: data]; + [self postNotification:NsockDataReceived withObject:data]; } } /** * Sends a given NSString over the socket */ -- (void)send: (NSString *)data +- (void)send:(NSString *)data { - data = [NSString stringWithFormat: @"%@\0", data]; + data = [NSString stringWithFormat:@"%@\0", data]; int sent = send(_socket, [data UTF8String], [data length], 0); if (sent < 0) { - [self postNotification: NsockError withObject: @"Failed to write data to socket"]; + [self postNotification:NsockError withObject:@"Failed to write data to socket"]; return; } if (sent < [data length]) { // TODO - do we really need to worry about partial sends with the lenght of our commands? - NSLog(@"FAIL: only partial packet was sent; sent %d bytes", sent); + NSLog(@"FAIL:only partial packet was sent; sent %d bytes", sent); } - [self postNotification: NsockDataSent withObject: [data substringToIndex: sent]]; + [self postNotification:NsockDataSent withObject:[data substringToIndex:sent]]; } /** * Helper method to simply post a notification to the default notification center with a given name and object */ -- (void)postNotification: (NSString *)name withObject: (id)obj +- (void)postNotification:(NSString *)name withObject:(id)obj { - [self postNotification: name withObject: obj withDict: [NSMutableDictionary dictionary]]; + [self postNotification:name withObject:obj withDict:[NSMutableDictionary dictionary]]; } /** * Another helper method to aid in the posting of notifications. This one should be used if you have additional * things for the userInfo. This automatically adds the sockNotificationDebuggerConnection key. */ -- (void)postNotification: (NSString *)name withObject: (id)obj withDict: (NSMutableDictionary *)dict +- (void)postNotification:(NSString *)name withObject:(id)obj withDict:(NSMutableDictionary *)dict { - [dict setValue: _delegate forKey: sockNotificationDebuggerConnection]; - [[NSNotificationCenter defaultCenter] postNotificationName: name object: obj userInfo: dict]; + [dict setValue:_delegate forKey:sockNotificationDebuggerConnection]; + [[NSNotificationCenter defaultCenter] postNotificationName:name object:obj userInfo:dict]; } @end -- 2.22.5