forked from nygard/class-dump
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCDLCDylinker.m
55 lines (38 loc) · 1.08 KB
/
CDLCDylinker.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// -*- mode: ObjC -*-
// This file is part of class-dump, a utility for examining the Objective-C segment of Mach-O files.
// Copyright (C) 1997-1998, 2000-2001, 2004-2010 Steve Nygard.
#import "CDLCDylinker.h"
#import "CDDataCursor.h"
@implementation CDLCDylinker
- (id)initWithDataCursor:(CDDataCursor *)cursor machOFile:(CDMachOFile *)aMachOFile;
{
NSUInteger length;
if ([super initWithDataCursor:cursor machOFile:aMachOFile] == nil)
return nil;
dylinkerCommand.cmd = [cursor readInt32];
dylinkerCommand.cmdsize = [cursor readInt32];
dylinkerCommand.name.offset = [cursor readInt32];
length = dylinkerCommand.cmdsize - sizeof(dylinkerCommand);
//NSLog(@"expected length: %u", length);
name = [[cursor readStringOfLength:length encoding:NSASCIIStringEncoding] retain];
//NSLog(@"name: %@", name);
return self;
}
- (void)dealloc;
{
[name release];
[super dealloc];
}
- (uint32_t)cmd;
{
return dylinkerCommand.cmd;
}
- (uint32_t)cmdsize;
{
return dylinkerCommand.cmdsize;
}
- (NSString *)name;
{
return name;
}
@end