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

Side by Side Diff: class-dump/src/CDSection64.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/CDSection64.h ('k') | class-dump/src/CDStructureInfo.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 "CDSection64.h"
7
8 #import "CDDataCursor.h"
9 #import "CDMachOFile.h"
10
11 @implementation CDSection64
12
13 - (id)initWithDataCursor:(CDDataCursor *)cursor segment:(CDLCSegment64 *)aSegmen t;
14 {
15 char buf[17];
16 NSString *str;
17
18 if ([super init] == nil)
19 return nil;
20
21 nonretained_segment = aSegment;
22
23 [cursor readBytesOfLength:16 intoBuffer:section.sectname];
24 [cursor readBytesOfLength:16 intoBuffer:section.segname];
25 section.addr = [cursor readInt64];
26 section.size = [cursor readInt64];
27 section.offset = [cursor readInt32];
28 section.align = [cursor readInt32];
29 section.reloff = [cursor readInt32];
30 section.nreloc = [cursor readInt32];
31 section.flags = [cursor readInt32];
32 section.reserved1 = [cursor readInt32];
33 section.reserved2 = [cursor readInt32];
34 section.reserved3 = [cursor readInt32];
35
36 // These aren't guaranteed to be null terminated. Witness __cstring_object in __OBJC segment
37
38 memcpy(buf, section.segname, 16);
39 buf[16] = 0;
40 str = [[NSString alloc] initWithBytes:buf length:strlen(buf) encoding:NSASCI IStringEncoding];
41 [self setSegmentName:str];
42 [str release];
43
44 memcpy(buf, section.sectname, 16);
45 buf[16] = 0;
46 str = [[NSString alloc] initWithBytes:buf length:strlen(buf) encoding:NSASCI IStringEncoding];
47 [self setSectionName:str];
48 [str release];
49
50 return self;
51 }
52
53 - (CDLCSegment64 *)segment;
54 {
55 return nonretained_segment;
56 }
57
58 - (CDMachOFile *)machOFile;
59 {
60 return [[self segment] machOFile];
61 }
62
63 - (NSUInteger)addr;
64 {
65 return section.addr;
66 }
67
68 - (NSUInteger)size;
69 {
70 return section.size;
71 }
72
73 - (void)loadData;
74 {
75 if (_flags.hasLoadedData == NO) {
76 data = [[NSData alloc] initWithBytes:[[nonretained_segment machOFile] ma chODataBytes] + section.offset length:section.size];
77 _flags.hasLoadedData = YES;
78 }
79 }
80
81 - (NSString *)description;
82 {
83 return [NSString stringWithFormat:@"<%@:%p> segment; '%@', section: '%-16s', addr: %016lx, size: %016lx",
84 NSStringFromClass([self class]), self,
85 segmentName, [sectionName UTF8String],
86 section.addr, section.size];
87 }
88
89 - (BOOL)containsAddress:(NSUInteger)address;
90 {
91 return (address >= section.addr) && (address < section.addr + section.size);
92 }
93
94 - (NSUInteger)fileOffsetForAddress:(NSUInteger)address;
95 {
96 NSParameterAssert([self containsAddress:address]);
97 return section.offset + address - section.addr;
98 }
99
100 @end
OLDNEW
« no previous file with comments | « class-dump/src/CDSection64.h ('k') | class-dump/src/CDStructureInfo.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698