Skip to content

Commit

Permalink
wrong class name for category method
Browse files Browse the repository at this point in the history
  • Loading branch information
eugeneyang authored and eugeneyang committed Oct 1, 2016
1 parent c9ac040 commit 4a942a6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
25 changes: 14 additions & 11 deletions source/RSScanMethodVisitor.m
Original file line number Diff line number Diff line change
Expand Up @@ -60,23 +60,26 @@ - (void)willVisitCategory:(CDOCCategory *)category;
[self setContext:category];
}


- (NSString *)getCurrentClassName{
if ([_context isKindOfClass:[CDOCClass class]]) {
return _context.name;
} else if([_context isKindOfClass:[CDOCCategory class]]) {
NSString * className = [[(CDOCCategory *)_context classRef] className];
if (!className) className = @"";
return [NSString stringWithFormat:@"%@(%@)", className ,_context.name];
}
return _context.name;
}

- (void)visitClassMethod:(CDOCMethod *)method;
{
if (method.address == 0 ) {
return;
}

NSString *name = nil;
if ([_context isKindOfClass:[CDOCClass class]]) {
name = [NSString stringWithFormat:@"+[%@ %@]", _context.name, method.name];
} else if([_context isKindOfClass:[CDOCCategory class]]) {
NSString * className = [[(CDOCCategory *)_context classRef] className];
if (!className) className = @"";
name = [NSString stringWithFormat:@"+[%@(%@) %@]", className ,_context.name, method.name];
}
NSString *name = [NSString stringWithFormat:@"+[%@ %@]", [self getCurrentClassName], method.name];

if (!name) return;

RSSymbol *s = [RSSymbol symbolWithName:name address:method.address];

[self.collector addSymbol:s];
Expand All @@ -88,7 +91,7 @@ - (void)visitInstanceMethod:(CDOCMethod *)method propertyState:(CDVisitorPropert
if (method.address == 0 ) {
return;
}
NSString *name = [NSString stringWithFormat:@"-[%@ %@]", _context.name, method.name];
NSString *name = [NSString stringWithFormat:@"-[%@ %@]", [self getCurrentClassName], method.name];

RSSymbol *s = [RSSymbol symbolWithName:name address:method.address];

Expand Down
3 changes: 1 addition & 2 deletions source/RSSymbolCollector.m
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ - (void)generateAppendStringTable:(NSData **)stringTable appendSymbolTable:(NSDa

} else {
struct nlist_64 * list = nlistsData.mutableBytes;
bool isThumb = symbol.address & 1;
list[i].n_desc = isThumb ? N_ARM_THUMB_DEF : 0;
list[i].n_desc = 0;
list[i].n_type = N_PEXT | N_SECT;
list[i].n_sect = [self n_sectForAddress:symbol.address];
list[i].n_value = symbol.address;
Expand Down

0 comments on commit 4a942a6

Please sign in to comment.