Robert Sesek [Wed, 9 Jan 2008 09:22:09 +0000 (01:22 -0800)]
Use an NSToolbar for the debugger controls instead of NSButtons
* English.lproj/Debugger.nib: Removed because the designable NSToolbar requires an XIB
* English.lproj/Debugger.xib: Coverted old NIB
* MacGDBp.xcodeproj: Project updates for the nib->xib conversion
* Source/DebuggerWindowController.h: Changing the buttons to be of type NSButton to NSToolbarItem
Robert Sesek [Wed, 9 Jan 2008 09:05:22 +0000 (01:05 -0800)]
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
Robert Sesek [Sun, 6 Jan 2008 01:14:00 +0000 (17:14 -0800)]
The registers now have memory and stay expanded
* Source/DebuggerWindowController.h: expandedRegisters is now an NSMutableSet
* Source/DebuggerWindowController.m:
([DebuggerWindowController initWithPort:session:]): Change allocated type of expandedRegisters
([DebuggerWindowController setRegister:]): Finished logic for expanding remembered registers
([DebuggerWindowController outlineViewItemDidExpand:]): Use the "fullname" attribute to get the full variable name so scope is accounted for in expanded memory
([DebuggerWindowController outlineViewItemDidCollapse:]): ditto
* Source/NSXMLElementAdditions.h:
* Source/NSXMLElementAdditions.m:
([NSXMLElement(NSXMLElementAdditions) fullname]): New method
Robert Sesek [Sun, 6 Jan 2008 00:50:56 +0000 (16:50 -0800)]
We now properly fetch registers who need to have more data attached
* Source/DebuggerWindowController.m:
([DebuggerWindowController addChildren:toNode:]): Don't attach nodes through the controller, but rather through the XMLElement (via the node's -[representedObject])
Robert Sesek [Sat, 5 Jan 2008 23:55:52 +0000 (15:55 -0800)]
Removing the notification-delegate system that SocketWrapper used because it wasn't necessary because the only action that can block the UI is -[connect]
Changes:
-[SocketWrapper receive] now returns the data directly, cleaning up the DebuggerConnection class a lot
-[SocketWrapper send] returns BOOL depending on the success of the send
Robert Sesek [Sat, 5 Jan 2008 23:09:16 +0000 (15:09 -0800)]
In SocketWraper, don't use the notification posting system to send errors to the delegate, instead just use performSelectorOnMainThread:withObject:waitUntilDone: on the delegate object. Also, -[NSObject(SocketWrapperDelegate) errorEncountered:] now just takes a string.
Robert Sesek [Sat, 5 Jan 2008 22:54:50 +0000 (14:54 -0800)]
Synthesize new properties for class cross-referencing and SocketWrapper now init's with a DebuggerConnection
* Source/DebuggerConnection.h: New property for the DebuggerWindowController
* Source/DebuggerConnection.m: Synthesize new property and changed SocketWrapper's initializer
* Source/DebuggerWindowController.h: New property for DebuggerConnection
* Source/DebuggerWindowController.m: ditto
* Source/SocketWrapper.h: The init method now takes a DebuggerConnection (and stores it) instead of a port
* Source/SocketWrapper.m: ditto
Robert Sesek [Sat, 5 Jan 2008 22:07:07 +0000 (14:07 -0800)]
Finish the refactoring in the previous commit and now the window title is properly set
* Source/DebuggerConnection.h: Removed the definition for -[windowDidClose]
* Source/DebuggerConnection.m:
([DebuggerConnection initWithWindowController:port:session:]): Don't set the status in this method because the nib isn't awake yet
* Source/DebuggerWindowController.m:
([DebuggerWindowController initWithPort:session:]): Make self key and front
([DebuggerWindowController awakeFromNib]): Set the default status to be "Connecting"
([DebuggerWindowController windowWillClose:]): Removed
Robert Sesek [Sat, 5 Jan 2008 21:54:55 +0000 (13:54 -0800)]
We no longer use DebuggerConnection to manage the DebuggerWindowController, but now it's vice versa
Benefits:
- There was a problem that when we quit we would crash, because on window closing, the WindowController would tell the connection to shutdown, but because AppDelegate cleaned up before the WindowController, it would crash when sending the message.
- An array of connections no longer needs to be managed because the WindowController stores all the pointers, so when it closes things are deallocated properly
Robert Sesek [Fri, 4 Jan 2008 10:24:40 +0000 (02:24 -0800)]
We can't have an instance variable match the name of a C function because then we don't compile
* Source/SocketWrapper.h: ivar socket is now sock
* Source/SocketWrapper.m:
([SocketWrapper connect:]): We're now happy because socket() can be called without ambiguity between self->socket
Robert Sesek [Sat, 25 Aug 2007 05:36:12 +0000 (22:36 -0700)]
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"
Robert Sesek [Sat, 11 Aug 2007 23:21:03 +0000 (16:21 -0700)]
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
Robert Sesek [Sat, 11 Aug 2007 22:52:36 +0000 (15:52 -0700)]
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
Robert Sesek [Sat, 11 Aug 2007 19:54:55 +0000 (12:54 -0700)]
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
Robert Sesek [Mon, 6 Aug 2007 16:57:57 +0000 (09:57 -0700)]
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
Robert Sesek [Sun, 5 Aug 2007 21:04:34 +0000 (14:04 -0700)]
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
Robert Sesek [Sun, 5 Aug 2007 20:20:34 +0000 (13:20 -0700)]
Casting to remove a warning
* Source/DebuggerConnection.m:
([DebuggerConnection propertyRecieved:]): Casting parent to be an NSXMLElement because childAtIndex returns an NSXMLNode
Robert Sesek [Sun, 5 Aug 2007 19:55:34 +0000 (12:55 -0700)]
Making the buttons change their enabled state depending on where we are in debugging
* Source/DebuggerWindowController.m:
([DebuggerWindowController setStatus:]): Disable all the buttons and reenable "step in" and "run" if we're connected
([DebuggerWindowController setStack:]): Enable the step in/out/over and run buttons appropriately
Robert Sesek [Sun, 5 Aug 2007 08:06:15 +0000 (01:06 -0700)]
The depth fetching of child nodes now works and are properly inserted into the register tree
* Source/DebuggerConnection.h: Changing _depthFetchElement to type id for the mysterious _NSArrayControllerTreeNode type
* Source/DebuggerConnection.m:
([DebuggerConnection propertyReceived:]): Get all the children from the property and then detach them so they can be injected into the tree
* Source/DebuggerWindowController.h: Added a _registerController outlet
* Source/DebuggerWindowController.m:
([DebuggerWindowController addChildren:toNode:]): New method that adds detached children to the specified _NSArrayControllerTreeNod using it's index set
([DebuggerWindowController outlineViewItemDidExpand:]): Change from using an NSXMLElement to the internal TreeNode
* English.lproj/Debugger.nib: Hook up the RegisterController to the outlet
Robert Sesek [Sun, 5 Aug 2007 07:24:05 +0000 (00:24 -0700)]
We now get the property when we go past the currently-fetched depth but we do not have the display updating yet
* Source/DebuggerConnection.h: New ivar _depthFetchElement to record the element that requested more registers
* Source/DebuggerConnection.m:
([DebuggerConnection dataReceived:deliverTo:]): Removed an NSLog()
([DebuggerConnection getProperty:forElement:]): New method that gets a specified property for a specific element
([DebuggerConnection propertyReceived:]): Recived data delivery handler for getProperty:forElement:
* Source/DebuggerWindowController.m:
([DebuggerWindowController outlineViewItemDidExpand:]): Call the getProperty:forElement: method to get deeper properties
* English.lproj/Debugger.nib: Set the delegate of the NSOutlineView to be the first responder
Robert Sesek [Sun, 5 Aug 2007 06:46:07 +0000 (23:46 -0700)]
Moving the depth checker from NSXMLElementAdditions.m to be in DebuggerWindowController
* Source/NSXMLElementAdditions.m:
([NSXMLElement isLeaf]): Moved the checking to see if we need to fetch more
* Source/NSXMLElementAdditions.h: New header file for linking
* Source/DebuggerWindowController.m:
([DebuggerWindowController outlineViewItemDidExpand:]): New method that handles the depth checking
* MacGDBp.xcodeproj: Project changes for NSXMLElementAdditions.h
Robert Sesek [Sun, 5 Aug 2007 05:49:09 +0000 (22:49 -0700)]
Adding support for base64 encoded string values
* Source/base64.c|h: New file from external source
* Source/NSXMLElementAdditions.m:
([NSXMLElement value]): Decode data using the new base64 functions
* MacGDBp.xcodeproj: Adding the base64.c|h files to the project
Robert Sesek [Sun, 5 Aug 2007 03:10:28 +0000 (20:10 -0700)]
In NSXMLElementAdditions adding recognizers to the code for certain special value types
* Source/NSXMLElementAdditions.m:
([NSXMLElement value]): If the item is a leaf, only display an elipsis, and if it's base64 encoded the decode.. er print that it's base64'd
Robert Sesek [Sun, 5 Aug 2007 02:58:27 +0000 (19:58 -0700)]
Removing some NSLog()s and in isLeaf: we now determine if a non-leaf node has it's children
* Source/NSXMLElementAdditions.m:
([NSXMLElement variable]): Remove a NSLog()
([NSXMLElement isLeaf]): If the element is not a leaf, but does not have children, then find the depth we should request more about the property at
Robert Sesek [Sun, 5 Aug 2007 01:22:53 +0000 (18:22 -0700)]
Trying to get the register viewer to work
* Source/NSXMLElementAdditions.m: New category that provides access to attributes that NSTreeController can't access
* MacGDBp.xcodeproj: Added NSXMLElementAdditions.m
* Source/DebuggerConnection.m:
([DebuggerConnection dataReceived:deliverTo:]): Print out the data we're receiving to make debugging easier
([DebuggerConnection updateStackTraceAndRegisters:]): Send the context_get command and receive the data
([DebuggerConnection registerReceived:]): New method to handle the received register packet
* Source/DebuggerWindowController.m|h: Added _register and a setter for it
([DebuggerWindowController setRegister:]): New method
* English.lproj/Debugger.nib: Added a tree controller and tried to hook it up properly
Robert Sesek [Sat, 4 Aug 2007 22:29:39 +0000 (15:29 -0700)]
Fixing the updateSourceViewer function to not depend on -[NSArrayController selection] which is unreliable in returning the right proxy object
* Source/DebuggerWindowController.h: Remove _currentFile as it's not really needed
* Source/DebuggerWindowController.m:
([DebuggerWindowController updateSourceViewer]): Remove the dependency on [NSArrayController selection] and don't bother checking with _currentFile anymore
Robert Sesek [Sat, 4 Aug 2007 21:33:59 +0000 (14:33 -0700)]
Styling the NSTextView source viewer to be a fixed-width font and to have a horizontal scroll bar
* Enblish.lproj/Debugger.nib: Adding an outlet for the NSScrollView and setting some NSTextView options
* Source/DebuggerController.m:
([DebuggerWindowController awakeFromNib]): New method to set up the scrolling system for the source viewer
([DebuggerWindowController updateSourceViewer]): Set the string to "" if there is no selected file, and make the font Monaco
Robert Sesek [Sat, 4 Aug 2007 20:26:02 +0000 (13:26 -0700)]
Starting to implement the source viewer pane
* Source/DebuggerWindowController.h: Adding outlets for StackController, _currentFile, and _sourceViewer
* Source/DebuggerWindowController.m:
([DebuggerWindowController tableViewSelectionDidChange:]): Added delegate notification for when the selection of the tableview changes to update the source viewer
([DebuggerWindowController updateSourceViewer]): New method to refresh the source viewer display
* English.lproj/Debugger.nib: Hooking up the new outlets
Robert Sesek [Sat, 4 Aug 2007 09:14:05 +0000 (02:14 -0700)]
Cleaning up our use of private methods: Moving all private methods into class categories in the .m file, and removing the _ prefix as it is "reserved" for Apple (according to their guidelines).
Robert Sesek [Sat, 4 Aug 2007 08:47:50 +0000 (01:47 -0700)]
Hooking up "Step Over" and "Step Out" buttons
* Source/DebuggerConnection.m|h:
([DebuggerConnection stepOut]): New method
([DebuggerConnection stepOver]): New method
* Source/DebuggerWindowController.m|h:
([DebuggerWindowController stepOut]): New method
([DebuggerWindowController stepOver]): New method
* English.lproj/Debugger.nib: Hooking up the two buttons to the new actions in DebuggerWindowController
Robert Sesek [Sat, 4 Aug 2007 08:37:19 +0000 (01:37 -0700)]
Instead of data received being an NSString, have it be NSData because converting to NSString was actually causing problems and NSXMLDocument can take in NSData just fine
* Source/DebuggerConnection.m: Making all of the delivery functions use NSData not NSString
([DebuggerConnection _handshake:])
([DebuggerConnection _updateStatus:])
([DebuggerConnection _stackReceived:])
* Source/SocketWrapper.m|h: ditto
([SocketWrapper dataReceived:deliverTo:]): Now uses NSData
([SocketWrapper receive:]): Save ourselves some trouble and don't convert the data to NSString
Robert Sesek [Sat, 4 Aug 2007 07:50:45 +0000 (00:50 -0700)]
Instead of directly calling stack_get, get the depth first and then call the maximum depth
* Source/DebuggerConnection.m:
([DebuggerConnection updateStackTraceAndRegisters]): Call stack_depth which in turn calls stack_get
([DebuggerConnection _stackDepthReceived:]): Receives the depth of the stack and then asks for the stack at that depth
Robert Sesek [Sat, 4 Aug 2007 07:38:07 +0000 (00:38 -0700)]
Adding the sent data as the parameter to the dataSent delegate method
* Source/DebuggerConnection.m:
([DebuggerConnection dataSent:]): Print the data sent with the new paramater
* Source/SocketWrapper.m|h: Added a new parameter to dataSent: delegate method which contains the sent data
([SocketWrapper dataSent:])
([SocketWrapper _sendMessageToDelegate:])
([SocketWrapper send:])
Robert Sesek [Sat, 4 Aug 2007 07:08:38 +0000 (00:08 -0700)]
Implementing a buggy stack trace viewer.
* Source/DebuggerConnection.m:
([DebuggerConnection _stackReceived:]): New method, that is probably leaky, that gets all the attributes for a stack trace and dictionary-izes and array-izes them
* Source/DebuggerWindowController.m|h: Added a _stack ivar and then an appropriate setter
([DebuggerWindowController setStack:]): New method
* English.lproj/Debugger.nib: Adding a binding to _stack to display the stacktrace
Robert Sesek [Fri, 3 Aug 2007 23:59:26 +0000 (16:59 -0700)]
Adding a method to handle getting the stack trace
* Source/DebuggerConnection.m|h:
([DebuggerConnection updateStackTraceAndRegisters]): New method that calls stack_get and eventually context_get
([DebuggerConnection _stackReceived:]): Called when the stack is fully received
Robert Sesek [Fri, 3 Aug 2007 23:49:06 +0000 (16:49 -0700)]
Implementing the "Step In" command
* Source/DebuggerWindowController.m|h:
([DebuggerWindowController stepIn:]): New method to forward user action to the DebuggerConnection
* Source/DebuggerConnection.m|h:
([DebuggerConnection stepIn]): New method to tell the debugger to step in
* English.lproj/Debugger.nib: Hooking up the "step into" button
Robert Sesek [Fri, 3 Aug 2007 23:11:52 +0000 (16:11 -0700)]
Adding functionality to get the IP address of the remote host and then using it in the title
* Source/DebuggerConnection.m|h: Added a _connected ivar to check and see whether or not the connection has been established
([DebuggerConnection remoteHost]): New function that returns the name of the remote host
* Source/DebuggerConnection.m:
([DebuggerConnection initWithPort:]): Do not set the window title anymore
([DebuggerConnection setStatus:]): Set the window title upon status updates
* Source/SocketWrapper.m|h:
([SocketWrapper remoteHost]): New method that gets the remote host's IP address
Robert Sesek [Fri, 3 Aug 2007 22:02:30 +0000 (15:02 -0700)]
Adding support for the "run" command and acutally using the session name
* Source/DebuggerConnection.m|h:
([DebuggerConnection run]): New method that tells the script to continue running
([DebuggerConnection refreshStatus]): New method that sends the status command and then updates the display
([DebuggerConnection handshake:]): Renamed to _handshake
([DebuggerConnection updateStatus:]): Renamed to _updateStatus
([DebuggerConnection _createCommand:]): New method. Creates a new packet to send to the server with the session information tacked on
* Source/DebuggerWindowController.m|h:
([DebuggerWindowController run:]): New method to forward UI command to the DebuggerConnection