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

Side by Side Diff: class-dump/src/CDFatArch.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/CDFatArch.h ('k') | class-dump/src/CDFatFile.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 "CDFatArch.h"
7
8 #import "CDDataCursor.h"
9 #import "CDFatFile.h"
10 #import "CDMachOFile.h"
11
12 @implementation CDFatArch
13
14 - (id)initWithDataCursor:(CDDataCursor *)cursor;
15 {
16 if ([super init] == nil)
17 return nil;
18
19 nonretained_fatFile = nil;
20
21 fatArch.cputype = [cursor readBigInt32];
22 fatArch.cpusubtype = [cursor readBigInt32];
23 fatArch.offset = [cursor readBigInt32];
24 fatArch.size = [cursor readBigInt32];
25 fatArch.align = [cursor readBigInt32];
26
27 #if 0
28 NSLog(@"type: 64 bit? %d, 0x%x, subtype: 0x%x, offset: 0x%x, size: 0x%x, ali gn: 0x%x",
29 [self uses64BitABI], fatArch.cputype, fatArch.cpusubtype, fatArch.offs et, fatArch.size, fatArch.align);
30 #endif
31
32 machOFile = nil;
33
34 return self;
35 }
36
37 - (void)dealloc;
38 {
39 [machOFile release];
40
41 [super dealloc];
42 }
43
44 - (cpu_type_t)cpuType;
45 {
46 return fatArch.cputype;
47 }
48
49 - (cpu_type_t)maskedCPUType;
50 {
51 return fatArch.cputype & ~CPU_ARCH_MASK;
52 }
53
54 - (cpu_subtype_t)cpuSubtype;
55 {
56 return fatArch.cpusubtype;
57 }
58
59 - (uint32_t)offset;
60 {
61 return fatArch.offset;
62 }
63
64 - (uint32_t)size;
65 {
66 return fatArch.size;
67 }
68
69 - (uint32_t)align;
70 {
71 return fatArch.align;
72 }
73
74 - (BOOL)uses64BitABI;
75 {
76 return CDArchUses64BitABI((CDArch){ .cputype = fatArch.cputype, .cpusubtype = fatArch.cpusubtype });
77 }
78
79 - (CDFatFile *)fatFile;
80 {
81 return nonretained_fatFile;
82 }
83
84 - (void)setFatFile:(CDFatFile *)newFatFile;
85 {
86 nonretained_fatFile = [newFatFile retain];
87 }
88
89 - (NSString *)description;
90 {
91 return [NSString stringWithFormat:@"64 bit ABI? %d, cputype: 0x%08x, cpusubt ype: 0x%08x, offset: 0x%08x (%8u), size: 0x%08x (%8u), align: 2^%d (%d), arch na me: %@",
92 [self uses64BitABI], fatArch.cputype, fatArch.cpusubtype, f atArch.offset, fatArch.offset, fatArch.size, fatArch.size,
93 fatArch.align, 1 << fatArch.align, [self archName]];
94 }
95
96 - (CDArch)arch;
97 {
98 CDArch arch;
99
100 arch.cputype = fatArch.cputype;
101 arch.cpusubtype = fatArch.cpusubtype;
102
103 return arch;
104 }
105
106 // Must not return nil.
107 - (NSString *)archName;
108 {
109 return CDNameForCPUType(fatArch.cputype, fatArch.cpusubtype);
110 }
111
112 - (CDMachOFile *)machOFile;
113 {
114 if (machOFile == nil) {
115 machOFile = [[CDFile fileWithData:[nonretained_fatFile data] offset:fatA rch.offset filename:[nonretained_fatFile filename] searchPathState:[nonretained_ fatFile searchPathState]] retain];
116 }
117
118 return machOFile;
119 }
120
121 - (NSData *)machOData;
122 {
123 return [[[NSData alloc] initWithBytes:[[nonretained_fatFile data] bytes] + f atArch.offset length:fatArch.size] autorelease];
124 }
125
126 @end
OLDNEW
« no previous file with comments | « class-dump/src/CDFatArch.h ('k') | class-dump/src/CDFatFile.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698