diff --git a/.gitignore b/.gitignore index 200a77f..2e43af8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ .svn/* - +build/* English.lproj/.svn/all-wcprops English.lproj/.svn/entries English.lproj/.svn/text-base/InfoPlist.strings.svn-base diff --git a/ArchiveLayout.h b/ArchiveLayout.h index 411759e..72b53e3 100644 --- a/ArchiveLayout.h +++ b/ArchiveLayout.h @@ -12,12 +12,12 @@ { NSString * name; uint32_t length; - MVLayout * __unsafe_unretained layout; + MVLayout * __weak layout; } @property (nonatomic) NSString * name; @property (nonatomic) uint32_t length; -@property (nonatomic,unsafe_unretained) MVLayout * layout; +@property (nonatomic,weak) MVLayout * layout; @end diff --git a/CRTFootPrints.mm b/CRTFootPrints.mm index 75a4a85..1e9736e 100644 --- a/CRTFootPrints.mm +++ b/CRTFootPrints.mm @@ -1259,6 +1259,9 @@ - (bool) matchAsmAtOffset:(uint32_t)offset asmFootPrint:(const AsmFootPrint)footprint lineCount:(NSUInteger)lineCount { + if (!dataController) // dataController is weak + return false; + uint8_t const * data = ((uint8_t *)[dataController.fileData bytes]) + offset; for (NSUInteger i = 0; i < lineCount; ++i) @@ -1284,6 +1287,9 @@ - (bool) matchAsmAtOffset:(uint32_t)offset //------------------------------------------------------------------------------ - (void) determineRuntimeVersion { + if (!dataController) // dataController is weak + return; + if (entryPoint == 0) { return; // not an executable, no entry point, or cannot detect diff --git a/DataController.h b/DataController.h index 5ed996d..7f97ee0 100644 --- a/DataController.h +++ b/DataController.h @@ -87,7 +87,7 @@ struct MVNodeSaver; { NSMutableArray * rows; // array of MVRow * (host of all the rows) NSMutableArray * displayRows; // array of MVRow * (rows filtered by search criteria) - MVArchiver * __unsafe_unretained archiver; + MVArchiver * __weak archiver; FILE * swapFile; NSLock * tableLock; } @@ -113,7 +113,7 @@ struct MVNodeSaver; @interface MVNode : NSObject { NSString * caption; - MVNode * __unsafe_unretained parent; + MVNode * __weak parent; NSMutableArray * children; NSRange dataRange; MVTable * details; @@ -122,7 +122,7 @@ struct MVNodeSaver; } @property (nonatomic) NSString * caption; -@property (nonatomic,unsafe_unretained) MVNode * parent; +@property (nonatomic,weak) MVNode * parent; @property (nonatomic) NSRange dataRange; @property (nonatomic) MVTable * details; @property (nonatomic) NSMutableDictionary * userInfo; @@ -150,7 +150,7 @@ struct MVNodeSaver; NSMutableData * realData; // patched content by relocs and bindings NSMutableArray * layouts; MVNode * rootNode; - MVNode * __unsafe_unretained selectedNode; + MVNode * __weak selectedNode; NSLock * treeLock; // semaphore for the node tree } @@ -159,7 +159,7 @@ struct MVNodeSaver; @property (nonatomic) NSMutableData * realData; @property (nonatomic,readonly) NSArray * layouts; @property (nonatomic,readonly) MVNode * rootNode; -@property (nonatomic,unsafe_unretained) MVNode * selectedNode; +@property (nonatomic,weak) MVNode * selectedNode; @property (nonatomic,readonly) NSLock * treeLock; -(NSString *) getMachine:(cpu_type_t)cputype; diff --git a/DataController.mm b/DataController.mm index bff137f..c8cf2aa 100644 --- a/DataController.mm +++ b/DataController.mm @@ -156,7 +156,7 @@ - (NSString *)readStringFromFile:(FILE *)pFile for(;;) { char c = fgetc(pFile); - if (c) + if (!feof(pFile) && c) s += c; else break; diff --git a/DataSources.h b/DataSources.h index 9d7cb18..7559033 100644 --- a/DataSources.h +++ b/DataSources.h @@ -8,14 +8,10 @@ extern NSString * const MVScannerErrorMessage; -@interface DataSourceTree : NSObject -{ -} +@interface MVDataSourceTree : NSObject; @end -@interface DataSourceDetails : NSObject -{ -} +@interface MVDataSourceDetails : NSObject; @end diff --git a/DataSources.mm b/DataSources.mm index e18a4e6..dc87fba 100644 --- a/DataSources.mm +++ b/DataSources.mm @@ -14,7 +14,7 @@ NSString * const MVScannerErrorMessage = @"NSScanner error"; //============================================================================ -@implementation DataSourceTree +@implementation MVDataSourceTree #pragma mark NSOutlineView must-have delegates @@ -77,7 +77,7 @@ - (id)outlineView:(NSOutlineView *)outlineView objectValueForTableColumn:(NSTabl //============================================================================ -@implementation DataSourceDetails +@implementation MVDataSourceDetails #pragma mark NSTableView must-have delegates diff --git a/English.lproj/Layout.xib b/English.lproj/Layout.xib index b0c95f1..3f11ba2 100644 --- a/English.lproj/Layout.xib +++ b/English.lproj/Layout.xib @@ -1,22 +1,44 @@ - 1060 - 10K540 - 851 - 1038.36 - 461.00 + 1080 + 12C60 + 2844 + 1187.34 + 625.00 com.apple.InterfaceBuilder.CocoaPlugin - 851 + 2844 - - + + NSButton + NSButtonCell + NSCustomObject + NSCustomView + NSOutlineView + NSProgressIndicator + NSScrollView + NSScroller + NSSearchField + NSSearchFieldCell + NSSegmentedCell + NSSegmentedControl + NSSplitView + NSTableColumn + NSTableHeaderView + NSTableView + NSTextField + NSTextFieldCell + NSView + NSWindowTemplate com.apple.InterfaceBuilder.CocoaPlugin - + + PluginDependencyRecalculationVersion + + MVDocument @@ -35,7 +57,7 @@ Mach-O Browser NSWindow - {1.79769e+308, 1.79769e+308} + 256 @@ -61,8 +83,11 @@ 256 {269, 344} - 2 + + YES + NO + YES -2147483392 @@ -74,7 +99,7 @@ 16 1000 - 75628096 + 75497536 2048 @@ -97,7 +122,7 @@ - 337772096 + 337641536 2048 Text Cell @@ -148,12 +173,13 @@ 0 NO 0 + 1 {{1, 1}, {269, 344}} + - 2 4 @@ -163,7 +189,9 @@ -2147483392 {{315, 1}, {15, 329}} - 2 + + + NO _doScroller: 0.99313501144164762 @@ -173,7 +201,9 @@ -2147483392 {{1, 330}, {314, 15}} - 2 + + + NO 1 _doScroller: @@ -182,18 +212,22 @@ {271, 346} + - 2 - 562 + 133682 QSAAAEEgAABBmAAAQZgAAA + 0.25 + 4 + 1 {271, 346} - 2 + + NSView @@ -213,22 +247,24 @@ 256 {617, 328} - 2 + + YES + NO + YES 256 {617, 17} - 2 + + - - + + -2147483392 {{397, 0}, {16, 17}} - - 2 @@ -236,7 +272,7 @@ 40 1000 - 75628096 + 75497536 2048 pFile @@ -247,7 +283,7 @@ - 337772096 + 337641536 2048 Text Cell @@ -268,7 +304,7 @@ 40 1000 - 75628096 + 75497536 2048 Data @@ -276,7 +312,7 @@ - 337772096 + 337641536 2048 Text Cell @@ -293,7 +329,7 @@ 40 1000 - 75628096 + 75497536 2048 Description @@ -309,7 +345,7 @@ - 337772096 + 337641536 2048 Text Cell @@ -326,7 +362,7 @@ 40 10000 - 75628096 + 75497536 2048 Value @@ -334,7 +370,7 @@ - 337772096 + 337641536 2048 Text Cell @@ -355,7 +391,7 @@ MC40OTg0OTM5NzU5AA 17 - 1522532352 + 2059403264 2 @@ -364,12 +400,13 @@ 0 YES 0 + 1 {{1, 17}, {617, 328}} + - 2 4 @@ -379,7 +416,9 @@ -2147483392 {{397, 17}, {15, 415}} - 2 + + + NO _doScroller: 0.90566037735849059 @@ -389,7 +428,9 @@ -2147483392 {{1, 534}, {442, 15}} - 2 + + + NO 1 _doScroller: @@ -403,36 +444,39 @@ {{1, 0}, {617, 17}} + - 2 4 - {619, 346} - - 2 - 562 + + + 133682 - QSAAAEEgAABBmAAAQZgAAA + 0.25 + 4 + 1 {{281, 0}, {619, 346}} - 2 + + NSView {{0, 24}, {900, 346}} - 2 + + YES 3 @@ -441,10 +485,11 @@ 265 {{590, 376}, {300, 22}} - 2 + + YES - 343014976 + 342884416 268436544 @@ -463,20 +508,20 @@ - 130560 + 0 0 search _searchFieldSearch: - 138690815 + 138690560 0 400 75 - 130560 + 0 0 clear @@ -488,7 +533,7 @@ _searchFieldCancel: - 138690815 + 138690560 0 400 @@ -496,16 +541,18 @@ 255 + NO 268 {{46, 374}, {196, 24}} - 2 + + YES - -2080244224 + -2080374784 33554432 LucidaGrande @@ -537,14 +584,15 @@ 1 + NO 1313 - {{637, 1}, {245, 20}} - 2 + + 24586 100 @@ -553,10 +601,11 @@ 292 {{17, 5}, {390, 14}} - 2 + + YES - 68288064 + 68157504 272630784 Status @@ -573,21 +622,23 @@ + NO 289 {{618, 5}, {15, 15}} - 2 + + YES - 67239424 + 67108864 33554432 - 138150143 + 138149888 194 NSImage @@ -598,40 +649,27 @@ 200 25 + NO {900, 400} - 2 + + - {{0, 0}, {1440, 878}} - {1.79769e+308, 1.79769e+308} + {{0, 0}, {1680, 1028}} + {10000000000000, 10000000000000} + YES - DataSourceTree + MVDataSourceTree - DataSourceDetails + MVDataSourceDetails - - - dataSource - - - - 29 - - - - dataSource - - - - 30 - leftView @@ -656,38 +694,6 @@ 35 - - - nextKeyView - - - - 91 - - - - nextKeyView - - - - 92 - - - - nextKeyView - - - - 93 - - - - initialFirstResponder - - - - 94 - searchField @@ -696,30 +702,6 @@ 99 - - - delegate - - - - 103 - - - - delegate - - - - 105 - - - - delegate - - - - 106 - statusText @@ -776,6 +758,78 @@ 142 + + + initialFirstResponder + + + + 94 + + + + dataSource + + + + 30 + + + + nextKeyView + + + + 93 + + + + delegate + + + + 106 + + + + dataSource + + + + 29 + + + + nextKeyView + + + + 92 + + + + delegate + + + + 105 + + + + nextKeyView + + + + 91 + + + + delegate + + + + 103 + @@ -1054,26 +1108,21 @@ + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin MVTableView com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - - P4AAAL+AAABEBkAAwagAAA - com.apple.InterfaceBuilder.CocoaPlugin - - P4AAAL+AAABBiAAAwZgAAA - @@ -1082,9 +1131,6 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - - P4AAAL+AAABEGUAAwZAAAA - 1 @@ -1109,18 +1155,14 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - {{124, 333}, {900, 400}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin {{124, 333}, {900, 400}} - - {800, 600} com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - - P4AAAL+AAAAAAAAAw7gAAA - com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -1133,22 +1175,25 @@ - 142 + 143 - DataSourceDetails + MVDataSourceDetails NSObject - + IBProjectSource - DataSources.h + ./Classes/MVDataSourceDetails.h - DataSourceTree + MVDataSourceTree NSObject - + + IBProjectSource + ./Classes/MVDataSourceTree.h + MVDocument @@ -1211,594 +1256,36 @@ NSButton - + IBProjectSource - Document.h + ./Classes/MVDocument.h MVOutlineView NSOutlineView - - - - MVTableView - NSTableView - - - - - - 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 - - - - NSButton - NSControl - - IBFrameworkSource - AppKit.framework/Headers/NSButton.h - - - - NSButtonCell - NSActionCell - - IBFrameworkSource - AppKit.framework/Headers/NSButtonCell.h - - - - NSCell - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSCell.h - - - - NSControl - NSView - - IBFrameworkSource - AppKit.framework/Headers/NSControl.h - - - - NSDocument - NSObject - - id - id - id - id - id - id - - - - printDocument: - id - - - revertDocumentToSaved: - id - - - runPageLayout: - id - - - saveDocument: - id - - - saveDocumentAs: - id - - - saveDocumentTo: - id - - - - IBFrameworkSource - AppKit.framework/Headers/NSDocument.h - - - - NSDocument - - IBFrameworkSource - AppKit.framework/Headers/NSDocumentScripting.h - - - - NSFormatter - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSFormatter.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 + IBProjectSource + ./Classes/MVOutlineView.h - NSOutlineView + MVTableView NSTableView - - - - NSProgressIndicator - NSView - - IBFrameworkSource - AppKit.framework/Headers/NSProgressIndicator.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 - - - - NSSearchField - NSTextField - - IBFrameworkSource - AppKit.framework/Headers/NSSearchField.h - - - - NSSearchFieldCell - NSTextFieldCell - - IBFrameworkSource - AppKit.framework/Headers/NSSearchFieldCell.h - - - - NSSegmentedCell - NSActionCell - - IBFrameworkSource - AppKit.framework/Headers/NSSegmentedCell.h - - - - NSSegmentedControl - NSControl - IBFrameworkSource - AppKit.framework/Headers/NSSegmentedControl.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 - - - - NSTextField - NSControl - - IBFrameworkSource - AppKit.framework/Headers/NSTextField.h - - - - NSTextFieldCell - NSActionCell - - IBFrameworkSource - AppKit.framework/Headers/NSTextFieldCell.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 + IBProjectSource + ./Classes/MVTableView.h 0 IBCocoaFramework - - com.apple.InterfaceBuilder.CocoaPlugin.macosx - + + com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3 + YES - ../machoview.xcodeproj 3 {512, 512} diff --git a/English.lproj/MainMenu.xib b/English.lproj/MainMenu.xib index 392c3c6..2fca1b5 100644 --- a/English.lproj/MainMenu.xib +++ b/English.lproj/MainMenu.xib @@ -1,31 +1,30 @@ - + - 1060 - 10K540 - 851 - 1038.36 - 461.00 + 1080 + 12C60 + 2844 + 1187.34 + 625.00 com.apple.InterfaceBuilder.CocoaPlugin - 851 + 2844 - - YES - - - - YES + + NSCustomObject + NSMenu + NSMenuItem + + com.apple.InterfaceBuilder.CocoaPlugin - + PluginDependencyRecalculationVersion - - YES + - AppDelegate + MVAppController FirstResponder @@ -35,8 +34,7 @@ AMainMenu - - YES + Mach-O Browser @@ -54,8 +52,7 @@ submenuAction: Mach-O Browser - - YES + About Mach-O Browser @@ -106,9 +103,7 @@ submenuAction: Services - - YES - + _NSServicesMenu @@ -170,7 +165,7 @@ - + _NSAppleMenu @@ -185,8 +180,7 @@ submenuAction: File - - YES + New @@ -216,8 +210,7 @@ submenuAction: Open Recent - - YES + Clear Menu @@ -227,7 +220,7 @@ - + _NSRecentDocumentsMenu @@ -307,7 +300,7 @@ - + @@ -321,8 +314,7 @@ submenuAction: Edit - - YES + Undo @@ -428,8 +420,7 @@ submenuAction: Find - - YES + Find… @@ -479,7 +470,7 @@ - + @@ -493,8 +484,7 @@ submenuAction: Spelling and Grammar - - YES + Show Spelling and Grammar @@ -549,7 +539,7 @@ - + @@ -563,8 +553,7 @@ submenuAction: Substitutions - - YES + Show Substitutions @@ -629,7 +618,7 @@ - + @@ -642,8 +631,7 @@ submenuAction: Transformations - - YES + Make Upper Case @@ -668,7 +656,7 @@ - + @@ -682,8 +670,7 @@ submenuAction: Speech - - YES + Start Speaking @@ -702,10 +689,10 @@ - + - + @@ -718,8 +705,7 @@ submenuAction: Format - - YES + Font @@ -730,8 +716,7 @@ submenuAction: Font - - YES + Show Fonts @@ -820,8 +805,7 @@ submenuAction: Kern - - YES + Use Default @@ -854,7 +838,7 @@ - + @@ -867,8 +851,7 @@ submenuAction: Ligature - - YES + Use Default @@ -893,7 +876,7 @@ - + @@ -906,8 +889,7 @@ submenuAction: Baseline - - YES + Use Default @@ -948,7 +930,7 @@ - + @@ -998,7 +980,7 @@ - + _NSFontMenu @@ -1012,8 +994,7 @@ submenuAction: Text - - YES + Align Left @@ -1069,8 +1050,7 @@ submenuAction: Writing Direction - - YES + YES @@ -1147,7 +1127,7 @@ - + @@ -1186,10 +1166,10 @@ - + - + @@ -1203,8 +1183,7 @@ submenuAction: View - - YES + Show Toolbar @@ -1223,7 +1202,7 @@ - + @@ -1237,8 +1216,7 @@ submenuAction: Window - - YES + Minimize @@ -1277,7 +1255,7 @@ - + _NSWindowsMenu @@ -1291,8 +1269,7 @@ submenuAction: Help - - YES + Mach-O Browser Help @@ -1302,23 +1279,46 @@ - + _NSHelpMenu - + _NSMainMenu - AppDelegate + MVAppController NSFontManager - + - - YES + + + + terminate: + + + + 449 + + + + delegate + + + + 653 + + + + orderFrontStandardAboutPanel: + + + + 654 + performMiniaturize: @@ -1591,46 +1591,6 @@ 373 - - - addFontTrait: - - - - 421 - - - - addFontTrait: - - - - 422 - - - - modifyFont: - - - - 423 - - - - orderFrontFontPanel: - - - - 424 - - - - modifyFont: - - - - 425 - raiseBaseline: @@ -1759,14 +1719,6 @@ 441 - - - terminate: - - - - 449 - toggleAutomaticSpellingCorrection: @@ -1968,46 +1920,67 @@ 530 - - delegate - - + + openDocument: + + - 639 + 659 - openDocument: + showPreferencePanel: - + - 642 + 660 - - delegate - - + + addFontTrait: + + - 644 + 421 - showPreferences: - - + addFontTrait: + + - 647 + 422 - + + + modifyFont: + + + + 423 + + + + orderFrontFontPanel: + + + + 424 + + + + modifyFont: + + + + 425 + + - - YES + 0 - - YES - + @@ -2032,8 +2005,7 @@ 29 - - YES + @@ -2041,50 +2013,45 @@ - + 19 - - YES + - + 56 - - YES + - + 217 - - YES + - + 83 - - YES + - + 81 - - YES + @@ -2096,7 +2063,7 @@ - + @@ -2127,10 +2094,9 @@ 124 - - YES + - + @@ -2161,10 +2127,9 @@ 125 - - YES + - + @@ -2175,8 +2140,7 @@ 205 - - YES + @@ -2192,7 +2156,7 @@ - + @@ -2243,33 +2207,30 @@ 218 - - YES + - + 216 - - YES + - + 200 - - YES + - + @@ -2290,14 +2251,13 @@ 220 - - YES + - + @@ -2328,9 +2288,7 @@ 57 - - YES - + @@ -2340,8 +2298,9 @@ + - + @@ -2387,10 +2346,9 @@ 131 - - YES + - + @@ -2411,13 +2369,12 @@ 24 - - YES + - + @@ -2443,20 +2400,18 @@ 295 - - YES + - + 296 - - YES + - + @@ -2472,20 +2427,18 @@ 211 - - YES + - + 212 - - YES + - + @@ -2506,17 +2459,15 @@ 348 - - YES + - + 349 - - YES + @@ -2524,7 +2475,7 @@ - + @@ -2545,36 +2496,32 @@ 375 - - YES + - + 376 - - YES + - + 377 - - YES + - + 388 - - YES + @@ -2591,7 +2538,7 @@ - + @@ -2637,28 +2584,25 @@ 397 - - YES + - + 398 - - YES + - + 399 - - YES + - + @@ -2689,14 +2633,13 @@ 405 - - YES + - + @@ -2727,12 +2670,11 @@ 411 - - YES + - + @@ -2753,13 +2695,12 @@ 415 - - YES + - + @@ -2790,21 +2731,19 @@ 450 - - YES + - + 451 - - YES + - + @@ -2860,19 +2799,17 @@ 490 - - YES + - + 491 - - YES + - + @@ -2888,17 +2825,15 @@ 496 - - YES + - + 497 - - YES + @@ -2909,7 +2844,7 @@ - + @@ -2940,10 +2875,9 @@ 503 - - YES + - + @@ -2969,8 +2903,7 @@ 508 - - YES + @@ -2980,7 +2913,7 @@ - + @@ -3028,538 +2961,168 @@ - - - - YES - - YES - -3.IBPluginDependency - 112.IBPluginDependency - 112.ImportedFromIB2 - 124.IBPluginDependency - 124.ImportedFromIB2 - 125.IBEditorWindowLastContentRect - 125.IBPluginDependency - 125.ImportedFromIB2 - 125.editorWindowContentRectSynchronizationRect - 126.IBPluginDependency - 126.ImportedFromIB2 - 129.IBPluginDependency - 129.ImportedFromIB2 - 130.IBEditorWindowLastContentRect - 130.IBPluginDependency - 130.ImportedFromIB2 - 130.editorWindowContentRectSynchronizationRect - 131.IBPluginDependency - 131.ImportedFromIB2 - 134.IBPluginDependency - 134.ImportedFromIB2 - 136.IBPluginDependency - 136.ImportedFromIB2 - 143.IBPluginDependency - 143.ImportedFromIB2 - 144.IBPluginDependency - 144.ImportedFromIB2 - 145.IBPluginDependency - 145.ImportedFromIB2 - 149.IBPluginDependency - 149.ImportedFromIB2 - 150.IBPluginDependency - 150.ImportedFromIB2 - 19.IBPluginDependency - 19.ImportedFromIB2 - 195.IBPluginDependency - 195.ImportedFromIB2 - 196.IBPluginDependency - 196.ImportedFromIB2 - 197.IBPluginDependency - 197.ImportedFromIB2 - 198.IBPluginDependency - 198.ImportedFromIB2 - 199.IBPluginDependency - 199.ImportedFromIB2 - 200.IBEditorWindowLastContentRect - 200.IBPluginDependency - 200.ImportedFromIB2 - 200.editorWindowContentRectSynchronizationRect - 201.IBPluginDependency - 201.ImportedFromIB2 - 202.IBPluginDependency - 202.ImportedFromIB2 - 203.IBPluginDependency - 203.ImportedFromIB2 - 204.IBPluginDependency - 204.ImportedFromIB2 - 205.IBEditorWindowLastContentRect - 205.IBPluginDependency - 205.ImportedFromIB2 - 205.editorWindowContentRectSynchronizationRect - 206.IBPluginDependency - 206.ImportedFromIB2 - 207.IBPluginDependency - 207.ImportedFromIB2 - 208.IBPluginDependency - 208.ImportedFromIB2 - 209.IBPluginDependency - 209.ImportedFromIB2 - 210.IBPluginDependency - 210.ImportedFromIB2 - 211.IBPluginDependency - 211.ImportedFromIB2 - 212.IBEditorWindowLastContentRect - 212.IBPluginDependency - 212.ImportedFromIB2 - 212.editorWindowContentRectSynchronizationRect - 213.IBPluginDependency - 213.ImportedFromIB2 - 214.IBPluginDependency - 214.ImportedFromIB2 - 215.IBPluginDependency - 215.ImportedFromIB2 - 216.IBPluginDependency - 216.ImportedFromIB2 - 217.IBPluginDependency - 217.ImportedFromIB2 - 218.IBPluginDependency - 218.ImportedFromIB2 - 219.IBPluginDependency - 219.ImportedFromIB2 - 220.IBEditorWindowLastContentRect - 220.IBPluginDependency - 220.ImportedFromIB2 - 220.editorWindowContentRectSynchronizationRect - 221.IBPluginDependency - 221.ImportedFromIB2 - 23.IBPluginDependency - 23.ImportedFromIB2 - 236.IBPluginDependency - 236.ImportedFromIB2 - 239.IBPluginDependency - 239.ImportedFromIB2 - 24.IBEditorWindowLastContentRect - 24.IBPluginDependency - 24.ImportedFromIB2 - 24.editorWindowContentRectSynchronizationRect - 29.IBEditorWindowLastContentRect - 29.IBPluginDependency - 29.ImportedFromIB2 - 29.WindowOrigin - 29.editorWindowContentRectSynchronizationRect - 295.IBPluginDependency - 296.IBEditorWindowLastContentRect - 296.IBPluginDependency - 296.editorWindowContentRectSynchronizationRect - 297.IBPluginDependency - 298.IBPluginDependency - 346.IBPluginDependency - 346.ImportedFromIB2 - 348.IBPluginDependency - 348.ImportedFromIB2 - 349.IBEditorWindowLastContentRect - 349.IBPluginDependency - 349.ImportedFromIB2 - 349.editorWindowContentRectSynchronizationRect - 350.IBPluginDependency - 350.ImportedFromIB2 - 351.IBPluginDependency - 351.ImportedFromIB2 - 354.IBPluginDependency - 354.ImportedFromIB2 - 375.IBPluginDependency - 376.IBEditorWindowLastContentRect - 376.IBPluginDependency - 377.IBPluginDependency - 388.IBEditorWindowLastContentRect - 388.IBPluginDependency - 389.IBPluginDependency - 390.IBPluginDependency - 391.IBPluginDependency - 392.IBPluginDependency - 393.IBPluginDependency - 394.IBPluginDependency - 395.IBPluginDependency - 396.IBPluginDependency - 397.IBPluginDependency - 398.IBPluginDependency - 399.IBPluginDependency - 400.IBPluginDependency - 401.IBPluginDependency - 402.IBPluginDependency - 403.IBPluginDependency - 404.IBPluginDependency - 405.IBPluginDependency - 406.IBPluginDependency - 407.IBPluginDependency - 408.IBPluginDependency - 409.IBPluginDependency - 410.IBPluginDependency - 411.IBPluginDependency - 412.IBPluginDependency - 413.IBPluginDependency - 414.IBPluginDependency - 415.IBPluginDependency - 416.IBPluginDependency - 417.IBPluginDependency - 418.IBPluginDependency - 419.IBPluginDependency - 450.IBPluginDependency - 451.IBEditorWindowLastContentRect - 451.IBPluginDependency - 452.IBPluginDependency - 453.IBPluginDependency - 454.IBPluginDependency - 457.IBPluginDependency - 459.IBPluginDependency - 460.IBPluginDependency - 462.IBPluginDependency - 465.IBPluginDependency - 466.IBPluginDependency - 485.IBPluginDependency - 490.IBPluginDependency - 491.IBEditorWindowLastContentRect - 491.IBPluginDependency - 492.IBPluginDependency - 496.IBPluginDependency - 497.IBEditorWindowLastContentRect - 497.IBPluginDependency - 498.IBPluginDependency - 499.IBPluginDependency - 5.IBPluginDependency - 5.ImportedFromIB2 - 500.IBPluginDependency - 501.IBPluginDependency - 502.IBPluginDependency - 503.IBPluginDependency - 504.IBPluginDependency - 505.IBPluginDependency - 506.IBPluginDependency - 507.IBPluginDependency - 508.IBEditorWindowLastContentRect - 508.IBPluginDependency - 509.IBPluginDependency - 510.IBPluginDependency - 511.IBPluginDependency - 512.IBPluginDependency - 513.IBPluginDependency - 514.IBPluginDependency - 515.IBPluginDependency - 516.IBPluginDependency - 517.IBPluginDependency - 56.IBPluginDependency - 56.ImportedFromIB2 - 57.IBEditorWindowLastContentRect - 57.IBPluginDependency - 57.ImportedFromIB2 - 57.editorWindowContentRectSynchronizationRect - 58.IBPluginDependency - 58.ImportedFromIB2 - 72.IBPluginDependency - 72.ImportedFromIB2 - 73.IBPluginDependency - 73.ImportedFromIB2 - 74.IBPluginDependency - 74.ImportedFromIB2 - 75.IBPluginDependency - 75.ImportedFromIB2 - 77.IBPluginDependency - 77.ImportedFromIB2 - 78.IBPluginDependency - 78.ImportedFromIB2 - 79.IBPluginDependency - 79.ImportedFromIB2 - 80.IBPluginDependency - 80.ImportedFromIB2 - 81.IBEditorWindowLastContentRect - 81.IBPluginDependency - 81.ImportedFromIB2 - 81.editorWindowContentRectSynchronizationRect - 82.IBPluginDependency - 82.ImportedFromIB2 - 83.IBPluginDependency - 83.ImportedFromIB2 - 92.IBPluginDependency - 92.ImportedFromIB2 - - - YES - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - {{736, 773}, {143, 23}} - com.apple.InterfaceBuilder.CocoaPlugin - - {{522, 812}, {146, 23}} - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - {{649, 770}, {64, 6}} - com.apple.InterfaceBuilder.CocoaPlugin - - {{436, 809}, {64, 6}} - 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 - - {{836, 523}, {275, 113}} - com.apple.InterfaceBuilder.CocoaPlugin - - {{608, 612}, {275, 83}} - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - {{582, 553}, {254, 283}} - com.apple.InterfaceBuilder.CocoaPlugin - - {{187, 434}, {243, 243}} - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - {{836, 533}, {164, 43}} - com.apple.InterfaceBuilder.CocoaPlugin - - {{608, 612}, {167, 43}} - 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 - - {{836, 553}, {238, 103}} - com.apple.InterfaceBuilder.CocoaPlugin - - {{608, 612}, {241, 103}} - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - {{742, 763}, {194, 73}} - com.apple.InterfaceBuilder.CocoaPlugin - - {{525, 802}, {197, 73}} - {{389, 836}, {486, 20}} - com.apple.InterfaceBuilder.CocoaPlugin - - {74, 862} - {{6, 978}, {478, 20}} - com.apple.InterfaceBuilder.CocoaPlugin - {{692, 793}, {231, 43}} - com.apple.InterfaceBuilder.CocoaPlugin - {{475, 832}, {234, 43}} - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - {{836, 483}, {220, 133}} - com.apple.InterfaceBuilder.CocoaPlugin - - {{608, 612}, {215, 63}} - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - {{627, 793}, {83, 43}} - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - {{710, 553}, {175, 283}} - 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 - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - {{836, 533}, {170, 63}} - 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 - {{813, 813}, {220, 23}} - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - {{674, 260}, {204, 183}} - 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 - {{878, 180}, {164, 173}} - 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 - - {{401, 653}, {249, 183}} - com.apple.InterfaceBuilder.CocoaPlugin - - {{23, 794}, {245, 183}} - 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 - - {{541, 633}, {196, 203}} - com.apple.InterfaceBuilder.CocoaPlugin - - {{145, 474}, {199, 203}} - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - - - - YES - - - YES - + + + 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 + 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 + 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 + 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 + 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 - - + - 647 + 660 - - YES - - AppDelegate - NSObject - - IBProjectSource - AppDelegate.h - - + FirstResponder @@ -3578,594 +3141,46 @@ - - - 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 - - - - NSBrowser - NSControl - - IBFrameworkSource - AppKit.framework/Headers/NSBrowser.h - - - - NSControl - NSView - - IBFrameworkSource - AppKit.framework/Headers/NSControl.h - - - - NSDocument - NSObject - - YES - - YES - printDocument: - revertDocumentToSaved: - runPageLayout: - saveDocument: - saveDocumentAs: - saveDocumentTo: - - - YES - id - id - id - id - id - id - - - - YES - - YES - printDocument: - revertDocumentToSaved: - runPageLayout: - saveDocument: - saveDocumentAs: - saveDocumentTo: - - - YES - - printDocument: - id - - - revertDocumentToSaved: - id - - - runPageLayout: - id - - - saveDocument: - id - - - saveDocumentAs: - id - - - saveDocumentTo: - id - - - - - IBFrameworkSource - AppKit.framework/Headers/NSDocument.h - - - - NSDocument - - IBFrameworkSource - AppKit.framework/Headers/NSDocumentScripting.h - - - NSDocumentController + MVAppController NSObject - - YES - - YES - clearRecentDocuments: - newDocument: - openDocument: - saveAllDocuments: - - - YES - id - id - id - id + + id + id + id + + + + newDocument: + id - - - YES - - YES - clearRecentDocuments: - newDocument: - openDocument: - saveAllDocuments: + + openDocument: + id - - YES - - clearRecentDocuments: - id - - - newDocument: - id - - - openDocument: - id - - - saveAllDocuments: - id - + + showPreferencePanel: + id - - - IBFrameworkSource - AppKit.framework/Headers/NSDocumentController.h - - - - NSFontManager - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSFontManager.h - - - - NSFormatter - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSFormatter.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 - - - - 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 - - - - 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 - - - - NSTextView - NSText - - IBFrameworkSource - AppKit.framework/Headers/NSTextView.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 + IBProjectSource + ./Classes/MVAppController.h - + 0 IBCocoaFramework - - com.apple.InterfaceBuilder.CocoaPlugin.macosx - - com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3 - + YES - ../machoview.xcodeproj 3 - - YES - - YES - NSMenuCheckmark - NSMenuMixedState - - - YES - {9, 8} - {7, 2} - - + + {11, 11} + {10, 3} + diff --git a/English.lproj/Preferences.xib b/English.lproj/Preferences.xib index 048cafe..9d7fcbe 100644 --- a/English.lproj/Preferences.xib +++ b/English.lproj/Preferences.xib @@ -1,36 +1,33 @@ - + - 1060 - 10K540 - 851 - 1038.36 - 461.00 + 1080 + 12C60 + 2844 + 1187.34 + 625.00 com.apple.InterfaceBuilder.CocoaPlugin - 851 + 2844 - - YES - - - - YES + + NSButton + NSButtonCell + NSCustomObject + NSUserDefaultsController + NSView + NSWindowTemplate + + com.apple.InterfaceBuilder.CocoaPlugin - + - YES - - YES - - - YES - + PluginDependencyRecalculationVersion + - - YES + - NSObject + MVPreferenceController FirstResponder @@ -38,180 +35,129 @@ NSApplication - - 15 + + YES + + + 3 2 - {{196, 240}, {480, 270}} - 544735232 + {{167, 107}, {474, 241}} + -1535638528 Preferences - MVPreferencesWindo - - - D1B4166B-B42B-4581-914D-45DF8C0F070E - - - YES - YES - YES - NO - 1 - 1 - - YES - - YES - NSToolbarCustomizeToolbarItem - NSToolbarFlexibleSpaceItem - - - YES - - NSToolbarCustomizeToolbarItem - Customize - Customize - Customize Toolbar - - + NSPanel + + + + + 256 + + + + 268 + {{42, 181}, {195, 18}} + + + + _NS:9 + YES + + 67108864 + 268435456 + Use LLVM disassembler + + LucidaGrande + 13 + 1044 + + _NS:9 + + 1211912448 + 2 + NSImage - NSToolbarCustomizeToolbarItemImage + NSSwitch - - runToolbarCustomizationPalette: - {0, 0} - {0, 0} - YES - YES - -1 - YES - 0 - - - NSToolbarFlexibleSpaceItem - - Flexible Space - - - - - - {1, 5} - {20000, 32} - YES - YES - -1 - YES - 0 - - YES - YES - - - 1048576 - 2147483647 - - NSImage - NSMenuCheckmark - - - NSImage - NSMenuMixedState - + + NSSwitch + + + 200 + 25 + NO + + {474, 241} + + + + _NS:21 + + {{0, 0}, {1680, 1028}} + {10000000000000, 10000000000000} + YES + + + YES + + + + + + + window + + - - YES - - + 25 + + + + useLLVMDisassembler + + - - YES - - + 73 + + + + toggleUseLLVMDisassembler: + + - - YES + 82 + + + + delegate + + + 74 - {1.79769e+308, 1.79769e+308} - - - 256 - - YES - - - 18 - {480, 270} - - - YES - - 1 - - - 256 - {480, 270} - - - - 6 - System - controlColor - - 3 - MC42NjY2NjY2NjY3AA - - - - - - 2 - - - 256 - {{10, 33}, {460, 224}} - - - - - - - - LucidaGrande - 13 - 1044 - - 6 - YES - YES - - YES - - + + + value: values.UseLLVMDisassembler + + + + + + value: values.UseLLVMDisassembler + value + values.UseLLVMDisassembler + 2 - {480, 270} - + 81 - {{0, 0}, {1680, 1028}} - {1.79769e+308, 1.79769e+308} - - - YES - - - - - YES - + - - YES + 0 - + @@ -233,179 +179,112 @@ Application - - 1 - - - YES - - - - - - - 2 - - - YES - - - - 3 - 4 - - - YES - - - - + 23 + + + + + - 10 - - + 24 + + + + + - 11 - - + 53 + + + + + - 12 - - - YES - - - - + 54 + + - 13 - - - YES - + 75 + + + + + + + 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 + + + + + + 82 + + + + + MVPreferenceController + NSWindowController + + toggleUseLLVMDisassembler: + id + + + toggleUseLLVMDisassembler: + + toggleUseLLVMDisassembler: + id - - Basic Preferences - - 16 - - + + useLLVMDisassembler + NSButton - - 19 - - - YES - + + useLLVMDisassembler + + useLLVMDisassembler + NSButton - - Print Preferences - - 20 - - + + IBProjectSource + ./Classes/MVPreferenceController.h - - - YES - - YES - -1.IBPluginDependency - -2.IBPluginDependency - -3.IBPluginDependency - 1.IBEditorWindowLastContentRect - 1.IBPluginDependency - 1.IBWindowTemplateEditedContentRect - 1.NSWindowTemplate.visibleAtLaunch - 1.WindowOrigin - 1.editorWindowContentRectSynchronizationRect - 10.IBPluginDependency - 11.IBPluginDependency - 12.IBPluginDependency - 13.IBPluginDependency - 16.IBPluginDependency - 2.IBPluginDependency - 3.IBPluginDependency - 4.IBEditorWindowLastContentRect - 4.IBPluginDependency - - - YES - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - {{473, 473}, {480, 270}} - com.apple.InterfaceBuilder.CocoaPlugin - {{473, 473}, {480, 270}} - - {196, 240} - {{357, 418}, {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 - {{405, 743}, {616, 0}} - com.apple.InterfaceBuilder.CocoaPlugin - - - - YES - - - YES - - - - - YES - - - YES - - - - 22 + - 0 IBCocoaFramework com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3 - + YES - 3 - YES - - YES - NSMenuCheckmark - NSMenuMixedState - NSToolbarCustomizeToolbarItemImage - - - YES - {9, 8} - {7, 2} - {32, 32} - + NSSwitch + {15, 15} diff --git a/FatLayout.h b/FatLayout.h index 68efe97..a503d90 100644 --- a/FatLayout.h +++ b/FatLayout.h @@ -8,9 +8,7 @@ #import "Layout.h" -@interface FatLayout : MVLayout -{ -} +@interface FatLayout : MVLayout; + (FatLayout *) layoutWithDataController:(MVDataController *)dc rootNode:(MVNode *)node; diff --git a/Info.plist b/Info.plist index 24b87f2..02d35d0 100644 --- a/Info.plist +++ b/Info.plist @@ -3,9 +3,9 @@ CFBuildDate - Mon Aug 19 00:19:02 WEST 2013 + Tue Jan 8 23:26:45 CET 2013 CFBuildNumber - 8465 + 8509 CFBundleDevelopmentRegion English CFBundleDocumentTypes @@ -44,7 +44,7 @@ CFBundleSignature ???? CFBundleVersion - 1 + 8509 LSApplicationCategoryType public.app-category.developer-tools LSMinimumSystemVersion diff --git a/Layout.h b/Layout.h index cb75ff1..d773c2d 100644 --- a/Layout.h +++ b/Layout.h @@ -19,13 +19,14 @@ struct obj const * obj = (struct obj const *)((uint8_t *)[dataController.realDat @interface MVLayout : NSObject { MVNode * rootNode; - MVDataController * __unsafe_unretained dataController; - uint32_t imageOffset; // absolute physical offset in binary + MVDataController * __weak dataController; + uint32_t imageOffset; // absolute physical offset of the image in binary + uint32_t imageSize; // size of the image corresponds to this layout NSThread * backgroundThread; MVArchiver * archiver; } -@property(nonatomic,unsafe_unretained,readonly) MVDataController * dataController; +@property(nonatomic,weak,readonly) MVDataController * dataController; @property(nonatomic,readonly) NSThread * backgroundThread; @property(nonatomic,readonly) MVArchiver * archiver; diff --git a/Layout.mm b/Layout.mm index 6b339f2..b6aa681 100644 --- a/Layout.mm +++ b/Layout.mm @@ -31,6 +31,7 @@ - (id)initWithDataController:(MVDataController *)dc rootNode:(MVNode *)node dataController = dc; rootNode = node; imageOffset = node.dataRange.location; + imageSize = node.dataRange.length; backgroundThread = [[NSThread alloc] initWithTarget:self selector:@selector(doBackgroundTasks) object:nil]; NSString * swapPath = NSSTRING(tempnam(CSTRING([MVDocument temporaryDirectory]), diff --git a/LoadCommands.mm b/LoadCommands.mm index cbc4d89..0fba3ac 100644 --- a/LoadCommands.mm +++ b/LoadCommands.mm @@ -1977,7 +1977,7 @@ -(MVNode *)createLoadCommandNode:(MVNode *)parent // preserv section fileOffset/sectName for RVA lookup NSDictionary * userInfo = [self userInfoForSection:section]; - insertChild[section->addr] = make_pair(section->offset + imageOffset, userInfo); + sectionInfo[section->addr] = make_pair(section->offset + imageOffset, userInfo); // preserv header info for latter use sections.push_back(section); @@ -2013,7 +2013,7 @@ -(MVNode *)createLoadCommandNode:(MVNode *)parent // preserv section fileOffset/sectName for RVA lookup NSDictionary * userInfo = [self userInfoForSection64:section_64]; - insertChild[section_64->addr] = make_pair(section_64->offset + imageOffset, userInfo); + sectionInfo[section_64->addr] = make_pair(section_64->offset + imageOffset, userInfo); // preserv header info for latter use sections_64.push_back(section_64); diff --git a/MachOLayout.h b/MachOLayout.h index 6f549f3..ebe26b7 100644 --- a/MachOLayout.h +++ b/MachOLayout.h @@ -42,7 +42,7 @@ typedef std::map ExceptionFrameMa RelocMap relocMap; // section relocations SegmentInfoMap segmentInfo; // segment info lookup table by offset - SectionInfoMap insertChild; // section info lookup table by address + SectionInfoMap sectionInfo; // section info lookup table by address ExceptionFrameMap lsdaInfo; // LSDA info lookup table by address NSMutableDictionary * symbolNames; // symbol names by address diff --git a/MachOLayout.mm b/MachOLayout.mm index 6f2808f..40017e0 100644 --- a/MachOLayout.mm +++ b/MachOLayout.mm @@ -192,8 +192,8 @@ - (uint32_t)RVAToFileOffset: (uint32_t)rva { NSParameterAssert([self is64bit] == NO); - SectionInfoMap::const_iterator sectIter = insertChild.upper_bound(rva); - if (sectIter == insertChild.begin()) + SectionInfoMap::const_iterator sectIter = sectionInfo.upper_bound(rva); + if (sectIter == sectionInfo.begin()) { [NSException raise:@"RVAToFileOffset" format:@"no section found at address 0x%X", rva]; @@ -210,8 +210,8 @@ - (uint32_t)RVA64ToFileOffset: (uint64_t)rva64 { NSParameterAssert([self is64bit] == YES); - SectionInfoMap::const_iterator sectIter = insertChild.upper_bound(rva64); - if (sectIter == insertChild.begin()) + SectionInfoMap::const_iterator sectIter = sectionInfo.upper_bound(rva64); + if (sectIter == sectionInfo.begin()) { [NSException raise:@"RVA64ToFileOffset" format:@"no section found at address 0x%qX", rva64]; @@ -322,8 +322,8 @@ - (NSDictionary *)userInfoForRelocs - (NSDictionary *)sectionInfoForRVA:(uint32_t)rva { NSParameterAssert([self is64bit] == NO); - SectionInfoMap::iterator iter = insertChild.upper_bound(rva); - if (iter == insertChild.begin()) + SectionInfoMap::iterator iter = sectionInfo.upper_bound(rva); + if (iter == sectionInfo.begin()) { NSLog(@"warning: no section info found for address 0x%.8X",rva); return nil; @@ -335,8 +335,8 @@ - (NSDictionary *)sectionInfoForRVA:(uint32_t)rva - (NSDictionary *)sectionInfoForRVA64:(uint64_t)rva64 { NSParameterAssert([self is64bit] == YES); - SectionInfoMap::iterator iter = insertChild.upper_bound(rva64); - if (iter == insertChild.begin()) + SectionInfoMap::iterator iter = sectionInfo.upper_bound(rva64); + if (iter == sectionInfo.begin()) { NSLog(@"warning: no section info found for address 0x%.16qX",rva64); return nil; diff --git a/SectionContents.mm b/SectionContents.mm index 9ed06f3..8f7d11e 100644 --- a/SectionContents.mm +++ b/SectionContents.mm @@ -580,11 +580,11 @@ - (MVNode *)createTextNode:(MVNode *)parent struct nlist * ot_symbols = (symbols.empty() ? NULL : const_cast(symbols[0])); struct nlist_64 * ot_symbols64 = (symbols_64.empty() ? NULL : const_cast(symbols_64[0])); uint32_t ot_nsymbols = ([self is64bit] == NO ? symbols.size() : symbols_64.size()); - char * ot_strings = const_cast(strtab); + char * ot_strings = (char *)strtab; uint32_t ot_strings_size = (char *)[dataController.fileData bytes] - strtab; uint32_t * ot_indirect_symbols = (dysymtab_command ? (uint32_t*)((char*)[dataController.fileData bytes] + dysymtab_command->indirectsymoff + imageOffset) : NULL); uint32_t ot_nindirect_symbols = (dysymtab_command ? dysymtab_command->nindirectsyms : 0); - struct load_command * ot_load_commands = const_cast(commands[0]); + struct load_command * ot_load_commands = (struct load_command *)(commands[0]); uint32_t ot_ncmds = commands.size(); uint32_t ot_sizeofcmds = mach_header->sizeofcmds; cpu_type_t ot_cputype = mach_header->cputype; @@ -592,6 +592,16 @@ - (MVNode *)createTextNode:(MVNode *)parent bool ot_verbose = true; bool ot_llvm_mc = false; + struct data_in_code_entry * ot_dices = NULL; // TODO + uint32_t ot_ndices = 0; // TODO + char * ot_object_addr = (char *)mach_header; + uint32_t ot_object_size = imageSize; + + LLVMDisasmContextRef ot_arm_dc = (qflag && mach_header->cputype == CPU_TYPE_ARM ? create_arm_llvm_disassembler() : NULL); + LLVMDisasmContextRef ot_thumb_dc = (qflag && mach_header->cputype == CPU_TYPE_ARM ? create_thumb_llvm_disassembler() : NULL); + LLVMDisasmContextRef ot_i386_dc = (qflag && mach_header->cputype == CPU_TYPE_I386 ? create_i386_llvm_disassembler() : NULL); + LLVMDisasmContextRef ot_x86_64_dc = (qflag && mach_header->cputype == CPU_TYPE_X86_64 ? create_x86_64_llvm_disassembler() : NULL); + vector sorted_symbols; set thumbSymbols; @@ -696,7 +706,12 @@ - (MVNode *)createTextNode:(MVNode *)parent NSUInteger nAsmLine = 0; do { - uint32_t parsed_bytes = + uint32_t parsed_bytes; + + try + { + + parsed_bytes = (mach_header->cputype != CPU_TYPE_ARM ? i386_disassemble( ot_sect, @@ -720,7 +735,11 @@ - (MVNode *)createTextNode:(MVNode *)parent ot_ncmds, ot_sizeofcmds, ot_verbose, - ot_llvm_mc + ot_llvm_mc, + ot_i386_dc, + ot_x86_64_dc, + ot_object_addr, + ot_object_size ) : arm_disassemble( ot_sect, @@ -742,9 +761,21 @@ - (MVNode *)createTextNode:(MVNode *)parent ot_ncmds, ot_sizeofcmds, ot_cpu_subtype, - ot_verbose + ot_verbose, + ot_arm_dc, + ot_thumb_dc, + ot_object_addr, + ot_object_size, + ot_dices, + ot_ndices ) ); + } + catch(...) + { + // sometimes the disassembler crashes on encrypted test section + break; + } // read from pipe char buf[0x1000], *pbuf = buf; @@ -841,6 +872,7 @@ - (MVNode *)createTextNode:(MVNode *)parent } while (ot_addr < ot_sect_addr + length); + // clean up symbols for (vector::iterator iter = sorted_symbols.begin(); iter != sorted_symbols.end(); @@ -849,6 +881,12 @@ - (MVNode *)createTextNode:(MVNode *)parent free(iter->name); } + // clean up LLVM disasm context + if (ot_arm_dc) delete_arm_llvm_disassembler(ot_arm_dc); + if (ot_thumb_dc) delete_thumb_llvm_disassembler(ot_thumb_dc); + if (ot_i386_dc) delete_i386_llvm_disassembler(ot_i386_dc); + if (ot_x86_64_dc) delete_x86_64_llvm_disassembler(ot_x86_64_dc); + // close last block if (symbolName) { diff --git a/createdmg b/createdmg index 7d24db7..3a05cd2 100755 --- a/createdmg +++ b/createdmg @@ -1,7 +1,7 @@ #!/bin/bash # Create DMG Installer -buildPlist="build/Release/MachOView.app/Contents/Info.plist" +buildPlist="build/MachOView.app/Contents/Info.plist" CFBuildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBuildNumber" $buildPlist) CFBundleShortVersionString=$(/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" $buildPlist) -cp -f README build/Release -hdiutil create -fs HFS+ -volname "MachOView" -srcfolder build/Release "MachOView "$CFBundleShortVersionString.$CFBuildNumber".dmg" +cp -f README build +hdiutil create -fs HFS+ -volname "MachOView" -srcfolder build "MachOView "$CFBundleShortVersionString.$CFBuildNumber".dmg" diff --git a/disasm.h b/disasm.h deleted file mode 100644 index e57a342..0000000 --- a/disasm.h +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright © 2009 Apple Inc. All rights reserved. - * - * @APPLE_LICENSE_HEADER_START@ - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of Apple Inc. ("Apple") nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * @APPLE_LICENSE_HEADER_END@ - */ - - -#ifndef _DISASM_H_ -#define _DISASM_H_ - - -enum byte_sex -{ - UNKNOWN_BYTE_SEX, - BIG_ENDIAN_BYTE_SEX, - LITTLE_ENDIAN_BYTE_SEX -}; - -struct symbol -{ - char *name; - char *indr_name; - uint64_t n_value; - int is_thumb; -}; - -extern "C" int sym_compare(struct symbol *sym1, struct symbol *sym2); -extern "C" int rel_compare(struct relocation_info *rel1, struct relocation_info *rel2); - -extern "C" const char * guess_symbol( - const uint64_t value, - const struct symbol *sorted_symbols, - const uint32_t nsorted_symbols, - const bool verbose = true); - -extern "C" uint32_t i386_disassemble( - char *sect, - uint32_t left, - uint64_t addr, - uint64_t sect_addr, - enum byte_sex object_byte_sex, - struct relocation_info *sorted_relocs, - uint32_t nsorted_relocs, - struct nlist *symbols, - struct nlist_64 *symbols64, - uint32_t nsymbols, - struct symbol *sorted_symbols, - uint32_t nsorted_symbols, - char *strings, - uint32_t strings_size, - uint32_t *indirect_symbols, - uint32_t nindirect_symbols, - cpu_type_t cputype, - struct load_command *load_commands, - uint32_t ncmds, - uint32_t sizeofcmds, - bool verbose, - bool llvm_mc); - - -extern bool in_thumb; - -extern "C" uint32_t arm_disassemble( - char *sect, - uint32_t left, - uint32_t addr, - uint32_t sect_addr, - enum byte_sex object_byte_sex, - struct relocation_info *sorted_relocs, - uint32_t nsorted_relocs, - struct nlist *symbols, - uint32_t nsymbols, - struct symbol *sorted_symbols, - uint32_t nsorted_symbols, - char *strings, - uint32_t strings_size, - uint32_t *indirect_symbols, - uint32_t nindirect_symbols, - struct load_command *load_commands, - uint32_t ncmds, - uint32_t sizeofcmds, - cpu_subtype_t cpu_subtype, - bool verbose); - - -#endif diff --git a/libdisasm.a b/libdisasm.a index 66a5ce9..d6dfcb4 100644 Binary files a/libdisasm.a and b/libdisasm.a differ diff --git a/machoview.xcodeproj/project.pbxproj b/machoview.xcodeproj/project.pbxproj index f1877b5..228e484 100644 --- a/machoview.xcodeproj/project.pbxproj +++ b/machoview.xcodeproj/project.pbxproj @@ -7,7 +7,8 @@ objects = { /* Begin PBXBuildFile section */ - 256AC3DA0F4B6AC300CF3369 /* AppDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 256AC3D90F4B6AC300CF3369 /* AppDelegate.mm */; }; + 256AC3DA0F4B6AC300CF3369 /* AppController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 256AC3D90F4B6AC300CF3369 /* AppController.mm */; }; + 3C0ADEB0169CD42600DA428E /* README in CopyFiles */ = {isa = PBXBuildFile; fileRef = 3CE90DFC11F6107600543402 /* README */; }; 3C0F958411F6589D0070A2FE /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 3C0F957E11F6589D0070A2FE /* InfoPlist.strings */; }; 3C0F958511F6589D0070A2FE /* Layout.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3C0F958011F6589D0070A2FE /* Layout.xib */; }; 3C0F958611F6589D0070A2FE /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3C0F958211F6589D0070A2FE /* MainMenu.xib */; }; @@ -16,6 +17,8 @@ 3C1163F113D5B88D007B4A6E /* stop.png in Resources */ = {isa = PBXBuildFile; fileRef = 3C1163F013D5B88D007B4A6E /* stop.png */; }; 3C34A82B14892FF1005B53F6 /* FatLayout.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3C34A82A14892FF1005B53F6 /* FatLayout.mm */; }; 3C3EC88F13B66E8900ECCDB2 /* Preferences.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3C3EC88D13B66E8900ECCDB2 /* Preferences.xib */; }; + 3C46C7D91687C6ED00212190 /* PreferenceController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3C46C7D81687C6ED00212190 /* PreferenceController.mm */; }; + 3C46C84B1687DEE600212190 /* Credits.rtf in Resources */ = {isa = PBXBuildFile; fileRef = 3C46C8491687DEE600212190 /* Credits.rtf */; }; 3C61A87C1240B0B400BDF3D0 /* SectionContents.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3C61A87B1240B0B400BDF3D0 /* SectionContents.mm */; }; 3C73525A11DE122900DF1950 /* Document.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3C73525911DE122900DF1950 /* Document.mm */; }; 3CB9D3F8139FC96D003D8D33 /* libdisasm.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3CB9D3F7139FC96D003D8D33 /* libdisasm.a */; }; @@ -32,17 +35,17 @@ 3CF9779E11C77A23004CD74C /* DataController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3CF9779D11C77A23004CD74C /* DataController.mm */; }; 3CF978C611C7B34C004CD74C /* DataSources.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3CF978C511C7B34C004CD74C /* DataSources.mm */; }; 3CF97F0F11C91F93004CD74C /* MachOLayout.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3CF97F0E11C91F93004CD74C /* MachOLayout.mm */; }; - 7B919499162A1DAA0072A2B9 /* README.orig in Resources */ = {isa = PBXBuildFile; fileRef = 7B919498162A1DAA0072A2B9 /* README.orig */; }; 8D11072D0486CEB800E47090 /* main.mm in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.mm */; settings = {ATTRIBUTES = (); }; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ 3CACF74A11CBCC69006BCD3F /* CopyFiles */ = { isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; + buildActionMask = 12; dstPath = ""; - dstSubfolderSpec = 6; + dstSubfolderSpec = 16; files = ( + 3C0ADEB0169CD42600DA428E /* README in CopyFiles */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -50,8 +53,8 @@ /* Begin PBXFileReference section */ 13E42FB307B3F0F600E4EEF1 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = ""; }; - 256AC3D80F4B6AC300CF3369 /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; - 256AC3D90F4B6AC300CF3369 /* AppDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AppDelegate.mm; sourceTree = ""; }; + 256AC3D80F4B6AC300CF3369 /* AppController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppController.h; sourceTree = ""; }; + 256AC3D90F4B6AC300CF3369 /* AppController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AppController.mm; sourceTree = ""; }; 256AC3F00F4B6AF500CF3369 /* Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Prefix.pch; sourceTree = ""; }; 29B97316FDCFA39411CA2CEA /* main.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = main.mm; sourceTree = ""; }; 29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; @@ -66,6 +69,9 @@ 3C34A82914892FF1005B53F6 /* FatLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FatLayout.h; sourceTree = ""; }; 3C34A82A14892FF1005B53F6 /* FatLayout.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = FatLayout.mm; sourceTree = ""; }; 3C3EC88E13B66E8900ECCDB2 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/Preferences.xib; sourceTree = ""; }; + 3C46C7D71687C5CB00212190 /* PreferenceController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PreferenceController.h; sourceTree = ""; }; + 3C46C7D81687C6ED00212190 /* PreferenceController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PreferenceController.mm; sourceTree = ""; }; + 3C46C84A1687DEE600212190 /* English */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = English; path = English.lproj/Credits.rtf; sourceTree = ""; }; 3C61A87B1240B0B400BDF3D0 /* SectionContents.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SectionContents.mm; sourceTree = ""; }; 3C61A87D1240B0C100BDF3D0 /* SectionContents.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SectionContents.h; sourceTree = ""; }; 3C73525811DE122900DF1950 /* Document.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Document.h; sourceTree = ""; }; @@ -101,6 +107,7 @@ 3CE90DB511F60B6900543402 /* LinkEdit.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = LinkEdit.mm; sourceTree = ""; }; 3CE90DED11F60D4F00543402 /* Exceptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Exceptions.h; sourceTree = ""; }; 3CE90DEE11F60D5A00543402 /* Exceptions.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = Exceptions.mm; sourceTree = ""; }; + 3CE90DFC11F6107600543402 /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = ""; }; 3CF22E90144C8FC600380071 /* ObjC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ObjC.h; sourceTree = ""; }; 3CF22E91144C8FC600380071 /* ObjC.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ObjC.mm; sourceTree = ""; }; 3CF9779C11C77A23004CD74C /* DataController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DataController.h; sourceTree = ""; }; @@ -109,8 +116,6 @@ 3CF978C511C7B34C004CD74C /* DataSources.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DataSources.mm; sourceTree = ""; }; 3CF97F0D11C91F93004CD74C /* MachOLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = MachOLayout.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; 3CF97F0E11C91F93004CD74C /* MachOLayout.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; lineEnding = 0; path = MachOLayout.mm; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - 7B919491162A1D1A0072A2B9 /* README */ = {isa = PBXFileReference; lastKnownFileType = text; path = README; sourceTree = ""; }; - 7B919498162A1DAA0072A2B9 /* README.orig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README.orig; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -130,8 +135,10 @@ isa = PBXGroup; children = ( 3C871CB1141AC7C100288512 /* Common.h */, - 256AC3D80F4B6AC300CF3369 /* AppDelegate.h */, - 256AC3D90F4B6AC300CF3369 /* AppDelegate.mm */, + 256AC3D80F4B6AC300CF3369 /* AppController.h */, + 256AC3D90F4B6AC300CF3369 /* AppController.mm */, + 3C46C7D71687C5CB00212190 /* PreferenceController.h */, + 3C46C7D81687C6ED00212190 /* PreferenceController.mm */, 3C73525811DE122900DF1950 /* Document.h */, 3C73525911DE122900DF1950 /* Document.mm */, 3CF978C411C7B34C004CD74C /* DataSources.h */, @@ -196,8 +203,7 @@ 29B97314FDCFA39411CA2CEA /* Mach-O Browser */ = { isa = PBXGroup; children = ( - 7B919491162A1D1A0072A2B9 /* README */, - 7B919498162A1DAA0072A2B9 /* README.orig */, + 3CE90DFC11F6107600543402 /* README */, 3C30845A11FDAF6F008A270F /* createdmg */, 080E96DDFE201D6D7F000001 /* machoview */, 3C78CB26139EE44B006C9591 /* mach-o */, @@ -221,6 +227,7 @@ 29B97317FDCFA39411CA2CEA /* Resources */ = { isa = PBXGroup; children = ( + 3C46C8491687DEE600212190 /* Credits.rtf */, 3CCB9FDF11F6DC2000F57CAA /* Info.plist */, 3C0F958811F658BF0070A2FE /* redApple.icns */, 3C0F958711F658BF0070A2FE /* greenApple.icns */, @@ -304,7 +311,7 @@ 29B97313FDCFA39411CA2CEA /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0460; + LastUpgradeCheck = 0450; }; buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "machoview" */; compatibilityVersion = "Xcode 3.2"; @@ -337,7 +344,7 @@ 3C0F958A11F658BF0070A2FE /* redApple.icns in Resources */, 3C3EC88F13B66E8900ECCDB2 /* Preferences.xib in Resources */, 3C1163F113D5B88D007B4A6E /* stop.png in Resources */, - 7B919499162A1DAA0072A2B9 /* README.orig in Resources */, + 3C46C84B1687DEE600212190 /* Credits.rtf in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -356,7 +363,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "#!/bin/bash\n# Auto Increment Version Script\nbuildPlist=\"Info.plist\"\nCFBuildNumber=$(/usr/libexec/PlistBuddy -c \"Print CFBuildNumber\" $buildPlist)\nCFBuildNumber=$(($CFBuildNumber + 1))\n/usr/libexec/PlistBuddy -c \"Set :CFBuildNumber $CFBuildNumber\" $buildPlist\nCFBuildDate=$(date)\n/usr/libexec/PlistBuddy -c \"Set :CFBuildDate $CFBuildDate\" $buildPlist"; + shellScript = "#!/bin/bash\n# Auto Increment Version Script\nbuildPlist=\"Info.plist\"\nCFBundleShortVersionString=$(/usr/libexec/PlistBuddy -c \"Print CFBundleShortVersionString\" $buildPlist)\nCFBuildNumber=$(/usr/libexec/PlistBuddy -c \"Print CFBuildNumber\" $buildPlist)\nCFBuildNumber=$(($CFBuildNumber + 1))\n/usr/libexec/PlistBuddy -c \"Set :CFBuildNumber $CFBuildNumber\" $buildPlist\nCFBuildDate=$(date)\n/usr/libexec/PlistBuddy -c \"Set :CFBuildDate $CFBuildDate\" $buildPlist\n# set Bundle version\n/usr/libexec/PlistBuddy -c \"Set :CFBundleVersion $CFBuildNumber\" $buildPlist\necho \"New build: $CFBundleShortVersionString (build: $CFBuildNumber) $CFBuildDate\""; }; /* End PBXShellScriptBuildPhase section */ @@ -366,7 +373,7 @@ buildActionMask = 2147483647; files = ( 8D11072D0486CEB800E47090 /* main.mm in Sources */, - 256AC3DA0F4B6AC300CF3369 /* AppDelegate.mm in Sources */, + 256AC3DA0F4B6AC300CF3369 /* AppController.mm in Sources */, 3CF9779E11C77A23004CD74C /* DataController.mm in Sources */, 3CF978C611C7B34C004CD74C /* DataSources.mm in Sources */, 3CF97F0F11C91F93004CD74C /* MachOLayout.mm in Sources */, @@ -382,6 +389,7 @@ 3CE7199F1333A4EF0005C4DA /* Layout.mm in Sources */, 3CF22E92144C8FC600380071 /* ObjC.mm in Sources */, 3C34A82B14892FF1005B53F6 /* FatLayout.mm in Sources */, + 3C46C7D91687C6ED00212190 /* PreferenceController.mm in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -420,6 +428,14 @@ name = Preferences.xib; sourceTree = ""; }; + 3C46C8491687DEE600212190 /* Credits.rtf */ = { + isa = PBXVariantGroup; + children = ( + 3C46C84A1687DEE600212190 /* English */, + ); + name = Credits.rtf; + sourceTree = ""; + }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ @@ -434,24 +450,23 @@ COPY_PHASE_STRIP = NO; CURRENT_PROJECT_VERSION = ""; GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_OBJC_GC = unsupported; GCC_INLINES_ARE_PRIVATE_EXTERN = YES; - GCC_MODEL_TUNING = ""; GCC_OPTIMIZATION_LEVEL = 0; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = Prefix.pch; - GCC_SYMBOLS_PRIVATE_EXTERN = YES; + GCC_SYMBOLS_PRIVATE_EXTERN = NO; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; GENERATE_PROFILING_CODE = NO; HEADER_SEARCH_PATHS = "$(SRCROOT)"; + INCLUDED_RECURSIVE_SEARCH_PATH_SUBDIRECTORIES = ""; INFOPLIST_FILE = Info.plist; INSTALL_PATH = /Applications; LIBRARY_SEARCH_PATHS = "$(SRCROOT)"; - MACOSX_DEPLOYMENT_TARGET = 10.6; + MACOSX_DEPLOYMENT_TARGET = 10.7; PRIVATE_HEADERS_FOLDER_PATH = ""; PRODUCT_NAME = MachOView; SDKROOT = macosx; - USER_HEADER_SEARCH_PATHS = ""; + USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/otool_disasm $(SRCROOT)/otool_disasm/include"; VALID_ARCHS = "$(inherited)"; VERSIONING_SYSTEM = ""; }; @@ -468,28 +483,27 @@ CURRENT_PROJECT_VERSION = ""; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_OBJC_GC = unsupported; GCC_INLINES_ARE_PRIVATE_EXTERN = YES; - GCC_MODEL_TUNING = ""; GCC_OPTIMIZATION_LEVEL = s; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = Prefix.pch; GCC_PREPROCESSOR_DEFINITIONS = NS_BLOCK_ASSERTIONS; - GCC_SYMBOLS_PRIVATE_EXTERN = YES; + GCC_SYMBOLS_PRIVATE_EXTERN = NO; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; GCC_WARN_UNUSED_FUNCTION = NO; GCC_WARN_UNUSED_VARIABLE = NO; GENERATE_PROFILING_CODE = NO; HEADER_SEARCH_PATHS = "$(SRCROOT)"; + INCLUDED_RECURSIVE_SEARCH_PATH_SUBDIRECTORIES = ""; INFOPLIST_FILE = Info.plist; INSTALL_PATH = /Applications; LIBRARY_SEARCH_PATHS = "$(SRCROOT)"; - MACOSX_DEPLOYMENT_TARGET = 10.6; + MACOSX_DEPLOYMENT_TARGET = 10.7; PRIVATE_HEADERS_FOLDER_PATH = ""; PRODUCT_NAME = MachOView; SDKROOT = macosx; SKIP_INSTALL = NO; - USER_HEADER_SEARCH_PATHS = ""; + USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/otool_disasm $(SRCROOT)/otool_disasm/include"; VALID_ARCHS = "$(inherited)"; VERSIONING_SYSTEM = ""; }; @@ -500,6 +514,7 @@ buildSettings = { ARCHS = "$(NATIVE_ARCH_ACTUAL)"; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_OBJCPP_ARC_ABI = YES; CODE_SIGN_IDENTITY = ""; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = dwarf; @@ -511,7 +526,7 @@ GCC_WARN_SIGN_COMPARE = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.7; + MACOSX_DEPLOYMENT_TARGET = 10.6; PRODUCT_NAME = MachOView; SDKROOT = macosx; STRIP_INSTALLED_PRODUCT = NO; @@ -524,6 +539,7 @@ buildSettings = { ARCHS = "$(NATIVE_ARCH_ACTUAL)"; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_OBJCPP_ARC_ABI = YES; CODE_SIGN_IDENTITY = ""; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; @@ -533,7 +549,7 @@ GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES; GCC_WARN_SIGN_COMPARE = YES; GCC_WARN_UNUSED_VARIABLE = NO; - MACOSX_DEPLOYMENT_TARGET = 10.7; + MACOSX_DEPLOYMENT_TARGET = 10.6; PRODUCT_NAME = MachOView; SDKROOT = macosx; STRIP_INSTALLED_PRODUCT = NO; diff --git a/otool_disasm/arm_disasm.c b/otool_disasm/arm_disasm.c index 282f977..a6eea8f 100644 --- a/otool_disasm/arm_disasm.c +++ b/otool_disasm/arm_disasm.c @@ -39,24 +39,6 @@ #include "ofile_print.h" #include "arm_disasm.h" -#ifdef HACKED_LLVM_DISASSEMBLER_INTERFACE -/* - * This is the HACKED llvm-mc disassembler interface for otool(1). - */ -typedef int (* RelocExprInfoFunc)(unsigned Opcode, - uint64_t Pc, const char **s, int *variant); - -extern -int -OtoolDisassembleInput( -const char *ProgName, -uint8_t *Bytes, -uint64_t BytesSize, -uint64_t Pc, -RelocExprInfoFunc getRelocExprInfo, -const char *arch_name); -#endif /* HACKED_LLVM_DISASSEMBLER_INTERFACE */ - /* Used by otool(1) to stay or switch out of thumb mode */ enum bool in_thumb = FALSE; @@ -217,7 +199,7 @@ void *TagBuf) op_info = (struct LLVMOpInfo1 *)TagBuf; value = op_info->Value; - /* make sure all feilds returned are zero if we don't set them */ + /* make sure all fields returned are zero if we don't set them */ memset(op_info, '\0', sizeof(struct LLVMOpInfo1)); op_info->Value = value; @@ -418,6 +400,9 @@ void *TagBuf) return(1); } + if(reloc_found == FALSE) + return(0); + op_info->AddSymbol.Present = 1; op_info->Value = offset; if(reloc_found){ @@ -902,52 +887,6 @@ LLVMDisasmContextRef dc) (dc); } -#ifdef HACKED_LLVM_DISASSEMBLER_INTERFACE -// These are defined in lib/Target/ARM/ARMGenInstrNames.inc -#define ARM__tBLXi_r9 2252 /* ARM::tBLXi_r9 */ - -// This is called by the HACKED llvm-mc disassembler. If it finds relocation -// information for the Pc it sets SymbolName and variant then returns 1, else -// it returns 0. -static -int -getRelocExprInfo( -unsigned Opcode, -uint64_t Pc, -const char **SymbolName, -int *variant) -{ - int32_t i; - struct relocation_info *relocs = dis_info.relocs; - uint32_t nrelocs = dis_info.nrelocs; - struct nlist *symbols = dis_info.symbols; - uint32_t nsymbols = dis_info.nsymbols; - char *strings = dis_info.strings; - uint32_t strings_size = dis_info.strings_size; - bfd_vma r_address = Pc - dis_info.sect_addr; - - if(Opcode != ARM__tBLXi_r9) - return(0); - - *variant = 0; - if(dis_info.verbose){ - for(i = 0; i < nrelocs; i++){ - if(relocs[i].r_address == r_address && relocs[i].r_extern){ - unsigned int r_symbolnum = relocs[i].r_symbolnum; - if(r_symbolnum < nsymbols){ - uint32_t n_strx = symbols[r_symbolnum].n_un.n_strx; - if(n_strx < strings_size){ - *SymbolName = strings + n_strx; - return(1); - } - } - } - } - } - return(0); -} -#endif /* HACKED_LLVM_DISASSEMBLER_INTERFACE */ - /* HACKS to avoid pulling in FSF binutils bfd/bfd-in2.h */ #define bfd_mach_arm_XScale 10 #define bfd_mach_arm_iWMMXt 12 @@ -1262,6 +1201,14 @@ static const struct opcode32 coprocessor_opcodes[] = {FPU_VFP_EXT_V1xD, 0x0c800b00, 0x0f900f00, "fstmia%0?xd%c\t%16-19r%21'!, %z3"}, {FPU_VFP_EXT_V1xD, 0x0c900a00, 0x0f900f00, "fldmias%c\t%16-19r%21'!, %y3"}, {FPU_VFP_EXT_V1xD, 0x0c900b00, 0x0f900f00, "fldmia%0?xd%c\t%16-19r%21'!, %z3"}, + {FPU_VFP_EXT_V1, 0x0ea00a00, 0x0fb00f50, "vfma%c.f32\t%y1, %y2, %y0"}, + {FPU_VFP_EXT_V1, 0x0ea00a40, 0x0fb00f50, "vfms%c.f32\t%y1, %y2, %y0"}, + {FPU_VFP_EXT_V1, 0x0ea00b00, 0x0fb00f50, "vfma%c.f64\t%z1, %z2, %z0"}, + {FPU_VFP_EXT_V1, 0x0ea00b40, 0x0fb00f50, "vfms%c.f64\t%z1, %z2, %z0"}, + {FPU_VFP_EXT_V1, 0x0e900a40, 0x0fb00f50, "vfnma%c.f32\t%y1, %y2, %y0"}, + {FPU_VFP_EXT_V1, 0x0e900a00, 0x0fb00f50, "vfnms%c.f32\t%y1, %y2, %y0"}, + {FPU_VFP_EXT_V1, 0x0e900b40, 0x0fb00f50, "vfnma%c.f64\t%z1, %z2, %z0"}, + {FPU_VFP_EXT_V1, 0x0e900b00, 0x0fb00f50, "vfnms%c.f64\t%z1, %z2, %z0"}, /* Cirrus coprocessor instructions. */ {ARM_CEXT_MAVERICK, 0x0d100400, 0x0f500f00, "cfldrs%c\tmvf%12-15d, %A"}, @@ -1465,6 +1412,8 @@ static const struct opcode32 neon_opcodes[] = {FPU_NEON_EXT_V1, 0xf3300110, 0xffb00f10, "vbif%c\t%12-15,22R, %16-19,7R, %0-3,5R"}, {FPU_NEON_EXT_V1, 0xf2000d00, 0xffa00f10, "vadd%c.f%20U0\t%12-15,22R, %16-19,7R, %0-3,5R"}, {FPU_NEON_EXT_V1, 0xf2000d10, 0xffa00f10, "vmla%c.f%20U0\t%12-15,22R, %16-19,7R, %0-3,5R"}, + {FPU_NEON_EXT_V1, 0xf2000c10, 0xffa00f10, "vfma%c.f%20U0\t%12-15,22R, %16-19,7R, %0-3,5R"}, + {FPU_NEON_EXT_V1, 0xf2200c10, 0xffa00f10, "vfms%c.f%20U0\t%12-15,22R, %16-19,7R, %0-3,5R"}, {FPU_NEON_EXT_V1, 0xf2000e00, 0xffa00f10, "vceq%c.f%20U0\t%12-15,22R, %16-19,7R, %0-3,5R"}, {FPU_NEON_EXT_V1, 0xf2000f00, 0xffa00f10, "vmax%c.f%20U0\t%12-15,22R, %16-19,7R, %0-3,5R"}, {FPU_NEON_EXT_V1, 0xf2000f10, 0xffa00f10, "vrecps%c.f%20U0\t%12-15,22R, %16-19,7R, %0-3,5R"}, @@ -4973,10 +4922,10 @@ print_insn (bfd_vma pc, struct disassemble_info *info, bfd_boolean little) /* Print the raw data, too. */ if(!Xflag) { - if(Qflag || qflag) + if(qflag) info->fprintf_func (info->stream, "\t"); info->fprintf_func (info->stream, "%08x", (unsigned int) given); - if(!Qflag && !qflag) + if(!qflag) info->fprintf_func (info->stream, "\t"); } } @@ -5015,11 +4964,11 @@ print_insn (bfd_vma pc, struct disassemble_info *info, bfd_boolean little) /* Print the raw data, too. */ if(!Xflag) { - if(Qflag || qflag) + if(qflag) info->fprintf_func (info->stream, "\t"); info->fprintf_func (info->stream, "%08x", (unsigned int) given); - if(!Qflag && !qflag) + if(!qflag) info->fprintf_func (info->stream, "\t"); } printer = print_insn_thumb32; @@ -5031,11 +4980,11 @@ print_insn (bfd_vma pc, struct disassemble_info *info, bfd_boolean little) /* Print the raw data, too. */ if(!Xflag) { - if(Qflag || qflag) + if(qflag) info->fprintf_func (info->stream, "\t"); info->fprintf_func (info->stream, " %04x", (unsigned int)given); - if(!Qflag && !qflag) + if(!qflag) info->fprintf_func (info->stream, "\t"); } } @@ -5083,14 +5032,6 @@ print_insn (bfd_vma pc, struct disassemble_info *info, bfd_boolean little) info->fprintf_func (info->stream, "\tinvalid instruction encoding"); } } -#ifdef HACKED_LLVM_DISASSEMBLER_INTERFACE - else if (Qflag) /* HACKED interface */ - { - if(OtoolDisassembleInput(progname, (uint8_t *)info->sect, size, pc, - getRelocExprInfo, llvm_arch_name) != 0) - info->fprintf_func (info->stream, "\tinvalid instruction encoding"); - } -#endif /* HACKED_LLVM_DISASSEMBLER_INTERFACE */ else printer (pc, info, given); @@ -5320,7 +5261,7 @@ enum bool pool) (r_type == ARM_RELOC_SECTDIFF || r_type == ARM_RELOC_LOCAL_SECTDIFF)){ if(!Xflag){ - if(Qflag || qflag) + if(qflag) fprintf(stream, "\t"); fprintf(stream, "%08x\t", value); } @@ -5543,6 +5484,74 @@ enum bool pool) return(TRUE); } +/* + * Print the section contents pointed to by sect as data .long, .short or .byte + * depending on its kind. + */ +static +uint32_t +print_data_in_code( +char *sect, +uint32_t sect_left, +uint32_t dice_left, +uint16_t kind) +{ + uint32_t value, left, size; + + left = dice_left; + if(left > sect_left) + left = sect_left; + switch(kind){ + default: + case DICE_KIND_DATA: + if(left >= 4){ + value = sect[3] << 24 | + sect[2] << 16 | + sect[1] << 8 | + sect[0]; + printf("%08x\t.long %u\t@ ", value, value); + size = 4; + } + else if(left >= 2){ + value = sect[1] << 8 | + sect[0]; + printf(" %04x\t.short %u\t@ ", value, value); + size = 2; + } + else { + value = sect[0]; + printf(" %02x\t.byte %u\t@ ", value & 0xff, value & 0xff); + size = 1; + } + if(kind == DICE_KIND_DATA) + printf("KIND_DATA \n"); + else + printf("kind = %u\n", kind); + return(size); + case DICE_KIND_JUMP_TABLE8: + value = sect[0]; + printf(" %02x\t.byte %3u\t@ KIND_JUMP_TABLE8\n", value,value); + return(1); + case DICE_KIND_JUMP_TABLE16: + value = sect[1] << 8 | + sect[0]; + printf(" %04x\t.short %5u\t@ KIND_JUMP_TABLE16\n", value & 0xffff ,value & 0xffff ); + return(2); + case DICE_KIND_JUMP_TABLE32: + case DICE_KIND_ABS_JUMP_TABLE32: + value = sect[3] << 24 | + sect[2] << 16 | + sect[1] << 8 | + sect[0]; + printf("%08x\t.long %u\t@ ", value, value); + if(kind == DICE_KIND_JUMP_TABLE32) + printf("KIND_JUMP_TABLE32\n"); + else + printf("KIND_ABS_JUMP_TABLE32\n"); + return(4); + } +} + /* Stubbed out for now */ /* Function called to determine if there is a symbol at the given ADDR. If there is, the function returns 1, otherwise it returns 0. @@ -5633,9 +5642,11 @@ enum bool verbose, LLVMDisasmContextRef arm_dc, LLVMDisasmContextRef thumb_dc, char *object_addr, -uint32_t object_size) +uint32_t object_size, +struct data_in_code_entry *dices, +uint32_t ndices) { - uint32_t bytes_consumed, pool_value; + uint32_t bytes_consumed, pool_value, i, offset; dis_info.fprintf_func = (fprintf_ftype)fprintf; dis_info.stream = stdout; @@ -5695,6 +5706,32 @@ uint32_t object_size) return(4); } + /* + * See if this address is has a data in code entry and if so print. + */ + if(ndices){ + /* TODO in final linked imagess, offset is from the base address */ + /* TODO in final linked imagess, offset is from first section address */ + if(nrelocs == 0) /* TODO better test for final linked image */ + offset = addr; + else + offset = addr - sect_addr; + for(i = 0; i < ndices; i++){ + if(offset >= dices[i].offset && + offset < dices[i].offset + dices[i].length){ + bytes_consumed = print_data_in_code(sect, left, + dices[i].offset + dices[i].length - offset, + dices[i].kind); + if ((dices[i].kind == DICE_KIND_JUMP_TABLE8) && + (offset == (dices[i].offset + dices[i].length - 1)) && + (dices[i].length & 1)) { + ++bytes_consumed; + } + return(bytes_consumed); + } + } + } + bytes_consumed = print_insn_little_arm(addr, &dis_info); printf("\n"); diff --git a/otool_disasm/arm_disasm.h b/otool_disasm/arm_disasm.h index 3ccbb9d..a75f5ec 100644 --- a/otool_disasm/arm_disasm.h +++ b/otool_disasm/arm_disasm.h @@ -62,7 +62,9 @@ extern uint32_t arm_disassemble( LLVMDisasmContextRef arm_dc, LLVMDisasmContextRef thumb_dc, char *object_addr, - uint32_t object_size); + uint32_t object_size, + struct data_in_code_entry *dices, + uint32_t ndices); extern LLVMDisasmContextRef create_arm_llvm_disassembler(void); extern LLVMDisasmContextRef create_thumb_llvm_disassembler(void); diff --git a/otool_disasm/disasm.xcodeproj/project.pbxproj b/otool_disasm/disasm.xcodeproj/project.pbxproj index 0302b1e..ad2e143 100644 --- a/otool_disasm/disasm.xcodeproj/project.pbxproj +++ b/otool_disasm/disasm.xcodeproj/project.pbxproj @@ -7,35 +7,42 @@ objects = { /* Begin PBXBuildFile section */ - 3CEF958F15BD898E00B5F891 /* arm_disasm.c in Sources */ = {isa = PBXBuildFile; fileRef = 3CEF958515BD898E00B5F891 /* arm_disasm.c */; }; - 3CEF959015BD898E00B5F891 /* bytesex.c in Sources */ = {isa = PBXBuildFile; fileRef = 3CEF958715BD898E00B5F891 /* bytesex.c */; }; - 3CEF959115BD898E00B5F891 /* i386_disasm.c in Sources */ = {isa = PBXBuildFile; fileRef = 3CEF958815BD898E00B5F891 /* i386_disasm.c */; }; - 3CEF959215BD898E00B5F891 /* llvm.c in Sources */ = {isa = PBXBuildFile; fileRef = 3CEF958A15BD898E00B5F891 /* llvm.c */; }; - 3CEF959315BD898E00B5F891 /* symbol.c in Sources */ = {isa = PBXBuildFile; fileRef = 3CEF958E15BD898E00B5F891 /* symbol.c */; }; - 3CEF959515BD89DD00B5F891 /* allocate.c in Sources */ = {isa = PBXBuildFile; fileRef = 3CEF959415BD89DD00B5F891 /* allocate.c */; }; - 3CEF959B15BD8ADC00B5F891 /* _main.c in Sources */ = {isa = PBXBuildFile; fileRef = 3CEF959A15BD8ADC00B5F891 /* _main.c */; }; - 3CEF959D15BD96E300B5F891 /* fatals.c in Sources */ = {isa = PBXBuildFile; fileRef = 3CEF959C15BD96E300B5F891 /* fatals.c */; }; + 3CDC216D16938243006CF053 /* main.c in Sources */ = {isa = PBXBuildFile; fileRef = 3CDC215F16938243006CF053 /* main.c */; }; + 3CDC216E16938243006CF053 /* allocate.c in Sources */ = {isa = PBXBuildFile; fileRef = 3CDC216016938243006CF053 /* allocate.c */; }; + 3CDC216F16938243006CF053 /* arm_disasm.c in Sources */ = {isa = PBXBuildFile; fileRef = 3CDC216116938243006CF053 /* arm_disasm.c */; }; + 3CDC217016938243006CF053 /* arm_disasm.h in Headers */ = {isa = PBXBuildFile; fileRef = 3CDC216216938243006CF053 /* arm_disasm.h */; }; + 3CDC217116938243006CF053 /* bytesex.c in Sources */ = {isa = PBXBuildFile; fileRef = 3CDC216316938243006CF053 /* bytesex.c */; }; + 3CDC217216938243006CF053 /* disasm.h in Headers */ = {isa = PBXBuildFile; fileRef = 3CDC216416938243006CF053 /* disasm.h */; }; + 3CDC217316938243006CF053 /* fatals.c in Sources */ = {isa = PBXBuildFile; fileRef = 3CDC216516938243006CF053 /* fatals.c */; }; + 3CDC217416938243006CF053 /* i386_disasm.c in Sources */ = {isa = PBXBuildFile; fileRef = 3CDC216616938243006CF053 /* i386_disasm.c */; }; + 3CDC217516938243006CF053 /* i386_disasm.h in Headers */ = {isa = PBXBuildFile; fileRef = 3CDC216716938243006CF053 /* i386_disasm.h */; }; + 3CDC217616938243006CF053 /* llvm.c in Sources */ = {isa = PBXBuildFile; fileRef = 3CDC216816938243006CF053 /* llvm.c */; }; + 3CDC217716938243006CF053 /* llvm.h in Headers */ = {isa = PBXBuildFile; fileRef = 3CDC216916938243006CF053 /* llvm.h */; }; + 3CDC217816938243006CF053 /* ofile_print.h in Headers */ = {isa = PBXBuildFile; fileRef = 3CDC216A16938243006CF053 /* ofile_print.h */; }; + 3CDC217916938243006CF053 /* otool.h in Headers */ = {isa = PBXBuildFile; fileRef = 3CDC216B16938243006CF053 /* otool.h */; }; + 3CDC217A16938243006CF053 /* symbol.c in Sources */ = {isa = PBXBuildFile; fileRef = 3CDC216C16938243006CF053 /* symbol.c */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ - 3CEF958515BD898E00B5F891 /* arm_disasm.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = arm_disasm.c; sourceTree = ""; }; - 3CEF958615BD898E00B5F891 /* arm_disasm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = arm_disasm.h; sourceTree = ""; }; - 3CEF958715BD898E00B5F891 /* bytesex.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bytesex.c; sourceTree = ""; }; - 3CEF958815BD898E00B5F891 /* i386_disasm.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = i386_disasm.c; sourceTree = ""; }; - 3CEF958915BD898E00B5F891 /* i386_disasm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = i386_disasm.h; sourceTree = ""; }; - 3CEF958A15BD898E00B5F891 /* llvm.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = llvm.c; sourceTree = ""; }; - 3CEF958B15BD898E00B5F891 /* llvm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = llvm.h; sourceTree = ""; }; - 3CEF958C15BD898E00B5F891 /* ofile_print.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ofile_print.h; sourceTree = ""; }; - 3CEF958D15BD898E00B5F891 /* otool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = otool.h; sourceTree = ""; }; - 3CEF958E15BD898E00B5F891 /* symbol.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = symbol.c; sourceTree = ""; }; - 3CEF959415BD89DD00B5F891 /* allocate.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = allocate.c; sourceTree = ""; }; - 3CEF959A15BD8ADC00B5F891 /* _main.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = _main.c; sourceTree = ""; }; - 3CEF959C15BD96E300B5F891 /* fatals.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = fatals.c; sourceTree = ""; }; - D2AAC046055464E500DB518D /* libdisasm.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libdisasm.a; sourceTree = BUILT_PRODUCTS_DIR; }; + 3CDC215316938207006CF053 /* libdisasm.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libdisasm.a; sourceTree = BUILT_PRODUCTS_DIR; }; + 3CDC215F16938243006CF053 /* main.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = main.c; sourceTree = ""; }; + 3CDC216016938243006CF053 /* allocate.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = allocate.c; sourceTree = ""; }; + 3CDC216116938243006CF053 /* arm_disasm.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = arm_disasm.c; sourceTree = ""; }; + 3CDC216216938243006CF053 /* arm_disasm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = arm_disasm.h; sourceTree = ""; }; + 3CDC216316938243006CF053 /* bytesex.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bytesex.c; sourceTree = ""; }; + 3CDC216416938243006CF053 /* disasm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = disasm.h; sourceTree = ""; }; + 3CDC216516938243006CF053 /* fatals.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = fatals.c; sourceTree = ""; }; + 3CDC216616938243006CF053 /* i386_disasm.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = i386_disasm.c; sourceTree = ""; }; + 3CDC216716938243006CF053 /* i386_disasm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = i386_disasm.h; sourceTree = ""; }; + 3CDC216816938243006CF053 /* llvm.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = llvm.c; sourceTree = ""; }; + 3CDC216916938243006CF053 /* llvm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = llvm.h; sourceTree = ""; }; + 3CDC216A16938243006CF053 /* ofile_print.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ofile_print.h; sourceTree = ""; }; + 3CDC216B16938243006CF053 /* otool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = otool.h; sourceTree = ""; }; + 3CDC216C16938243006CF053 /* symbol.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = symbol.c; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ - D289987405E68DCB004EDB86 /* Frameworks */ = { + 3CDC215016938207006CF053 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( @@ -45,200 +52,217 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 08FB7794FE84155DC02AAC07 /* Untitled */ = { + 3CDC214816938207006CF053 = { isa = PBXGroup; children = ( - 08FB7795FE84155DC02AAC07 /* Source */, - 1AB674ADFE9D54B511CA2CBB /* Products */, + 3CDC215D16938225006CF053 /* Source */, + 3CDC215416938207006CF053 /* Products */, ); - name = Untitled; sourceTree = ""; }; - 08FB7795FE84155DC02AAC07 /* Source */ = { + 3CDC215416938207006CF053 /* Products */ = { isa = PBXGroup; children = ( - 3CEF959415BD89DD00B5F891 /* allocate.c */, - 3CEF958515BD898E00B5F891 /* arm_disasm.c */, - 3CEF958615BD898E00B5F891 /* arm_disasm.h */, - 3CEF958715BD898E00B5F891 /* bytesex.c */, - 3CEF958815BD898E00B5F891 /* i386_disasm.c */, - 3CEF958915BD898E00B5F891 /* i386_disasm.h */, - 3CEF959C15BD96E300B5F891 /* fatals.c */, - 3CEF958A15BD898E00B5F891 /* llvm.c */, - 3CEF958B15BD898E00B5F891 /* llvm.h */, - 3CEF958C15BD898E00B5F891 /* ofile_print.h */, - 3CEF958D15BD898E00B5F891 /* otool.h */, - 3CEF958E15BD898E00B5F891 /* symbol.c */, - 3CEF959A15BD8ADC00B5F891 /* _main.c */, + 3CDC215316938207006CF053 /* libdisasm.a */, ); - name = Source; + name = Products; sourceTree = ""; }; - 1AB674ADFE9D54B511CA2CBB /* Products */ = { + 3CDC215D16938225006CF053 /* Source */ = { isa = PBXGroup; children = ( - D2AAC046055464E500DB518D /* libdisasm.a */, + 3CDC216416938243006CF053 /* disasm.h */, + 3CDC215F16938243006CF053 /* main.c */, + 3CDC216016938243006CF053 /* allocate.c */, + 3CDC216116938243006CF053 /* arm_disasm.c */, + 3CDC216216938243006CF053 /* arm_disasm.h */, + 3CDC216316938243006CF053 /* bytesex.c */, + 3CDC216516938243006CF053 /* fatals.c */, + 3CDC216616938243006CF053 /* i386_disasm.c */, + 3CDC216716938243006CF053 /* i386_disasm.h */, + 3CDC216816938243006CF053 /* llvm.c */, + 3CDC216916938243006CF053 /* llvm.h */, + 3CDC216A16938243006CF053 /* ofile_print.h */, + 3CDC216B16938243006CF053 /* otool.h */, + 3CDC216C16938243006CF053 /* symbol.c */, ); - name = Products; + name = Source; sourceTree = ""; }; /* End PBXGroup section */ +/* Begin PBXHeadersBuildPhase section */ + 3CDC215116938207006CF053 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 3CDC217016938243006CF053 /* arm_disasm.h in Headers */, + 3CDC217216938243006CF053 /* disasm.h in Headers */, + 3CDC217516938243006CF053 /* i386_disasm.h in Headers */, + 3CDC217716938243006CF053 /* llvm.h in Headers */, + 3CDC217816938243006CF053 /* ofile_print.h in Headers */, + 3CDC217916938243006CF053 /* otool.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + /* Begin PBXNativeTarget section */ - D2AAC045055464E500DB518D /* disasm */ = { + 3CDC215216938207006CF053 /* disasm */ = { isa = PBXNativeTarget; - buildConfigurationList = 1DEB91EB08733DB70010E9CD /* Build configuration list for PBXNativeTarget "disasm" */; + buildConfigurationList = 3CDC215716938207006CF053 /* Build configuration list for PBXNativeTarget "disasm" */; buildPhases = ( - D2AAC044055464E500DB518D /* Sources */, - D289987405E68DCB004EDB86 /* Frameworks */, - 3C565FA813ACB4FE00E2DD38 /* ShellScript */, + 3CDC214F16938207006CF053 /* Sources */, + 3CDC215016938207006CF053 /* Frameworks */, + 3CDC215116938207006CF053 /* Headers */, ); buildRules = ( ); dependencies = ( ); name = disasm; - productName = Untitled; - productReference = D2AAC046055464E500DB518D /* libdisasm.a */; + productName = disasm; + productReference = 3CDC215316938207006CF053 /* libdisasm.a */; productType = "com.apple.product-type.library.static"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ - 08FB7793FE84155DC02AAC07 /* Project object */ = { + 3CDC214A16938207006CF053 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0430; + LastUpgradeCheck = 0450; + ORGANIZATIONNAME = apple; }; - buildConfigurationList = 1DEB91EF08733DB70010E9CD /* Build configuration list for PBXProject "disasm" */; + buildConfigurationList = 3CDC214D16938207006CF053 /* Build configuration list for PBXProject "disasm" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; - hasScannedForEncodings = 1; + hasScannedForEncodings = 0; knownRegions = ( - English, - Japanese, - French, - German, + en, ); - mainGroup = 08FB7794FE84155DC02AAC07 /* Untitled */; + mainGroup = 3CDC214816938207006CF053; + productRefGroup = 3CDC215416938207006CF053 /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( - D2AAC045055464E500DB518D /* disasm */, + 3CDC215216938207006CF053 /* disasm */, ); }; /* End PBXProject section */ -/* Begin PBXShellScriptBuildPhase section */ - 3C565FA813ACB4FE00E2DD38 /* ShellScript */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "cp -f $BUILT_PRODUCTS_DIR/$EXECUTABLE_NAME ../ "; - }; -/* End PBXShellScriptBuildPhase section */ - /* Begin PBXSourcesBuildPhase section */ - D2AAC044055464E500DB518D /* Sources */ = { + 3CDC214F16938207006CF053 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 3CEF958F15BD898E00B5F891 /* arm_disasm.c in Sources */, - 3CEF959015BD898E00B5F891 /* bytesex.c in Sources */, - 3CEF959115BD898E00B5F891 /* i386_disasm.c in Sources */, - 3CEF959215BD898E00B5F891 /* llvm.c in Sources */, - 3CEF959315BD898E00B5F891 /* symbol.c in Sources */, - 3CEF959515BD89DD00B5F891 /* allocate.c in Sources */, - 3CEF959B15BD8ADC00B5F891 /* _main.c in Sources */, - 3CEF959D15BD96E300B5F891 /* fatals.c in Sources */, + 3CDC216D16938243006CF053 /* main.c in Sources */, + 3CDC216E16938243006CF053 /* allocate.c in Sources */, + 3CDC216F16938243006CF053 /* arm_disasm.c in Sources */, + 3CDC217116938243006CF053 /* bytesex.c in Sources */, + 3CDC217316938243006CF053 /* fatals.c in Sources */, + 3CDC217416938243006CF053 /* i386_disasm.c in Sources */, + 3CDC217616938243006CF053 /* llvm.c in Sources */, + 3CDC217A16938243006CF053 /* symbol.c in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin XCBuildConfiguration section */ - 1DEB91EC08733DB70010E9CD /* Debug */ = { + 3CDC215516938207006CF053 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_64_BIT)"; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; - GCC_MODEL_TUNING = G5; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; GCC_OPTIMIZATION_LEVEL = 0; - HEADER_SEARCH_PATHS = include; - INSTALL_PATH = /usr/local/lib; - PRODUCT_NAME = disasm; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.8; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; }; name = Debug; }; - 1DEB91ED08733DB70010E9CD /* Release */ = { + 3CDC215616938207006CF053 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_64_BIT)"; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_AUTO_VECTORIZATION = YES; - GCC_MODEL_TUNING = G5; - HEADER_SEARCH_PATHS = include; - INSTALL_PATH = /usr/local/lib; - PRODUCT_NAME = disasm; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.8; + SDKROOT = macosx; }; name = Release; }; - 1DEB91F008733DB70010E9CD /* Debug */ = { + 3CDC215816938207006CF053 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = "$(ARCHS_STANDARD_64_BIT)"; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = macosx; - VALID_ARCHS = "i386 x86_64"; + EXECUTABLE_PREFIX = lib; + HEADER_SEARCH_PATHS = include; + PRODUCT_NAME = "$(TARGET_NAME)"; + VALID_ARCHS = x86_64; }; name = Debug; }; - 1DEB91F108733DB70010E9CD /* Release */ = { + 3CDC215916938207006CF053 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = "$(ARCHS_STANDARD_64_BIT)"; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - SDKROOT = macosx; - VALID_ARCHS = "i386 x86_64"; + EXECUTABLE_PREFIX = lib; + HEADER_SEARCH_PATHS = include; + PRODUCT_NAME = "$(TARGET_NAME)"; + VALID_ARCHS = x86_64; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ - 1DEB91EB08733DB70010E9CD /* Build configuration list for PBXNativeTarget "disasm" */ = { + 3CDC214D16938207006CF053 /* Build configuration list for PBXProject "disasm" */ = { isa = XCConfigurationList; buildConfigurations = ( - 1DEB91EC08733DB70010E9CD /* Debug */, - 1DEB91ED08733DB70010E9CD /* Release */, + 3CDC215516938207006CF053 /* Debug */, + 3CDC215616938207006CF053 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 1DEB91EF08733DB70010E9CD /* Build configuration list for PBXProject "disasm" */ = { + 3CDC215716938207006CF053 /* Build configuration list for PBXNativeTarget "disasm" */ = { isa = XCConfigurationList; buildConfigurations = ( - 1DEB91F008733DB70010E9CD /* Debug */, - 1DEB91F108733DB70010E9CD /* Release */, + 3CDC215816938207006CF053 /* Debug */, + 3CDC215916938207006CF053 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; - rootObject = 08FB7793FE84155DC02AAC07 /* Project object */; + rootObject = 3CDC214A16938207006CF053 /* Project object */; } diff --git a/otool_disasm/i386_disasm.c b/otool_disasm/i386_disasm.c index 91ce3a8..a1d2fc0 100644 --- a/otool_disasm/i386_disasm.c +++ b/otool_disasm/i386_disasm.c @@ -59,8 +59,10 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #include #include +#include #include "stuff/symbol.h" #include "stuff/bytesex.h" +#include "stuff/llvm.h" #include "otool.h" #include "ofile_print.h" #include "i386_disasm.h" @@ -1595,6 +1597,42 @@ static unsigned int xmm_rm(int r_m, int rex) return (r_m + (REX_B(rex) << 3)); } +/* + * This is passed to the llvm disassembler. + */ +struct disassemble_info { + enum bool verbose; + /* Relocation information. */ + struct relocation_info *sorted_relocs; + uint32_t nsorted_relocs; + /* Symbol table. */ + struct nlist *symbols; + struct nlist_64 *symbols64; + uint32_t nsymbols; + /* Symbols sorted by address. */ + struct symbol *sorted_symbols; + uint32_t nsorted_symbols; + /* String table. */ + char *strings; + uint32_t strings_size; + /* Other useful info. */ + uint32_t ncmds; + uint32_t sizeofcmds; + struct load_command *load_commands; + enum byte_sex object_byte_sex; + uint32_t *indirect_symbols; + uint32_t nindirect_symbols; + char *sect; + uint32_t left; + uint32_t addr; + uint32_t sect_addr; + cpu_type_t cputype; + LLVMDisasmContextRef i386_dc; + LLVMDisasmContextRef x86_64_dc; + char *object_addr; + uint32_t object_size; +} dis_info; + /* * i386_disassemble() */ @@ -1621,7 +1659,11 @@ struct load_command *load_commands, uint32_t ncmds, uint32_t sizeofcmds, enum bool verbose, -enum bool llvm_mc) +enum bool llvm_mc, +LLVMDisasmContextRef i386_dc, +LLVMDisasmContextRef x86_64_dc, +char *object_addr, +uint32_t object_size) { char mnemonic[MAX_MNEMONIC+2]; /* one extra for suffix */ const char *seg; @@ -1654,6 +1696,50 @@ enum bool llvm_mc) return(0); } + /* Use the llvm disassembler with the -q flag. */ + if(qflag){ + LLVMDisasmContextRef dc; + char dst[4096]; + + dst[4095] = '\0'; + dis_info.verbose = verbose; + dis_info.sorted_relocs = sorted_relocs; + dis_info.nsorted_relocs = nsorted_relocs; + dis_info.symbols = symbols; + dis_info.symbols64 = symbols64; + dis_info.nsymbols = nsymbols; + dis_info.sorted_symbols = sorted_symbols; + dis_info.nsorted_symbols = nsorted_symbols; + dis_info.strings = strings; + dis_info.strings_size = strings_size; + dis_info.load_commands = load_commands; + dis_info.object_byte_sex = object_byte_sex; + dis_info.indirect_symbols = indirect_symbols; + dis_info.nindirect_symbols = nindirect_symbols; + dis_info.ncmds = ncmds; + dis_info.sizeofcmds = sizeofcmds; + dis_info.sect = sect; + dis_info.left = left; + dis_info.addr = addr; + dis_info.sect_addr = sect_addr; + dis_info.cputype = cputype; + dis_info.object_addr = object_addr; + dis_info.object_size = object_size; + if(cputype == CPU_TYPE_I386) + dc = i386_dc; + else + dc = x86_64_dc; + length = llvm_disasm_instruction(dc, (uint8_t *)sect, left, + addr, dst, 4095); + if(length != 0) + printf("%s\n", dst); + else{ + printf("\t.byte 0x%02x #bad opcode\n", 0xff & sect[0]); + length = 1; + } + return(length); + } + memset(mnemonic, '\0', sizeof(mnemonic)); seg = ""; symbol0 = NULL; @@ -4155,6 +4241,20 @@ const enum bool verbose) n_strx = symbols64[r_symbolnum].n_un.n_strx; if(n_strx <= 0 || n_strx >= strings_size) return; + if((cputype & CPU_ARCH_ABI64) == CPU_ARCH_ABI64 && + relocs[i].r_type == X86_64_RELOC_SUBTRACTOR && + i+1 < nrelocs && + relocs[i+1].r_type == X86_64_RELOC_UNSIGNED && + relocs[i+1].r_extern == 1 && + relocs[i+1].r_symbolnum < nsymbols){ + *symsub = strings + n_strx; + r_symbolnum = relocs[i+1].r_symbolnum; + if(symbols64 == NULL) + return; + n_strx = symbols64[r_symbolnum].n_un.n_strx; + if(n_strx <= 0 || n_strx >= strings_size) + return; + } *symadd = strings + n_strx; return; } @@ -4265,3 +4365,529 @@ unsigned char byte) *reg = byte >> 3 & 0x7; /* register field from the byte */ *mode = byte >> 6 & 0x3; /* mode field from the byte */ } + +/* + * i386GetOpInfo() is the operand information call back function for i386 code. + * This is called to get the symbolic information for an operand of an i386 + * instruction. This is done from the relocation information, symbol table, + * etc. That block of information is a pointer to the struct disassemble_info + * that was passed when the disassembler context was created and passed to back + * to i386GetOpInfo() when called back by LLVMDisasmInstruction(). The address + * of the instruction containing operand is at the Pc parameter. The immediate + * for the operand is at Offset past the start of the instruction and has a byte + * Width of 1, 2 or 4. The information is returned in TagBuf is the + * LLVMOpInfo1 struct defined in "llvm-c/Disassembler.h". The value of TagType + * is currently 1 (for the LLVMOpInfo1 struct). If symbolic information is + * returned then this function returns 1 else it returns 0. + */ +static +int +i386GetOpInfo( +void *DisInfo, +uint64_t Pc, +uint64_t Offset, +uint64_t Width, +int TagType, /* should currently always be passed as 1 */ +void *TagBuf) +{ + struct disassemble_info *info; + struct LLVMOpInfo1 *op_info; + unsigned int value; + int32_t reloc_found, offset; + uint32_t sect_offset, i, r_address, r_symbolnum, r_type, r_extern, r_length, + r_value, r_scattered, pair_r_type, pair_r_value; + uint32_t other_half; + const char *strings, *name, *add, *sub; + struct relocation_info *relocs, *rp, *pairp; + struct scattered_relocation_info *srp, *spairp; + uint32_t nrelocs, strings_size, n_strx; + struct nlist *symbols; + + info = (struct disassemble_info *)DisInfo; + + op_info = (struct LLVMOpInfo1 *)TagBuf; + value = op_info->Value; + /* make sure all feilds returned are zero if we don't set them */ + memset(op_info, '\0', sizeof(struct LLVMOpInfo1)); + op_info->Value = value; + + if((Width != 1 && Width != 2 && Width != 4) || TagType != 1 || + info->verbose == FALSE) + return(0); + + sect_offset = (Pc + Offset) - info->sect_addr; + relocs = info->sorted_relocs; + nrelocs = info->nsorted_relocs; + symbols = info->symbols; + strings = info->strings; + strings_size = info->strings_size; + + r_symbolnum = 0; + r_type = 0; + r_extern = 0; + r_value = 0; + r_scattered = 0; + other_half = 0; + pair_r_value = 0; + n_strx = 0; + r_length = 0; + + /* + * When searching for a relocation entry for this sect_offset we simply + * return if we run into errors. + */ + reloc_found = 0; + for(i = 0; i < nrelocs; i++){ + rp = &relocs[i]; + if(rp->r_address & R_SCATTERED){ + srp = (struct scattered_relocation_info *)rp; + r_scattered = 1; + r_address = srp->r_address; + r_extern = 0; + r_length = srp->r_length; + r_type = srp->r_type; + r_value = srp->r_value; + } + else{ + r_scattered = 0; + r_address = rp->r_address; + r_symbolnum = rp->r_symbolnum; + r_extern = rp->r_extern; + r_length = rp->r_length; + r_type = rp->r_type; + } + if(r_type == GENERIC_RELOC_PAIR){ + /* Error stray GENERIC_RELOC_PAIR relocation entry. */ + return(0); + } + if(r_address == sect_offset){ + if(r_type == GENERIC_RELOC_SECTDIFF || + r_type == GENERIC_RELOC_LOCAL_SECTDIFF){ + if(i+1 < nrelocs){ + pairp = &rp[1]; + if(pairp->r_address & R_SCATTERED){ + spairp = (struct scattered_relocation_info *) + pairp; + pair_r_type = spairp->r_type; + pair_r_value = spairp->r_value; + } + else{ + pair_r_type = pairp->r_type; + } + if(pair_r_type != GENERIC_RELOC_PAIR){ + /* Error missing GENERIC_RELOC_PAIR relocation. */ + return(0); + } + } + } + reloc_found = 1; + break; + } + if(r_type == GENERIC_RELOC_SECTDIFF || + r_type == GENERIC_RELOC_LOCAL_SECTDIFF){ + if(i+1 < nrelocs){ + pairp = &rp[1]; + if(pairp->r_address & R_SCATTERED){ + spairp = (struct scattered_relocation_info *)pairp; + pair_r_type = spairp->r_type; + } + else{ + pair_r_type = pairp->r_type; + } + if(pair_r_type == GENERIC_RELOC_PAIR) + i++; + else{ + /* Error missing GENERIC_RELOC_PAIR relocation. */ + return(0); + } + } + } + } + + if(reloc_found && r_extern == 1){ + if(symbols != NULL) + n_strx = symbols[r_symbolnum].n_un.n_strx; + if(n_strx >= strings_size){ + /* Error bad string offset. */ + return(0); + } + name = strings + n_strx; + op_info->AddSymbol.Present = 1; + op_info->AddSymbol.Name = name; + /* + * For i386 extern relocation entries the value in the instrucion is + * the offset from the symbol. + */ + op_info->Value = value; + return(1); + } + + if(reloc_found && + (r_type == GENERIC_RELOC_SECTDIFF || + r_type == GENERIC_RELOC_LOCAL_SECTDIFF)){ + add = guess_symbol(r_value, info->sorted_symbols, + info->nsorted_symbols, info->verbose); + sub = guess_symbol(pair_r_value, info->sorted_symbols, + info->nsorted_symbols, info->verbose); + offset = value - (r_value - pair_r_value); + op_info->AddSymbol.Present = 1; + if(add != NULL) + op_info->AddSymbol.Name = add; + else + op_info->AddSymbol.Value = r_value; + op_info->SubtractSymbol.Present = 1; + if(sub != NULL) + op_info->SubtractSymbol.Name = sub; + else + op_info->SubtractSymbol.Value = pair_r_value; + op_info->Value = offset; + return(1); + } + + /* We found no symbolic info so just return zero indicating that. */ + return(0); +} + +/* + * x86_64GetOpInfo() is the operand information call back function for x86_64 + * code. This is called to get the symbolic information for an operand of an + * x86_64 instruction. This is done from the relocation information, symbol + * table, etc. That block of information is a pointer to the struct + * disassemble_info that was passed when the disassembler context was created + * and passed to back to x86_64GetOpInfo() when called back by + * LLVMDisasmInstruction(). The address of the instruction containing operand + * is at the Pc parameter. The immediate for the operand is at Offset past the + * start of the instruction and has a byte Width of 1, 2 or 4. The information + * is returned in TagBuf is the LLVMOpInfo1 struct defined in + * "llvm-c/Disassembler.h". The value of TagType is currently 1 (for the + * LLVMOpInfo1 struct). If symbolic information is returned then this function + * returns 1 else it returns 0. + */ +static +int +x86_64GetOpInfo( +void *DisInfo, +uint64_t Pc, +uint64_t Offset, +uint64_t Width, +int TagType, /* should currently always be passed as 1 */ +void *TagBuf) +{ + struct disassemble_info *info; + struct LLVMOpInfo1 *op_info; + unsigned int value; + int32_t reloc_found; + uint32_t sect_offset, i; + const char *strings, *name; + struct relocation_info *relocs; + uint32_t nrelocs, strings_size, n_strx; + struct nlist_64 *symbols; + + info = (struct disassemble_info *)DisInfo; + + op_info = (struct LLVMOpInfo1 *)TagBuf; + value = op_info->Value; + /* make sure all fields returned are zero if we don't set them */ + memset(op_info, '\0', sizeof(struct LLVMOpInfo1)); + op_info->Value = value; + + if((Width != 1 && Width != 2 && Width != 4 && Width != 0) || + TagType != 1 || + info->verbose == FALSE) + return(0); + + sect_offset = (Pc + Offset) - info->sect_addr; + relocs = info->sorted_relocs; + nrelocs = info->nsorted_relocs; + symbols = info->symbols64; + strings = info->strings; + strings_size = info->strings_size; + + reloc_found = 0; + for(i = 0; i < nrelocs; i++){ + /* We could also check the Width matches the r_length. */ + if(relocs[i].r_address == sect_offset){ + reloc_found = 1; + break; + } + } + + if(reloc_found && relocs[i].r_extern == 1){ + /* + * The Value passed in will be adjusted by the Pc if the instruction + * adds the Pc. But for x86_64 external relocation entries the + * Value is the offset from the external symbol. + */ + if(relocs[i].r_pcrel == 1) + op_info->Value -= Pc + Offset + Width; + if(symbols != NULL) + n_strx = symbols[relocs[i].r_symbolnum].n_un.n_strx; + if(n_strx >= strings_size) + return(0); + name = strings + n_strx; + if(relocs[i].r_type == X86_64_RELOC_SUBTRACTOR && + i+1 < nrelocs && + relocs[i+1].r_type == X86_64_RELOC_UNSIGNED && + relocs[i+1].r_extern == 1){ + op_info->SubtractSymbol.Present = 1; + op_info->SubtractSymbol.Name = name; + if(symbols != NULL) + n_strx = symbols[relocs[i+1].r_symbolnum].n_un.n_strx; + if(n_strx >= strings_size) + return(0); + name = strings + n_strx; + } + op_info->AddSymbol.Present = 1; + op_info->AddSymbol.Name = name; + return(1); + } + + /* We found no symbolic info so just return zero indicating that. */ + return(0); +} + +/* + * guess_cstring_pointer() is passed the address of what might be a pointer to a + * literal string in a cstring section. If that address is in a cstring section + * it returns a pointer to that string. Else it returns NULL. + */ +static +const char * +guess_cstring_pointer( +const uint64_t value, +const uint32_t ncmds, +const uint32_t sizeofcmds, +const struct load_command *load_commands, +const enum byte_sex load_commands_byte_sex, +const char *object_addr, +const uint64_t object_size) +{ + enum byte_sex host_byte_sex; + enum bool swapped; + uint32_t i, j, section_type; + uint64_t sect_offset, object_offset; + const struct load_command *lc; + struct load_command l; + struct segment_command_64 sg64; + struct section_64 s64; + char *p; + uint64_t big_load_end; + const char *name; + + host_byte_sex = get_host_byte_sex(); + swapped = host_byte_sex != load_commands_byte_sex; + + lc = load_commands; + big_load_end = 0; + for(i = 0 ; i < ncmds; i++){ + memcpy((char *)&l, (char *)lc, sizeof(struct load_command)); + if(swapped) + swap_load_command(&l, host_byte_sex); + if(l.cmdsize % sizeof(int32_t) != 0) + return(NULL); + big_load_end += l.cmdsize; + if(big_load_end > sizeofcmds) + return(NULL); + switch(l.cmd){ + case LC_SEGMENT_64: + memcpy((char *)&sg64, (char *)lc, + sizeof(struct segment_command_64)); + if(swapped) + swap_segment_command_64(&sg64, host_byte_sex); + p = (char *)lc + sizeof(struct segment_command_64); + for(j = 0 ; j < sg64.nsects ; j++){ + memcpy((char *)&s64, p, sizeof(struct section_64)); + p += sizeof(struct section_64); + if(swapped) + swap_section_64(&s64, 1, host_byte_sex); + section_type = s64.flags & SECTION_TYPE; + if(section_type == S_CSTRING_LITERALS && + value >= s64.addr && value < s64.addr + s64.size){ + sect_offset = value - s64.addr; + object_offset = s64.offset + sect_offset; + if(object_offset < object_size){ + name = object_addr + object_offset; + return(name); + } + else + return(NULL); + } + } + break; + } + if(l.cmdsize == 0){ + return(NULL); + } + lc = (struct load_command *)((char *)lc + l.cmdsize); + if((char *)lc > (char *)load_commands + sizeofcmds) + return(NULL); + } + return(NULL); +} + +/* + * guess_literal_pointer() returns a pointer to a literal string if the value + * passed in is the address of a literal pointer and the literal pointer's value + * is and address of a cstring. + */ +static +const char * +guess_literal_pointer( +uint64_t value, /* the value of the reference */ +const uint64_t pc, /* pc of the referencing instruction */ +uint64_t *reference_type, /* type returned, symbol name or string literal*/ +struct disassemble_info *info) +{ + uint32_t reloc_found, sect_offset, i, nrelocs, ncmds, sizeofcmds; + struct relocation_info *relocs; + struct nlist_64 *symbols; + struct load_command *load_commands; + enum byte_sex object_byte_sex; + char *object_addr; + uint64_t object_size; + const char *name; + + /* + * First see if there is a relocation entry. + */ + sect_offset = pc - info->sect_addr; + relocs = info->sorted_relocs; + nrelocs = info->nsorted_relocs; + symbols = info->symbols64; + + reloc_found = 0; + for(i = 0; i < nrelocs; i++){ + if(relocs[i].r_address == sect_offset){ + reloc_found = 1; + break; + } + } + + /* + * If there is an external relocation entry for a symbol in a section + * then used that symbol's value for the value of the reference. + */ + if(reloc_found && relocs[i].r_extern == 1){ + if(relocs[i].r_pcrel == 1 && + relocs[i].r_type == X86_64_RELOC_SIGNED && + relocs[i].r_symbolnum < info->nsymbols && + symbols != NULL && + (symbols[relocs[i].r_symbolnum].n_type & N_TYPE) == N_SECT){ + value = symbols[relocs[i].r_symbolnum].n_value; + } + } + + ncmds = info->ncmds; + sizeofcmds = info->sizeofcmds; + load_commands = info->load_commands; + object_byte_sex = info->object_byte_sex; + object_addr = info->object_addr; + object_size = info->object_size; + + /* + * See if the value is pointing to a cstring. + */ + name = guess_cstring_pointer(value, ncmds, sizeofcmds, load_commands, + object_byte_sex, object_addr, object_size); + if(name != NULL){ + *reference_type = + LLVMDisassembler_ReferenceType_Out_LitPool_CstrAddr; + return(name); + } + + return(NULL); +} + +/* + * The symbol lookup function passed to LLVMCreateDisasm(). It looks up the + * SymbolValue using the info passed vis the pointer to the struct + * disassemble_info that was passed when disassembler context is created and + * returns the symbol name that matches or NULL if none. + * + * When this is called to get a symbol name for a branch target then the + * ReferenceType can be LLVMDisassembler_ReferenceType_In_Branch and then + * SymbolValue will be looked for in the indirect symbol table to determine if + * it is an address for a symbol stub. If so then the symbol name for that + * stub is returned indirectly through ReferenceName and then ReferenceType is + * set to LLVMDisassembler_ReferenceType_Out_SymbolStub. + */ +static +const char * +SymbolLookUp( +void *DisInfo, +uint64_t SymbolValue, +uint64_t *ReferenceType, +uint64_t ReferencePC, +const char **ReferenceName) +{ + struct disassemble_info *info; + const char *SymbolName; + + info = (struct disassemble_info *)DisInfo; + if(info->verbose == FALSE){ + *ReferenceName = NULL; + *ReferenceType = LLVMDisassembler_ReferenceType_InOut_None; + return(NULL); + } + SymbolName = guess_symbol(SymbolValue, info->sorted_symbols, + info->nsorted_symbols, TRUE); + + if(*ReferenceType == LLVMDisassembler_ReferenceType_In_Branch){ + *ReferenceName = guess_indirect_symbol(SymbolValue, + info->ncmds, info->sizeofcmds, info->load_commands, + info->object_byte_sex, info->indirect_symbols, + info->nindirect_symbols, info->symbols, info->symbols64, + info->nsymbols, info->strings, info->strings_size); + if(*ReferenceName != NULL) + *ReferenceType = LLVMDisassembler_ReferenceType_Out_SymbolStub; + else + *ReferenceType = LLVMDisassembler_ReferenceType_InOut_None; + } + else if(*ReferenceType == LLVMDisassembler_ReferenceType_In_PCrel_Load){ + *ReferenceName = guess_literal_pointer(SymbolValue, ReferencePC, + ReferenceType, info); + if(*ReferenceName == NULL) + *ReferenceType = LLVMDisassembler_ReferenceType_InOut_None; + } + else{ + *ReferenceName = NULL; + *ReferenceType = LLVMDisassembler_ReferenceType_InOut_None; + } + return(SymbolName); +} + +LLVMDisasmContextRef +create_i386_llvm_disassembler( +void) +{ + LLVMDisasmContextRef dc; + + dc = llvm_create_disasm("i386-apple-darwin10", &dis_info, 1, + i386GetOpInfo, SymbolLookUp); + return(dc); +} + +void +delete_i386_llvm_disassembler( +LLVMDisasmContextRef dc) +{ + llvm_disasm_dispose(dc); +} + +LLVMDisasmContextRef +create_x86_64_llvm_disassembler( +void) +{ + LLVMDisasmContextRef dc; + + dc = llvm_create_disasm("x86_64-apple-darwin10", &dis_info, 1, + x86_64GetOpInfo, SymbolLookUp); + return(dc); +} + +void +delete_x86_64_llvm_disassembler( +LLVMDisasmContextRef dc) +{ + llvm_disasm_dispose(dc); +} diff --git a/otool_disasm/i386_disasm.h b/otool_disasm/i386_disasm.h index 2e1c980..601ec14 100644 --- a/otool_disasm/i386_disasm.h +++ b/otool_disasm/i386_disasm.h @@ -33,6 +33,7 @@ #import #import #include "stuff/symbol.h" +#include "llvm-c/Disassembler.h" extern uint32_t i386_disassemble( char *sect, @@ -56,4 +57,13 @@ extern uint32_t i386_disassemble( uint32_t ncmds, uint32_t sizeofcmds, enum bool verbose, - enum bool llvm_mc); + enum bool llvm_mc, + LLVMDisasmContextRef i386_dc, + LLVMDisasmContextRef x86_64_dc, + char *object_addr, + uint32_t object_size); + +extern LLVMDisasmContextRef create_i386_llvm_disassembler(void); +extern void delete_i386_llvm_disassembler(LLVMDisasmContextRef dc); +extern LLVMDisasmContextRef create_x86_64_llvm_disassembler(void); +extern void delete_x86_64_llvm_disassembler(LLVMDisasmContextRef dc);