Hello, I am a new user of WALA.I've been slicing programs with WALA recently, and when I slice backward to the return statement of the example, I only get the return line. But there are other examples where the slicing results are correct.
So I gave the example of the wrong result. It also tells me that the FakeRootMethod type cannot be converted ShrikeBTMethod type.
What does this exception mean? And why my slice results are only one line?
Here is my tess example:
public class GetContentType {
public static String getContentType(String url) throws IOException {
{
int i1;
URLConnection urlc1;
String s1 = null;
URL url1;
url1 = new URL(url);
urlc1 = url1.openConnection();
i1 = urlc1.getContentLength();
s1 = urlc1.getContentType();
Boolean b2 = s1.endsWith(url);
return s1;
}
}
Here is my wala build code:
public static void sliceFromReturn(String jar,String callname, String callmethodClass) throws IOException, ClassHierarchyException, IllegalArgumentException, InvalidClassFileException, CancelException {
File exFile=new FileProvider().getFile("Java60RegressionExclusions.txt");
AnalysisScope scope = AnalysisScopeReader.makeJavaBinaryAnalysisScope(jar, exFile);
ClassHierarchy cha = ClassHierarchyFactory.make(scope);
Iterable<Entrypoint> entrypoints = new AllApplicationEntrypoints(scope, cha);
AnalysisOptions options = new AnalysisOptions(scope, entrypoints);
options.setReflectionOptions(ReflectionOptions.NONE);
CallGraphBuilder<InstanceKey> builder = Util.makeZeroCFABuilder(Language.JAVA, options, new AnalysisCacheImpl(), cha, scope);
System.out.println("building call graph...");
CallGraph cg = builder.makeCallGraph(options, null);
System.out.println("done");
System.out.println(CallGraphStats.getStats(cg));
final PointerAnalysis<InstanceKey> pa = builder.getPointerAnalysis();
ModRef<InstanceKey> modRef = ModRef.make();
SDG<?> sdg = new SDG<>(cg, pa, modRef, DataDependenceOptions.NO_HEAP, ControlDependenceOptions.NO_EXCEPTIONAL_EDGES, null);
CGNode nc = null;
Collection<Statement> collection = null;
CGNode n = FindMethod.findMethod(cg, callname, callmethodClass);
Statement statement = FindStatement.findReturn(n);
System.out.println("-------computeBackwardSlice-------");
collection = Slicer.computeBackwardSlice(sdg, statement);
dumpSlice(collection, callname);
}
And here is my method that catches the return statement:
public static Statement findReturn(CGNode n) {
IR ir = n.getIR();
for (Iterator<SSAInstruction> it = ir.iterateAllInstructions(); it.hasNext();) {
SSAInstruction s = it.next();
if (s instanceof SSAReturnInstruction) {
SSAReturnInstruction call = (SSAReturnInstruction) s;
return new NormalStatement(n, ((SSAReturnInstruction) s).iindex);
}
}
return null;
}
_______________________________________________
Wala-wala mailing list
Wala...@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wala-wala
Thanks for your reply. I have posted my example on the GitHub issue