use of org.eclipse.cdt.core.IBinaryParser.IBinaryObject in project linuxtools by eclipse.
the class STSymbolManager method getBinaryObject.
/**
* Gets the IBinaryObject corresponding to the given path (absolute path in filesystem). If a IBinaryObject
* corresponding to the given path has been already built by eclipse, return it. Otherwise build a new
* IBinaryObject, according to project preferences. Note that it may return null if the path is invalid, or is not a
* valid binary file.
* @param path
* @param defaultparser
* @return a IBinaryObject
*/
private IBinaryObject getBinaryObject(IPath path, IBinaryParser defaultparser) {
IFile c = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(path);
List<IBinaryParser> parsers;
if (c != null) {
IBinaryObject object = getAlreadyExistingBinaryObject(c);
if (object != null) {
return object;
}
parsers = getBinaryParser(c.getProject());
} else {
parsers = new LinkedList<>();
}
if (defaultparser == null) {
try {
defaultparser = CCorePlugin.getDefault().getDefaultBinaryParser();
} catch (CoreException e) {
Activator.getDefault().getLog().log(e.getStatus());
}
}
if (defaultparser != null) {
parsers.add(defaultparser);
}
IBinaryObject ret = buildBinaryObject(path, parsers);
if (ret == null) {
// trying all BinaryParsers...
parsers.clear();
IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(CCorePlugin.PLUGIN_ID, CCorePlugin.BINARY_PARSER_SIMPLE_ID);
for (IExtension extension : extensionPoint.getExtensions()) {
if (extension != null) {
IConfigurationElement[] element = extension.getConfigurationElements();
for (IConfigurationElement element2 : element) {
if (element2.getName().equalsIgnoreCase("cextension")) {
// $NON-NLS-1$
IBinaryParser parser;
try {
// $NON-NLS-1$
parser = (IBinaryParser) element2.createExecutableExtension("run");
parsers.add(parser);
} catch (CoreException e) {
}
}
}
}
}
ret = buildBinaryObject(path, parsers);
}
return ret;
}
use of org.eclipse.cdt.core.IBinaryParser.IBinaryObject in project linuxtools by eclipse.
the class STSymbolManager method validateBinary.
/**
* Validate the binary file. In particular, verify that this binary file can be decoded.
* @param o
* @return the binary object, or null.
*/
private IBinaryObject validateBinary(IBinaryFile o) {
if (o instanceof IBinaryObject) {
IBinaryObject object = (IBinaryObject) o;
//
String s = object.getCPU();
if (s != null && !s.isEmpty()) {
return object;
}
}
return null;
}
Aggregations