I am trying to create an analysis scope for a class file. I will use this later to get a control flow graph and hopefully for taint analysis.
My code is fairly simple and is based on the docs
AnalysisScope scope = AnalysisScope.createJavaAnalysisScope();
FileProvider fp = new FileProvider();
try {
//geting the class file
File file = fp.getFile(pathToFile);
scope.addClassFileToScope(ClassLoaderReference.Application, file);
} catch (IOException | IllegalArgumentException | InvalidClassFileException e) {
System.out.println("Could not get file " + pathToFile);
e.printStackTrace();
}
return scope;
and I have another method that takes this scope and creates a ClassHierarchy
ClassHierarchy cha = ClassHierarchy.make(scope);
Iterable<Entrypoint> e = Util.makeMainEntrypoints(scope, cha);
I am getting the following error failed to load root <Primordial,Ljava/lang/Object> of class hierarchy
I checked the troubleshooting page, and I am positive I do not have an issue with my java runtime path.
I eliminated this problem by using the following example
//here pathToFile is a path to a jar file
AnalysisScope scope = AnalysisScopeReader.makeJavaBinaryAnalysisScope(pathToFile, null);
ClassHierarchy cha = ClassHierarchy.make(scope); //this is working
Any ideas what I am doing wrong?
Any suggestion on how to move on to CFG and taint analysis once I get the cha?
Thanks!