2009-09-17 13:06:04 +00:00
|
|
|
//
|
|
|
|
// SymbolEntryModel.mm
|
|
|
|
// MacDependency
|
|
|
|
//
|
|
|
|
// Created by Konrad Windszus on 13.07.09.
|
|
|
|
// Copyright 2009 Konrad Windszus. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
#import "SymbolTableEntryModel.h"
|
|
|
|
#import "MachOModel.h"
|
|
|
|
#import "ConversionStdString.h"
|
2009-09-23 16:12:43 +00:00
|
|
|
#import "MyDocument.h"
|
|
|
|
#include "MachO/machodemangleexception.h"
|
2009-09-17 13:06:04 +00:00
|
|
|
|
|
|
|
@implementation SymbolTableEntryModel
|
|
|
|
|
2016-11-19 16:23:39 +01:00
|
|
|
- (id) initWithEntry:(const SymbolTableEntry*)anEntry demangleNamesPtr:(BOOL*)demangle document:(MyDocument*)aDocument {
|
2011-04-25 08:47:39 +00:00
|
|
|
self = [super init];
|
|
|
|
if (self) {
|
2011-04-24 20:02:43 +00:00
|
|
|
entry = anEntry;
|
2016-11-19 16:23:39 +01:00
|
|
|
self->demangleNames = demangle;
|
2011-04-24 20:02:43 +00:00
|
|
|
document = aDocument;
|
2009-09-17 13:06:04 +00:00
|
|
|
}
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (NSString*) name {
|
2009-09-23 16:12:43 +00:00
|
|
|
try {
|
2016-11-19 16:23:39 +01:00
|
|
|
return [NSString stringWithStdString: entry->getName(*demangleNames)];
|
2009-09-23 16:12:43 +00:00
|
|
|
} catch (MachODemangleException& e) {
|
2011-04-24 20:02:43 +00:00
|
|
|
// in case of demangling problems (probably c++filt not installed)
|
2009-09-23 16:12:43 +00:00
|
|
|
NSString* error = NSLocalizedString(@"ERR_NO_DEMANGLER", nil);
|
|
|
|
[document appendLogLine:error withModel:nil state:StateError];
|
2011-04-24 20:02:43 +00:00
|
|
|
// disable name demangling
|
2009-09-23 16:12:43 +00:00
|
|
|
[[document symbolTableController] setDemangleNames:NO];
|
|
|
|
}
|
|
|
|
return [NSString stringWithStdString:entry->getName(false)];
|
2009-09-17 13:06:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- (NSNumber*) type {
|
|
|
|
return [NSNumber numberWithUnsignedInt:entry->getType()];
|
|
|
|
}
|
|
|
|
|
|
|
|
@end
|