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

Side by Side Diff: class-dump/src/CDLCSegment64.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/CDLCSegment64.h ('k') | class-dump/src/CDLCSubClient.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 "CDLCSegment64.h"
7
8 #import "CDSection64.h"
9 #import "CDDataCursor.h"
10
11 @implementation CDLCSegment64
12
13 - (id)initWithDataCursor:(CDDataCursor *)cursor machOFile:(CDMachOFile *)aMachOF ile;
14 {
15 if ([super initWithDataCursor:cursor machOFile:aMachOFile] == nil)
16 return nil;
17
18 segmentCommand.cmd = [cursor readInt32];
19 segmentCommand.cmdsize = [cursor readInt32];
20
21 [cursor readBytesOfLength:16 intoBuffer:segmentCommand.segname];
22 segmentCommand.vmaddr = [cursor readInt64];
23 segmentCommand.vmsize = [cursor readInt64];
24 segmentCommand.fileoff = [cursor readInt64];
25 segmentCommand.filesize = [cursor readInt64];
26 segmentCommand.maxprot = [cursor readInt32];
27 segmentCommand.initprot = [cursor readInt32];
28 segmentCommand.nsects = [cursor readInt32];
29 segmentCommand.flags = [cursor readInt32];
30
31 {
32 char buf[17];
33 NSString *str;
34
35 memcpy(buf, segmentCommand.segname, 16);
36 buf[16] = 0;
37 str = [[NSString alloc] initWithBytes:buf length:strlen(buf) encoding:NS ASCIIStringEncoding];
38 if ([str length] >= 16) {
39 NSLog(@"Notice: segment '%@' has length >= 16, which means it's not always null terminated.", str);
40 }
41 [self setName:str];
42 [str release];
43 }
44
45 {
46 unsigned int index;
47
48 for (index = 0; index < segmentCommand.nsects; index++) {
49 CDSection64 *section;
50
51 section = [[CDSection64 alloc] initWithDataCursor:cursor segment:sel f];
52 [sections addObject:section];
53 [section release];
54 }
55 }
56
57 return self;
58 }
59
60 - (uint32_t)cmd;
61 {
62 return segmentCommand.cmd;
63 }
64
65 - (uint32_t)cmdsize;
66 {
67 return segmentCommand.cmdsize;
68 }
69
70 - (NSUInteger)vmaddr;
71 {
72 return segmentCommand.vmaddr;
73 }
74
75 - (NSUInteger)fileoff;
76 {
77 return segmentCommand.fileoff;
78 }
79
80 - (NSUInteger)filesize;
81 {
82 return segmentCommand.filesize;
83 }
84
85 - (vm_prot_t)initprot;
86 {
87 return segmentCommand.initprot;
88 }
89
90 - (uint32_t)flags;
91 {
92 return segmentCommand.flags;
93 }
94
95 - (BOOL)containsAddress:(NSUInteger)address;
96 {
97 return (address >= segmentCommand.vmaddr) && (address < segmentCommand.vmadd r + segmentCommand.vmsize);
98 }
99
100 - (NSString *)extraDescription;
101 {
102 return [NSString stringWithFormat:@"addr: 0x%016lx", [self vmaddr]];
103 }
104
105 @end
OLDNEW
« no previous file with comments | « class-dump/src/CDLCSegment64.h ('k') | class-dump/src/CDLCSubClient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698