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

Side by Side Diff: class-dump/src/CDMachO64File.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/CDMachO64File.h ('k') | class-dump/src/CDMachOFile.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 "CDMachO64File.h"
7
8 #import "CDLoadCommand.h"
9 #import "CDObjectiveC2Processor64.h"
10
11 @implementation CDMachO64File
12
13 - (id)initWithData:(NSData *)someData offset:(NSUInteger)anOffset filename:(NSSt ring *)aFilename searchPathState:(CDSearchPathState *)aSearchPathState;
14 {
15 CDDataCursor *cursor;
16
17 if ([super initWithData:someData offset:anOffset filename:aFilename searchPa thState:aSearchPathState] == nil)
18 return nil;
19
20 cursor = [[CDDataCursor alloc] initWithData:someData];
21 [cursor setOffset:offset];
22 header.magic = [cursor readLittleInt32];
23
24 //NSLog(@"(testing macho 64) magic: 0x%x", header.magic);
25 if (header.magic == MH_MAGIC_64) {
26 byteOrder = CDByteOrderLittleEndian;
27 } else if (header.magic == MH_CIGAM_64) {
28 byteOrder = CDByteOrderBigEndian;
29 } else {
30 [cursor release];
31 [self release];
32 return nil;
33 }
34
35 //NSLog(@"byte order: %d", byteOrder);
36 [cursor setByteOrder:byteOrder];
37
38 header.cputype = [cursor readInt32];
39 header.cpusubtype = [cursor readInt32];
40 header.filetype = [cursor readInt32];
41 header.ncmds = [cursor readInt32];
42 header.sizeofcmds = [cursor readInt32];
43 header.flags = [cursor readInt32];
44 header.reserved = [cursor readInt32];
45
46 //NSLog(@"cpusubtype: 0x%08x", header.cpusubtype);
47 //NSLog(@"filetype: 0x%08x", header.filetype);
48 //NSLog(@"ncmds: %u", header.ncmds);
49 //NSLog(@"sizeofcmds: %u", header.sizeofcmds);
50 //NSLog(@"flags: 0x%08x", header.flags);
51 //NSLog(@"reserved: 0x%08x", header.reserved);
52
53 _flags.uses64BitABI = CDArchUses64BitABI((CDArch){ .cputype = header.cputype , .cpusubtype = header.cpusubtype });
54 header.cputype &= ~CPU_ARCH_MASK;
55
56 [self _readLoadCommands:cursor count:header.ncmds];
57
58 return self;
59 }
60
61 - (uint32_t)magic;
62 {
63 return header.magic;
64 }
65
66 - (cpu_type_t)cputype;
67 {
68 return header.cputype;
69 }
70
71 - (cpu_subtype_t)cpusubtype;
72 {
73 return header.cpusubtype;
74 }
75
76 - (uint32_t)filetype;
77 {
78 return header.filetype;
79 }
80
81 - (uint32_t)flags;
82 {
83 return header.flags;
84 }
85
86
87 - (BOOL)bestMatchForLocalArch:(CDArch *)archPtr;
88 {
89 if (archPtr != NULL) {
90 archPtr->cputype = header.cputype;
91 archPtr->cpusubtype = header.cpusubtype;
92 }
93
94 return YES;
95 }
96
97 - (Class)processorClass;
98 {
99 return [CDObjectiveC2Processor64 class];
100 }
101
102 @end
OLDNEW
« no previous file with comments | « class-dump/src/CDMachO64File.h ('k') | class-dump/src/CDMachOFile.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698