Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(64)

Side by Side Diff: class-dump/src/CDClassDumpVisitor.m

Issue 7793008: Add the 3.3.3 sources for class-dump. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/
Patch Set: Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « class-dump/src/CDClassDumpVisitor.h ('k') | class-dump/src/CDClassFrameworkVisitor.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // -*- mode: ObjC -*-
2
3 // This file is part of class-dump, a utility for examining the Objective-C seg ment of Mach-O files.
4 // Copyright (C) 1997-1998, 2000-2001, 2004-2010 Steve Nygard.
5
6 #import "CDClassDumpVisitor.h"
7
8 #include <mach-o/arch.h>
9
10 #import "NSArray-Extensions.h"
11 #import "CDClassDump.h"
12 #import "CDObjectiveCProcessor.h"
13 #import "CDMachOFile.h"
14 #import "CDOCProtocol.h"
15 #import "CDLCDylib.h"
16 #import "CDLCEncryptionInfo.h"
17 #import "CDLCRunPath.h"
18 #import "CDLCSegment.h"
19 #import "CDOCClass.h"
20 #import "CDOCCategory.h"
21 #import "CDSymbolReferences.h"
22 #import "CDTypeController.h"
23
24 @implementation CDClassDumpVisitor
25
26 - (void)willBeginVisiting;
27 {
28 [super willBeginVisiting];
29
30 [classDump appendHeaderToString:resultString];
31
32 if ([classDump containsObjectiveCData] || [classDump hasEncryptedFiles]) {
33 [[classDump typeController] appendStructuresToString:resultString symbol References:nil];
34 //[resultString appendString:@"// [structures go here]\n"];
35 } else {
36 [resultString appendString:@"This file does not contain any Objective-C runtime information.\n"];
37 }
38 }
39
40 - (void)didEndVisiting;
41 {
42 [super didEndVisiting];
43
44 [self writeResultToStandardOutput];
45 }
46
47 - (void)visitObjectiveCProcessor:(CDObjectiveCProcessor *)aProcessor;
48 {
49 CDMachOFile *machOFile;
50 const NXArchInfo *archInfo;
51
52 machOFile = [aProcessor machOFile];
53
54 [resultString appendString:@"#pragma mark -\n\n"];
55 [resultString appendString:@"/*\n"];
56 [resultString appendFormat:@" * File: %@\n", [machOFile filename]];
57 [resultString appendFormat:@" * UUID: %@\n", [machOFile uuidString]];
58
59 archInfo = NXGetArchInfoFromCpuType([machOFile cputypePlusArchBits], [machOF ile cpusubtype]);
60 //archInfo = [machOFile archInfo];
61 if (archInfo == NULL)
62 [resultString appendFormat:@" * Arch: cputype: 0x%x, cpusubtype: 0x%x\n" , [machOFile cputype], [machOFile cpusubtype]];
63 else
64 [resultString appendFormat:@" * Arch: %s (%s)\n", archInfo->description, archInfo->name];
65
66 if ([machOFile filetype] == MH_DYLIB) {
67 CDLCDylib *identifier;
68
69 identifier = [machOFile dylibIdentifier];
70 if (identifier != nil)
71 [resultString appendFormat:@" * Current version: %@, Compatibi lity version: %@\n",
72 [identifier formattedCurrentVersion], [identifier form attedCompatibilityVersion]];
73 }
74
75 [resultString appendFormat:@" *\n"];
76 [resultString appendFormat:@" * Objective-C Garbage Collection: %@\n", [aProcessor garbageCollectionStatus]];
77
78 for (CDLoadCommand *loadCommand in [machOFile loadCommands]) {
79 if ([loadCommand isKindOfClass:[CDLCRunPath class]]) {
80 CDLCRunPath *runPath = (CDLCRunPath *)loadCommand;
81
82 [resultString appendFormat:@" * Run path: %@\n", [runPath path ]];
83 [resultString appendFormat:@" * = %@\n", [runPath reso lvedRunPath]];
84 }
85 }
86
87 if ([machOFile isEncrypted]) {
88 [resultString appendString:@" * This file is encrypted:\n"];
89 for (CDLoadCommand *loadCommand in [machOFile loadCommands]) {
90 if ([loadCommand isKindOfClass:[CDLCEncryptionInfo class]]) {
91 CDLCEncryptionInfo *encryptionInfo = (CDLCEncryptionInfo *)loadC ommand;
92
93 [resultString appendFormat:@" * cryptid: 0x%08x, crypt off: 0x%08x, cryptsize: 0x%08x\n",
94 [encryptionInfo cryptid], [encryptionInfo cryptoff ], [encryptionInfo cryptsize]];
95 }
96 }
97 } else if ([machOFile hasProtectedSegments]) {
98 if ([machOFile canDecryptAllSegments]) {
99 [resultString appendString:@" * This file has protected segmen ts, decrypting.\n"];
100 } else {
101 NSUInteger index = 0;
102
103 [resultString appendString:@" * This file has protected segmen ts that can't be decrypted:\n"];
104 for (CDLoadCommand *loadCommand in [machOFile loadCommands]) {
105 if ([loadCommand isKindOfClass:[CDLCSegment class]]) {
106 CDLCSegment *segment = (CDLCSegment *)loadCommand;
107
108 if ([segment canDecrypt] == NO) {
109 [resultString appendFormat:@" * Load command % u, segment encryption: %@\n",
110 index, CDSegmentEncryptionTypeName([segmen t encryptionType])];
111 }
112 }
113
114 index++;
115 }
116 }
117 }
118 [resultString appendString:@" */\n\n"];
119 }
120
121 @end
OLDNEW
« no previous file with comments | « class-dump/src/CDClassDumpVisitor.h ('k') | class-dump/src/CDClassFrameworkVisitor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698