From e774bb91ccfa8ef41d272ac94fecf23d9adcdef2 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Mon, 29 Mar 2010 13:13:52 -0400 Subject: [PATCH] Create a LoggingController that shows all the commands sent and received. This will replace the TransportDebug variable. This first pass just adds very basic support for this functionality. The view still needs some work. --- English.lproj/Log.xib | 1863 +++++++++++++++++++++++++++++ English.lproj/MainMenu.xib | 770 ++++++++++-- MacGDBp.xcodeproj/project.pbxproj | 18 + Source/AppDelegate.h | 10 +- Source/AppDelegate.m | 16 +- Source/DebuggerConnection.h | 4 +- Source/DebuggerConnection.m | 19 +- Source/DebuggerController.m | 1 + Source/LoggingController.h | 78 ++ Source/LoggingController.m | 85 ++ 10 files changed, 2738 insertions(+), 126 deletions(-) create mode 100644 English.lproj/Log.xib create mode 100644 Source/LoggingController.h create mode 100644 Source/LoggingController.m diff --git a/English.lproj/Log.xib b/English.lproj/Log.xib new file mode 100644 index 0000000..b889944 --- /dev/null +++ b/English.lproj/Log.xib @@ -0,0 +1,1863 @@ + + + + 1050 + 10C540 + 740 + 1038.25 + 458.00 + + com.apple.InterfaceBuilder.CocoaPlugin + 740 + + + YES + + + + YES + com.apple.InterfaceBuilder.CocoaPlugin + + + YES + + YES + + + YES + + + + YES + + LoggingController + + + FirstResponder + + + NSApplication + + + 15 + 2 + {{196, 23}, {663, 487}} + 544735232 + Connection Log + NSWindow + + {1.79769e+308, 1.79769e+308} + + + 256 + + YES + + + 274 + + YES + + + 274 + + YES + + + 2304 + + YES + + + 256 + {663, 153} + + YES + + + 256 + {663, 17} + + + + + + -2147483392 + {{649, 0}, {16, 17}} + + + + YES + + 64 + 10 + 3.4028234663852886e+38 + + 75628096 + 2048 + Dir. + + LucidaGrande + 11 + 3100 + + + 6 + System + headerColor + + 3 + MQA + + + + 6 + System + headerTextColor + + 3 + MAA + + + + + 337772096 + 133120 + Text Cell + + + + 6 + System + controlBackgroundColor + + 3 + MC42NjY2NjY2NjY3AA + + + + 6 + System + controlTextColor + + + + 3 + YES + YES + + + + 49 + 40 + 1000 + + 75628096 + 2048 + TXr + + + 3 + MC4zMzMzMzI5ODU2AA + + + + + 337772096 + 133120 + Text Cell + + + + + + 3 + YES + YES + + + + 40 + 40 + 1000 + + 75628096 + 2048 + TXw + + + + + + 337772096 + 133120 + Text Cell + + + + + + 3 + YES + YES + + + + 287 + 10 + 3.4028234663852886e+38 + + 75628096 + 2048 + Contents + + + + + + 337772096 + 133120 + Text Cell + + + + + + 3 + YES + YES + + + + 208 + 10 + 3.4028234663852886e+38 + + 75628096 + 2048 + Error + + + + + + 337772096 + 133120 + Text Cell + + + + + + 3 + YES + YES + + + + 3 + 2 + + + 6 + System + gridColor + + 3 + MC41AA + + + 14 + -692060160 + + + LogList + 4 + 15 + 0 + YES + 0 + + + {{1, 17}, {663, 153}} + + + + + 4 + + + + -2147483392 + {{649, 17}, {15, 208}} + + + _doScroller: + 0.93273542600896864 + + + + -2147483392 + {{1, 225}, {663, 15}} + + 1 + + _doScroller: + 1 + 0.99251497005988021 + + + + 2304 + + YES + + + {{1, 0}, {663, 17}} + + + + + 4 + + + + {665, 171} + + + 562 + + + + + + QSAAAEEgAABBgAAAQYAAAA + + + + 268 + + YES + + + 268 + {{92, 286}, {249, 17}} + + YES + + 68288064 + 272630784 + Label + + LucidaGrande + 13 + 1044 + + + + 6 + System + controlColor + + + + + + + + 265 + {{553, 287}, {18, 17}} + + YES + + 68288064 + 138413056 + / + + + + + + + + + 265 + {{579, 286}, {67, 17}} + + YES + + 68288064 + 138413056 + Label + + + + + + + + + 290 + {{17, 20}, {629, 53}} + + YES + + 67239424 + 272629760 + Multiline Label + + LucidaGrande + 13 + 16 + + + + + 1 + MSAwIDAAA + + + + + + 274 + + YES + + + 2304 + + YES + + + 2322 + + YES + + YES + Apple HTML pasteboard type + Apple PDF pasteboard type + Apple PICT pasteboard type + Apple PNG pasteboard type + Apple URL pasteboard type + CorePasteboardFlavorType 0x6D6F6F76 + NSColor pasteboard type + NSFilenamesPboardType + NSStringPboardType + NeXT Encapsulated PostScript v1.2 pasteboard type + NeXT RTFD pasteboard type + NeXT Rich Text Format v1.0 pasteboard type + NeXT TIFF v4.0 pasteboard type + NeXT font pasteboard type + NeXT ruler pasteboard type + WebURLsWithTitlesPboardType + public.url + + + {606, 28} + + + + + + + + + + + YES + + + 134 + + + + 606 + 1 + + + 12263 + 0 + + + + YES + + YES + NSBackgroundColor + NSColor + + + YES + + 6 + System + selectedTextBackgroundColor + + + + 6 + System + selectedTextColor + + + + + + + YES + + YES + NSColor + NSCursor + NSUnderline + + + YES + + 1 + MCAwIDEAA + + + {8, -8} + 13 + + + + + + + 6 + {606, 1e+07} + {223, 27} + + + + {{1, 1}, {606, 195}} + + + + + + {4, -5} + 1 + + 4 + + + + 256 + {{607, 1}, {15, 195}} + + + _doScroller: + 0.9642857142857143 + 0.85256409645080566 + + + + -2147483392 + {{-100, -100}, {87, 18}} + + 1 + + _doScroller: + 1 + 0.94565218687057495 + + + {{20, 81}, {623, 197}} + + + 18 + + + + + + + 265 + {{476, 286}, {67, 17}} + + YES + + 68288064 + 138413056 + Label + + + + + + + + + 265 + {{343, 286}, {131, 17}} + + YES + + 68288064 + 272630784 + Transaction ID s/r: + + LucidaGrande-Bold + 13 + 16 + + + + + + + + + 268 + {{17, 286}, {73, 17}} + + YES + + 68288064 + 272630784 + Direction: + + + + + + + + {{0, 181}, {665, 307}} + + NSView + + + {{-1, 0}, {665, 488}} + + 3 + + + {663, 487} + + + {{0, 0}, {1680, 1028}} + {1.79769e+308, 1.79769e+308} + ConnectionLog + + + + YES + direction + lastReadTransactionID + lastWrittenTransactionID + contents + error + directionName + fontColor + + LogEntry + YES + + YES + YES + YES + YES + YES + YES + + + + + YES + + + window + + + + 22 + + + + value: arrangedObjects.lastReadTransactionID + + + + + + value: arrangedObjects.lastReadTransactionID + value + arrangedObjects.lastReadTransactionID + 2 + + + 32 + + + + value: arrangedObjects.lastWrittenTransactionID + + + + + + value: arrangedObjects.lastWrittenTransactionID + value + arrangedObjects.lastWrittenTransactionID + 2 + + + 33 + + + + value: arrangedObjects.contents + + + + + + value: arrangedObjects.contents + value + arrangedObjects.contents + 2 + + + 34 + + + + value: arrangedObjects.error + + + + + + value: arrangedObjects.error + value + arrangedObjects.error + 2 + + + 35 + + + + value: selection.error + + + + + + value: selection.error + value + selection.error + + NSNullPlaceholder + No Error + + 2 + + + 56 + + + + attributedString: selection.contents + + + + + + attributedString: selection.contents + attributedString + selection.contents + 2 + + + 58 + + + + value: selection.lastWrittenTransactionID + + + + + + value: selection.lastWrittenTransactionID + value + selection.lastWrittenTransactionID + 2 + + + 84 + + + + value: selection.lastReadTransactionID + + + + + + value: selection.lastReadTransactionID + value + selection.lastReadTransactionID + 2 + + + 85 + + + + contentArray: logEntries + + + + + + contentArray: logEntries + contentArray + logEntries + 2 + + + 87 + + + + value: arrangedObjects.directionName + + + + + + value: arrangedObjects.directionName + value + arrangedObjects.directionName + 2 + + + 88 + + + + value: selection.directionName + + + + + + value: selection.directionName + value + selection.directionName + 2 + + + 92 + + + + logEntriesController_ + + + + 96 + + + + textColor: selection.fontColor + + + + + + textColor: selection.fontColor + textColor + selection.fontColor + 2 + + + 105 + + + + + YES + + 0 + + + + + + -2 + + + File's Owner + + + -1 + + + First Responder + + + -3 + + + Application + + + 1 + + + YES + + + + + + 2 + + + YES + + + + + + 23 + + + + + 37 + + + YES + + + + + + + 3 + + + YES + + + + + + + + + 7 + + + + + 6 + + + YES + + + + + + + + + + 5 + + + + + 4 + + + + + 29 + + + YES + + + + + + 27 + + + YES + + + + + + 25 + + + YES + + + + + + 9 + + + YES + + + + + + 8 + + + YES + + + + + + 11 + + + + + 10 + + + + + 26 + + + + + 28 + + + + + 30 + + + + + 57 + + + YES + + + + + + + + + + + + + 38 + + + YES + + + + + + 39 + + + + + 40 + + + YES + + + + + + 41 + + + + + 42 + + + YES + + + + + + 43 + + + + + 46 + + + YES + + + + + + + + 49 + + + + + 48 + + + + + 47 + + + + + 52 + + + YES + + + + + + 53 + + + + + 79 + + + YES + + + + + + 80 + + + + + 81 + + + YES + + + + + + 82 + + + + + 89 + + + YES + + + + + + 90 + + + + + + + YES + + YES + 1.IBEditorWindowLastContentRect + 1.IBPluginDependency + 1.IBViewEditorWindowController.showingLayoutRectangles + 1.IBWindowTemplateEditedContentRect + 1.NSWindowTemplate.visibleAtLaunch + 1.WindowOrigin + 1.editorWindowContentRectSynchronizationRect + 10.IBPluginDependency + 11.IBPluginDependency + 2.IBPluginDependency + 23.IBPluginDependency + 3.IBPluginDependency + 38.IBPluginDependency + 39.IBPluginDependency + 4.IBPluginDependency + 40.IBPluginDependency + 41.IBPluginDependency + 42.IBPluginDependency + 43.IBPluginDependency + 46.IBPluginDependency + 47.IBPluginDependency + 48.IBPluginDependency + 49.IBPluginDependency + 5.IBPluginDependency + 52.IBPluginDependency + 53.IBPluginDependency + 57.IBPluginDependency + 6.IBPluginDependency + 7.IBPluginDependency + 79.IBPluginDependency + 8.IBPluginDependency + 80.IBPluginDependency + 81.IBPluginDependency + 82.IBPluginDependency + 89.IBPluginDependency + 9.IBPluginDependency + 90.IBPluginDependency + + + YES + {{435, 323}, {663, 487}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{435, 323}, {663, 487}} + + {196, 240} + {{202, 428}, {480, 270}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + + + YES + + + YES + + + + + YES + + + YES + + + + 105 + + + + YES + + LoggingController + NSWindowController + + logEntriesController_ + NSArrayController + + + IBProjectSource + Source/LoggingController.h + + + + NSObject + + IBProjectSource + Source/BSSourceView.h + + + + + YES + + NSActionCell + NSCell + + IBFrameworkSource + AppKit.framework/Headers/NSActionCell.h + + + + NSApplication + NSResponder + + IBFrameworkSource + AppKit.framework/Headers/NSApplication.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSApplicationScripting.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSColorPanel.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSHelpManager.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSPageLayout.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSUserInterfaceItemSearching.h + + + + NSArrayController + NSObjectController + + IBFrameworkSource + AppKit.framework/Headers/NSArrayController.h + + + + NSCell + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSCell.h + + + + NSControl + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSControl.h + + + + NSController + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSController.h + + + + NSFormatter + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSFormatter.h + + + + NSManagedObjectContext + NSObject + + IBFrameworkSource + CoreData.framework/Headers/NSManagedObjectContext.h + + + + NSMenu + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSMenu.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSAccessibility.h + + + + NSObject + + + + NSObject + + + + NSObject + + + + NSObject + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSDictionaryController.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSDragging.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSFontManager.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSFontPanel.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSKeyValueBinding.h + + + + NSObject + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSNibLoading.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSOutlineView.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSPasteboard.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSSavePanel.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSTableView.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSToolbarItem.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSView.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSArchiver.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSClassDescription.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSError.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSFileManager.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueCoding.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueObserving.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyedArchiver.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSObject.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSObjectScripting.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSPortCoder.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSRunLoop.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptClassDescription.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptKeyValueCoding.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptObjectSpecifiers.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptWhoseTests.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSThread.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURL.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURLConnection.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURLDownload.h + + + + NSObject + + IBFrameworkSource + Sparkle.framework/Headers/SUAppcast.h + + + + NSObject + + IBFrameworkSource + Sparkle.framework/Headers/SUUpdater.h + + + + NSObjectController + NSController + + IBFrameworkSource + AppKit.framework/Headers/NSObjectController.h + + + + NSResponder + + IBFrameworkSource + AppKit.framework/Headers/NSInterfaceStyle.h + + + + NSResponder + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSResponder.h + + + + NSScrollView + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSScrollView.h + + + + NSScroller + NSControl + + IBFrameworkSource + AppKit.framework/Headers/NSScroller.h + + + + NSSplitView + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSSplitView.h + + + + NSTableColumn + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSTableColumn.h + + + + NSTableHeaderView + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSTableHeaderView.h + + + + NSTableView + NSControl + + + + NSText + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSText.h + + + + NSTextField + NSControl + + IBFrameworkSource + AppKit.framework/Headers/NSTextField.h + + + + NSTextFieldCell + NSActionCell + + IBFrameworkSource + AppKit.framework/Headers/NSTextFieldCell.h + + + + NSTextView + NSText + + IBFrameworkSource + AppKit.framework/Headers/NSTextView.h + + + + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSClipView.h + + + + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSMenuItem.h + + + + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSRulerView.h + + + + NSView + NSResponder + + + + NSWindow + + IBFrameworkSource + AppKit.framework/Headers/NSDrawer.h + + + + NSWindow + NSResponder + + IBFrameworkSource + AppKit.framework/Headers/NSWindow.h + + + + NSWindow + + IBFrameworkSource + AppKit.framework/Headers/NSWindowScripting.h + + + + NSWindowController + NSResponder + + showWindow: + id + + + IBFrameworkSource + AppKit.framework/Headers/NSWindowController.h + + + + + 0 + + com.apple.InterfaceBuilder.CocoaPlugin.macosx + + + + com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3 + + + YES + ../MacGDBp.xcodeproj + 3 + + diff --git a/English.lproj/MainMenu.xib b/English.lproj/MainMenu.xib index 46d9e7a..90cb470 100644 --- a/English.lproj/MainMenu.xib +++ b/English.lproj/MainMenu.xib @@ -1,14 +1,18 @@ - + 1050 - 9J61 - 677 - 949.46 - 353.00 + 10C540 + 740 + 1038.25 + 458.00 + + com.apple.InterfaceBuilder.CocoaPlugin + 740 + YES - + YES @@ -16,7 +20,7 @@ YES - + YES @@ -80,7 +84,7 @@ - UHJlZmVyZW5jZXPigKY + Preferences… , 1048576 2147483647 @@ -89,7 +93,7 @@ - Q2hlY2sgRm9yIFVwZGF0ZXPigKY + Check For Updates… 2147483647 @@ -210,7 +214,7 @@ - T3BlbuKApg + Open… o 1048576 2147483647 @@ -272,7 +276,7 @@ - U2F2ZSBBc+KApg + Save As… S 1048576 2147483647 @@ -299,7 +303,7 @@ - UGFnZSBTZXR1cOKApg + Page Setup… P 1048576 2147483647 @@ -308,7 +312,7 @@ - UHJpbnTigKY + Print… p 1048576 2147483647 @@ -444,7 +448,7 @@ YES - RmluZOKApg + Find… f 1048576 2147483647 @@ -509,7 +513,7 @@ YES - U3BlbGxpbmfigKY + Spelling… : 1048576 2147483647 @@ -555,7 +559,7 @@ Step In - 75yBA +  1310720 2147483647 @@ -564,7 +568,7 @@ Step Out - 75yAA +  1310720 2147483647 @@ -573,7 +577,7 @@ Step Over - 75yDA +  1310720 2147483647 @@ -661,6 +665,14 @@ + + + Connection Log + + 2147483647 + + + YES @@ -722,6 +734,9 @@ DebuggerController + + LoggingController + SUUpdater @@ -1033,15 +1048,29 @@ 305 + + + loggingController_ + + + + 307 + + + + showWindow: + + + + 309 + YES 0 - - YES - + @@ -1049,7 +1078,7 @@ -2 - RmlsZSdzIE93bmVyA + File's Owner -1 @@ -1094,6 +1123,7 @@ + @@ -1588,14 +1618,22 @@ + + 306 + + + + + 308 + + + YES - + YES - -1.IBPluginDependency - -2.IBPluginDependency -3.IBPluginDependency 103.IBPluginDependency 103.ImportedFromIB2 @@ -1679,7 +1717,6 @@ 197.ImportedFromIB2 204.IBPluginDependency 204.ImportedFromIB2 - 225.IBPluginDependency 225.ImportedFromIB2 23.IBPluginDependency 23.ImportedFromIB2 @@ -1705,9 +1742,6 @@ 264.IBPluginDependency 265.IBPluginDependency 268.IBPluginDependency - 286.IBPluginDependency - 287.IBPluginDependency - 288.IBPluginDependency 289.IBPluginDependency 29.IBEditorWindowLastContentRect 29.IBPluginDependency @@ -1720,6 +1754,7 @@ 295.IBPluginDependency 296.IBPluginDependency 303.IBPluginDependency + 308.IBPluginDependency 5.IBPluginDependency 5.ImportedFromIB2 56.IBPluginDependency @@ -1736,96 +1771,93 @@ YES com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - + {{756, 778}, {174, 23}} com.apple.InterfaceBuilder.CocoaPlugin - + com.apple.InterfaceBuilder.CocoaPlugin - + com.apple.InterfaceBuilder.CocoaPlugin - + com.apple.InterfaceBuilder.CocoaPlugin - + com.apple.InterfaceBuilder.CocoaPlugin - + com.apple.InterfaceBuilder.CocoaPlugin - + com.apple.InterfaceBuilder.CocoaPlugin - + com.apple.InterfaceBuilder.CocoaPlugin - + com.apple.InterfaceBuilder.CocoaPlugin - + com.apple.InterfaceBuilder.CocoaPlugin - + com.apple.InterfaceBuilder.CocoaPlugin - + com.apple.InterfaceBuilder.CocoaPlugin - + com.apple.InterfaceBuilder.CocoaPlugin - + com.apple.InterfaceBuilder.CocoaPlugin - + com.apple.InterfaceBuilder.CocoaPlugin - + com.apple.InterfaceBuilder.CocoaPlugin - + com.apple.InterfaceBuilder.CocoaPlugin - + com.apple.InterfaceBuilder.CocoaPlugin - + com.apple.InterfaceBuilder.CocoaPlugin - + com.apple.InterfaceBuilder.CocoaPlugin - + com.apple.InterfaceBuilder.CocoaPlugin - + com.apple.InterfaceBuilder.CocoaPlugin - + com.apple.InterfaceBuilder.CocoaPlugin - + com.apple.InterfaceBuilder.CocoaPlugin - + com.apple.InterfaceBuilder.CocoaPlugin - + {{663, 391}, {253, 223}} com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - + com.apple.InterfaceBuilder.CocoaPlugin - + com.apple.InterfaceBuilder.CocoaPlugin - + com.apple.InterfaceBuilder.CocoaPlugin - + com.apple.InterfaceBuilder.CocoaPlugin - + com.apple.InterfaceBuilder.CocoaPlugin - + com.apple.InterfaceBuilder.CocoaPlugin - + com.apple.InterfaceBuilder.CocoaPlugin - + com.apple.InterfaceBuilder.CocoaPlugin - + com.apple.InterfaceBuilder.CocoaPlugin - + com.apple.InterfaceBuilder.CocoaPlugin - + com.apple.InterfaceBuilder.CocoaPlugin - + com.apple.InterfaceBuilder.CocoaPlugin - + com.apple.InterfaceBuilder.CocoaPlugin - + + com.apple.InterfaceBuilder.CocoaPlugin - - {{821, 593}, {211, 143}} + + {{821, 573}, {208, 163}} com.apple.InterfaceBuilder.CocoaPlugin - + com.apple.InterfaceBuilder.CocoaPlugin {{162, 542}, {183, 203}} com.apple.InterfaceBuilder.CocoaPlugin @@ -1846,12 +1878,9 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin {{551, 736}, {402, 20}} com.apple.InterfaceBuilder.CocoaPlugin - + com.apple.InterfaceBuilder.CocoaPlugin {{837, 642}, {163, 83}} com.apple.InterfaceBuilder.CocoaPlugin @@ -1861,23 +1890,22 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - + + com.apple.InterfaceBuilder.CocoaPlugin + {{553, 390}, {235, 203}} com.apple.InterfaceBuilder.CocoaPlugin - + com.apple.InterfaceBuilder.CocoaPlugin - + com.apple.InterfaceBuilder.CocoaPlugin - + YES - - YES - + YES @@ -1885,15 +1913,13 @@ YES - - YES - + YES - 305 + 309 @@ -1903,12 +1929,11 @@ NSObject YES - + YES openHelpPage: showBreakpointWindow: showDebuggerWindow: - showInspectorWindow: showPreferences: @@ -1917,20 +1942,21 @@ id id id - id YES - + YES breakpoint debugger + loggingController_ YES BreakpointController DebuggerController + LoggingController @@ -1963,7 +1989,7 @@ NSWindowController YES - + YES addBreakpoint: removeBreakpoint: @@ -1976,7 +2002,7 @@ YES - + YES arrayController sourceView @@ -2005,7 +2031,7 @@ NSWindowController YES - + YES reconnect: run: @@ -2026,7 +2052,7 @@ YES - + YES errormsg inspector @@ -2057,7 +2083,7 @@ NSWindowController YES - + YES reconnectButton runButton @@ -2090,16 +2116,17 @@ - NSObject - - - - NSObject + LoggingController + NSWindowController IBProjectSource - Source/SocketWrapper.h + Source/LoggingController.h + + NSObject + + YES @@ -2131,8 +2158,537 @@ + + YES + + NSApplication + NSResponder + + IBFrameworkSource + AppKit.framework/Headers/NSApplication.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSApplicationScripting.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSColorPanel.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSHelpManager.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSPageLayout.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSUserInterfaceItemSearching.h + + + + NSArrayController + NSObjectController + + IBFrameworkSource + AppKit.framework/Headers/NSArrayController.h + + + + NSBrowser + NSControl + + IBFrameworkSource + AppKit.framework/Headers/NSBrowser.h + + + + NSControl + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSControl.h + + + + NSController + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSController.h + + + + NSFormatter + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSFormatter.h + + + + NSManagedObjectContext + NSObject + + IBFrameworkSource + CoreData.framework/Headers/NSManagedObjectContext.h + + + + NSMatrix + NSControl + + IBFrameworkSource + AppKit.framework/Headers/NSMatrix.h + + + + NSMenu + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSMenu.h + + + + NSMenuItem + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSMenuItem.h + + + + NSMovieView + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSMovieView.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSAccessibility.h + + + + NSObject + + + + NSObject + + + + NSObject + + + + NSObject + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSDictionaryController.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSDragging.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSFontManager.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSFontPanel.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSKeyValueBinding.h + + + + NSObject + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSNibLoading.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSOutlineView.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSPasteboard.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSSavePanel.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSTableView.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSToolbarItem.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSView.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSArchiver.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSClassDescription.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSError.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSFileManager.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueCoding.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueObserving.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyedArchiver.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSObject.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSObjectScripting.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSPortCoder.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSRunLoop.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptClassDescription.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptKeyValueCoding.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptObjectSpecifiers.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptWhoseTests.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSThread.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURL.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURLConnection.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURLDownload.h + + + + NSObject + + IBFrameworkSource + Sparkle.framework/Headers/SUAppcast.h + + + + NSObject + + IBFrameworkSource + Sparkle.framework/Headers/SUUpdater.h + + + + NSObjectController + NSController + + IBFrameworkSource + AppKit.framework/Headers/NSObjectController.h + + + + NSOutlineView + NSTableView + + + + NSResponder + + IBFrameworkSource + AppKit.framework/Headers/NSInterfaceStyle.h + + + + NSResponder + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSResponder.h + + + + NSTableView + NSControl + + + + NSText + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSText.h + + + + NSTextField + NSControl + + IBFrameworkSource + AppKit.framework/Headers/NSTextField.h + + + + NSToolbarItem + NSObject + + + + NSTreeController + NSObjectController + + IBFrameworkSource + AppKit.framework/Headers/NSTreeController.h + + + + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSClipView.h + + + + NSView + + + + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSRulerView.h + + + + NSView + NSResponder + + + + NSWindow + + IBFrameworkSource + AppKit.framework/Headers/NSDrawer.h + + + + NSWindow + NSResponder + + IBFrameworkSource + AppKit.framework/Headers/NSWindow.h + + + + NSWindow + + IBFrameworkSource + AppKit.framework/Headers/NSWindowScripting.h + + + + NSWindowController + NSResponder + + showWindow: + id + + + IBFrameworkSource + AppKit.framework/Headers/NSWindowController.h + + + + SUUpdater + NSObject + + checkForUpdates: + id + + + delegate + id + + + + 0 + + com.apple.InterfaceBuilder.CocoaPlugin.macosx + + + + com.apple.InterfaceBuilder.CocoaPlugin.macosx + + + + com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3 + + + YES ../MacGDBp.xcodeproj 3 diff --git a/MacGDBp.xcodeproj/project.pbxproj b/MacGDBp.xcodeproj/project.pbxproj index efac4c2..ac19f97 100644 --- a/MacGDBp.xcodeproj/project.pbxproj +++ b/MacGDBp.xcodeproj/project.pbxproj @@ -21,6 +21,8 @@ 1E42F1D70F53317B008412DB /* dsa_pub.pem in Resources */ = {isa = PBXBuildFile; fileRef = 1E42F1D60F53317B008412DB /* dsa_pub.pem */; }; 1E4C7AF90DA401C7000A9DC7 /* BreakpointManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 1E4C7AF80DA401C7000A9DC7 /* BreakpointManager.m */; }; 1E67E6FD0F3C052000E68F1B /* PreferencesPathsArrayController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1E67E6FC0F3C052000E68F1B /* PreferencesPathsArrayController.m */; }; + 1E6B5947116106FE001189D2 /* LoggingController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1E6B5946116106FE001189D2 /* LoggingController.m */; }; + 1E6B594C11610993001189D2 /* Log.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1E6B594A11610993001189D2 /* Log.xib */; }; 1E7188680D839F6300969277 /* BSLineNumberView.m in Sources */ = {isa = PBXBuildFile; fileRef = 1E7188630D839F6300969277 /* BSLineNumberView.m */; }; 1E7188690D839F6300969277 /* BSSourceView.m in Sources */ = {isa = PBXBuildFile; fileRef = 1E7188650D839F6300969277 /* BSSourceView.m */; }; 1E71886A0D839F6300969277 /* BSSourceViewTextView.m in Sources */ = {isa = PBXBuildFile; fileRef = 1E7188670D839F6300969277 /* BSSourceViewTextView.m */; }; @@ -81,6 +83,9 @@ 1E4C7AF80DA401C7000A9DC7 /* BreakpointManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = BreakpointManager.m; path = Source/BreakpointManager.m; sourceTree = ""; }; 1E67E6FB0F3C052000E68F1B /* PreferencesPathsArrayController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PreferencesPathsArrayController.h; path = Source/PreferencesPathsArrayController.h; sourceTree = ""; }; 1E67E6FC0F3C052000E68F1B /* PreferencesPathsArrayController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PreferencesPathsArrayController.m; path = Source/PreferencesPathsArrayController.m; sourceTree = ""; }; + 1E6B5945116106FE001189D2 /* LoggingController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LoggingController.h; path = Source/LoggingController.h; sourceTree = ""; }; + 1E6B5946116106FE001189D2 /* LoggingController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = LoggingController.m; path = Source/LoggingController.m; sourceTree = ""; }; + 1E6B594B11610993001189D2 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/Log.xib; sourceTree = ""; }; 1E7188620D839F6300969277 /* BSLineNumberView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BSLineNumberView.h; path = Source/BSLineNumberView.h; sourceTree = ""; }; 1E7188630D839F6300969277 /* BSLineNumberView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = BSLineNumberView.m; path = Source/BSLineNumberView.m; sourceTree = ""; }; 1E7188640D839F6300969277 /* BSSourceView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BSSourceView.h; path = Source/BSSourceView.h; sourceTree = ""; }; @@ -201,6 +206,8 @@ 1E02C5700C610158006F1752 /* DebuggerConnection.m */, 1E35FFB00C65A74C0030F527 /* NSXMLElementAdditions.h */, 1E35FC750C6579CA0030F527 /* NSXMLElementAdditions.m */, + 1E6B5945116106FE001189D2 /* LoggingController.h */, + 1E6B5946116106FE001189D2 /* LoggingController.m */, ); name = Connection; sourceTree = ""; @@ -212,6 +219,7 @@ 1E416FF60D36F821009A53A2 /* MainMenu.xib */, 1E1E53010DF9B89800D334F9 /* Breakpoints.xib */, 1E9582600E252474001A3D89 /* Preferences.xib */, + 1E6B594A11610993001189D2 /* Log.xib */, ); name = Interfaces; sourceTree = ""; @@ -360,6 +368,7 @@ 1E1E53030DF9B89800D334F9 /* Breakpoints.xib in Resources */, 1E9582620E252474001A3D89 /* Preferences.xib in Resources */, 1E0AFBB90FC2518700C67031 /* HUDIcon.png in Resources */, + 1E6B594C11610993001189D2 /* Log.xib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -403,6 +412,7 @@ 1EB7BED50ECF3CA90033283A /* StackFrame.m in Sources */, 1EBF4D5D0EE35F0700B62769 /* StackController.m in Sources */, 1E67E6FD0F3C052000E68F1B /* PreferencesPathsArrayController.m in Sources */, + 1E6B5947116106FE001189D2 /* LoggingController.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -433,6 +443,14 @@ name = MainMenu.xib; sourceTree = ""; }; + 1E6B594A11610993001189D2 /* Log.xib */ = { + isa = PBXVariantGroup; + children = ( + 1E6B594B11610993001189D2 /* English */, + ); + name = Log.xib; + sourceTree = ""; + }; 1E9582600E252474001A3D89 /* Preferences.xib */ = { isa = PBXVariantGroup; children = ( diff --git a/Source/AppDelegate.h b/Source/AppDelegate.h index 59cacad..8c87615 100644 --- a/Source/AppDelegate.h +++ b/Source/AppDelegate.h @@ -15,19 +15,23 @@ */ #import -#import "DebuggerController.h" + #import "BreakpointController.h" +#import "DebuggerController.h" +#import "LoggingController.h" #import "PreferencesController.h" @interface AppDelegate : NSObject { IBOutlet DebuggerController* debugger; IBOutlet BreakpointController* breakpoint; + IBOutlet LoggingController* loggingController_; PreferencesController* prefs; } -@property(readonly) DebuggerController* debugger; -@property(readonly) BreakpointController* breakpoint; +@property (readonly) DebuggerController* debugger; +@property (readonly) BreakpointController* breakpoint; +@property (readonly) LoggingController* loggingController; - (IBAction)showDebuggerWindow:(id)sender; - (IBAction)showBreakpointWindow:(id)sender; diff --git a/Source/AppDelegate.m b/Source/AppDelegate.m index 007972c..8821873 100644 --- a/Source/AppDelegate.m +++ b/Source/AppDelegate.m @@ -18,18 +18,9 @@ @implementation AppDelegate -@synthesize debugger, breakpoint; - -/** - * Initializes - */ -- (id)init -{ - if (self = [super init]) - { - } - return self; -} +@synthesize debugger; +@synthesize breakpoint; +@synthesize loggingController = loggingController_; /** * Initialize method that is called before all other messages. This will set the default @@ -62,6 +53,7 @@ - (IBAction)showDebuggerWindow:(id)sender { [[debugger window] makeKeyAndOrderFront:self]; + NSLog(@"logg %@", [loggingController_ window]); } /** diff --git a/Source/DebuggerConnection.h b/Source/DebuggerConnection.h index ed637e3..115bd96 100644 --- a/Source/DebuggerConnection.h +++ b/Source/DebuggerConnection.h @@ -19,6 +19,8 @@ #import "Breakpoint.h" #import "StackFrame.h" +@class LoggingController; + @protocol DebuggerConnectionDelegate; // The DebuggerConnection is the communication layer between the application @@ -41,7 +43,7 @@ // The connection's delegate. id delegate; - + // The raw CFSocket on which the two streams are based. Strong. CFSocketRef socket_; diff --git a/Source/DebuggerConnection.m b/Source/DebuggerConnection.m index 461a960..6151807 100644 --- a/Source/DebuggerConnection.m +++ b/Source/DebuggerConnection.m @@ -20,6 +20,7 @@ #import "DebuggerConnection.h" #import "AppDelegate.h" +#import "LoggingController.h" // GDBpConnection (Private) //////////////////////////////////////////////////// @@ -69,7 +70,6 @@ void ReadStreamCallback(CFReadStreamRef stream, CFStreamEventType eventType, voi switch (eventType) { case kCFStreamEventHasBytesAvailable: - NSLog(@"About to read."); [connection readStreamHasData]; break; @@ -218,7 +218,6 @@ void SocketAcceptCallback(CFSocketRef socket, connected = NO; [[BreakpointManager sharedManager] setConnection:self]; - [self connect]; } return self; @@ -501,6 +500,15 @@ void SocketAcceptCallback(CFSocketRef socket, // Test if we can convert it into an NSXMLDocument. NSError* error = nil; NSXMLDocument* xmlTest = [[NSXMLDocument alloc] initWithXMLString:currentPacket_ options:NSXMLDocumentTidyXML error:&error]; + + // Log this receive event. + LoggingController* logger = [(AppDelegate*)[NSApp delegate] loggingController]; + LogEntry* log = [logger recordReceive:currentPacket_]; + log.error = error; + log.lastWrittenTransactionID = lastWrittenTransaction_; + log.lastReadTransactionID = lastReadTransaction_; + + // Try to recover if we encountered an error. if (error) { NSLog(@"Could not parse XML? --- %@", error); @@ -590,6 +598,12 @@ void SocketAcceptCallback(CFSocketRef socket, if ([[[[NSProcessInfo processInfo] environment] objectForKey:@"TransportDebug"] boolValue]) NSLog(@"--> %@", command); + // Log this trancation. + LoggingController* logger = [(AppDelegate*)[NSApp delegate] loggingController]; + LogEntry* log = [logger recordSend:command]; + log.lastWrittenTransactionID = lastWrittenTransaction_; + log.lastReadTransactionID = lastReadTransaction_; + // Busy wait while writing. BAADD. Should background this operation. while (!done) { @@ -946,7 +960,6 @@ void SocketAcceptCallback(CFSocketRef socket, if (lastReadTransaction_ >= lastWrittenTransaction_ && [queuedWrites_ count] > 0) { NSString* command = [queuedWrites_ objectAtIndex:0]; - NSLog(@"Sending queued write: %@", command); // We don't want to block because this is called from the main thread. // |-performSend:| busy waits when the stream is not ready. Bail out diff --git a/Source/DebuggerController.m b/Source/DebuggerController.m index d7a46d2..d6e06b4 100644 --- a/Source/DebuggerController.m +++ b/Source/DebuggerController.m @@ -40,6 +40,7 @@ stackController = [[StackController alloc] init]; NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; + connection = [[DebuggerConnection alloc] initWithPort:[defaults integerForKey:@"Port"]]; connection.delegate = self; expandedVariables = [[NSMutableSet alloc] init]; diff --git a/Source/LoggingController.h b/Source/LoggingController.h new file mode 100644 index 0000000..0ebd53b --- /dev/null +++ b/Source/LoggingController.h @@ -0,0 +1,78 @@ +/* + * MacGDBp + * Copyright (c) 2010, Blue Static + * + * This program is free software; you can redistribute it and/or modify it under the terms of the GNU + * General Public License as published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with this program; if not, + * write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#import + +@class LogEntry; + +// The LoggingController manages the communication log with the debugger engine. +// Whenever a command or a response received, the DebuggerConnection notifies +// this class to record the relevant information. +@interface LoggingController : NSWindowController +{ + // An array of log entries, with object at index 0 being the oldest entry. + NSMutableArray* logEntries_; + + // The array controller. + IBOutlet NSArrayController* logEntriesController_; +} +@property (readonly) NSArray* logEntries; + +// Designated initializer. +- (id)init; + +// Creates a new log entry with the specified command, adds it to the entries +// list, and returns the new entry as a weak pointer. Callers can then set +// additional properties. +- (LogEntry*)recordSend:(NSString*)command; + +// Creates a new log entry with the specified response data, adds it to the list +// of entries, and returns the new entry as a weak pointer. Callers can then set +// additional properties. +- (LogEntry*)recordReceive:(NSString*)response; + +@end + +// Log Entry /////////////////////////////////////////////////////////////////// + +typedef enum _LogEntryDirection { + kLogEntrySending = 0, + kLogEntryReceiving +} LogEntryDirection; + +// A simple class that stores information for a single log entry. +@interface LogEntry : NSObject +{ + // The direction this communication went. + LogEntryDirection direction_; + + // The command that was sent or the response. + NSString* contents_; + + // Any error information. + NSError* error_; + + // The values of the last read and written transaction IDs. + NSUInteger lastWrittenTransactionID_; + NSUInteger lastReadTransactionID_; +} +@property (assign) LogEntryDirection direction; +@property (copy) NSString* contents; +@property (retain) NSError* error; +@property (assign) NSUInteger lastWrittenTransactionID; +@property (assign) NSUInteger lastReadTransactionID; +- (NSString*)directionName; +@end diff --git a/Source/LoggingController.m b/Source/LoggingController.m new file mode 100644 index 0000000..988d7f5 --- /dev/null +++ b/Source/LoggingController.m @@ -0,0 +1,85 @@ +/* + * MacGDBp + * Copyright (c) 2010, Blue Static + * + * This program is free software; you can redistribute it and/or modify it under the terms of the GNU + * General Public License as published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with this program; if not, + * write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#import "LoggingController.h" + + +@implementation LoggingController + +@synthesize logEntries = logEntries_; + +- (id)init +{ + if (self = [self initWithWindowNibName:@"Log"]) + { + logEntries_ = [NSMutableArray new]; + } + return self; +} + +- (void)dealloc +{ + [logEntries_ release]; + [super dealloc]; +} + +- (LogEntry*)recordSend:(NSString*)command +{ + LogEntry* entry = [LogEntry new]; + entry.direction = kLogEntrySending; + entry.contents = command; + [logEntries_ addObject:entry]; + [logEntriesController_ rearrangeObjects]; + return [entry autorelease]; +} + +- (LogEntry*)recordReceive:(NSString*)response +{ + LogEntry* entry = [LogEntry new]; + entry.direction = kLogEntryReceiving; + entry.contents = response; + [logEntries_ addObject:entry]; + [logEntriesController_ rearrangeObjects]; + return [entry autorelease]; +} + +@end + +//////////////////////////////////////////////////////////////////////////////// + +@implementation LogEntry + +@synthesize direction = direction_; +@synthesize contents = contents_; +@synthesize error = error_; +@synthesize lastWrittenTransactionID = lastWrittenTransactionID_; +@synthesize lastReadTransactionID = lastReadTransactionID_; + +- (void)dealloc +{ + self.contents = nil; + self.error = nil; + self.lastWrittenTransactionID = 0; + self.lastReadTransactionID = 0; +} + +- (NSString*)directionName +{ + return (direction_ == kLogEntryReceiving ? @"Recv" : @"Send"); +} + +@end + -- 2.43.5