Open sritejakv opened 3 years ago
Can you see what instruction is causing this? Perhaps add a print statement or look at the instruction i n the debugger.
On Sun, Dec 6, 2020 at 3:43 PM Kummita Sriteja notifications@github.com wrote:
Hi,
I am using PythonAnalysisEngine to generate a callgraph for Python programs. However, when I give multiple input files which does not have a main function in them, I do not get any edges in the callgraph (I just generated a callgraph for a single file with and without main function and compared the edges in the callgraph. When the input file doesn't contain a main function, then I get few to no edges in the call graph).
I want to give custom entrypoints along with the main function, for example, all the functions in all the input files as the entrypoints and I tried the following code in PythonAnalysisEngine by overriding makeDefaultEntrypoints:
@Override protected Iterable
makeDefaultEntrypoints(AnalysisScope scope, IClassHierarchy cha) { Set result = HashSetFactory.make(); for(Module m : moduleFiles) { IClass entry = cha.lookupClass(TypeReference.findOrCreate(PythonTypes.pythonLoader, TypeName.findOrCreate(scriptName(m)))); assert entry != null: "bad root name " + scriptName(m) + ":\n" + cha; MethodReference er = MethodReference.findOrCreate(entry.getReference(), AstMethodReference.fnSelector); System.out.println("Root Entry Point: " + er.toString()); result.add(new DefaultEntrypoint(er, cha)); } //Begin - I added the following code for (IClass klass : cha) { for (IMethod method : klass.getDeclaredMethods()) { MethodReference er = method.getReference(); result.add(new DefaultEntrypoint(er, cha)); } } //End return result; }
I get the following exception:
java.lang.IllegalArgumentException: Illegal i: -1 at com.ibm.wala.ssa.SymbolTable.ensureSymbol(SymbolTable.java:189) at com.ibm.wala.ipa.summaries.SyntheticIR.updateForInstruction(SyntheticIR.java:120) at com.ibm.wala.ipa.summaries.SyntheticIR.makeSymbolTable(SyntheticIR.java:95) at com.ibm.wala.ipa.summaries.SyntheticIR.
(SyntheticIR.java:55) at com.ibm.wala.ipa.summaries.SummarizedMethodWithNames$SyntheticIRWithNames. (SummarizedMethodWithNames.java:141) at com.ibm.wala.ipa.summaries.SummarizedMethodWithNames.makeIR(SummarizedMethodWithNames.java:187) at com.ibm.wala.ipa.summaries.SyntheticIRFactory.makeIR(SyntheticIRFactory.java:34) at com.ibm.wala.ssa.DefaultIRFactory.makeIR(DefaultIRFactory.java:66) at com.ibm.wala.cast.ir.ssa.AstIRFactory$AstDefaultIRFactory.makeIR(AstIRFactory.java:59) at com.ibm.wala.ssa.SSACache.findOrCreateIR(SSACache.java:69) at com.ibm.wala.ipa.callgraph.AnalysisCache.getIR(AnalysisCache.java:74) at com.ibm.wala.ipa.callgraph.propagation.cfa.ContextInsensitiveSSAInterpreter.getIR(ContextInsensitiveSSAInterpreter.java:45) at com.ibm.wala.ipa.callgraph.propagation.cfa.ContextInsensitiveSSAInterpreter.getIRView(ContextInsensitiveSSAInterpreter.java:50) at com.ibm.wala.ipa.callgraph.propagation.cfa.DelegatingSSAContextInterpreter.getIRView(DelegatingSSAContextInterpreter.java:64) at com.ibm.wala.ipa.callgraph.propagation.SSAPropagationCallGraphBuilder.unconditionallyAddConstraintsFromNode(SSAPropagationCallGraphBuilder.java:208) at com.ibm.wala.ipa.callgraph.propagation.SSAPropagationCallGraphBuilder.addConstraintsFromNode(SSAPropagationCallGraphBuilder.java:190) at com.ibm.wala.ipa.callgraph.propagation.PropagationCallGraphBuilder.addConstraintsFromNewNodes(PropagationCallGraphBuilder.java:311) at com.ibm.wala.ipa.callgraph.propagation.StandardSolver.solve(StandardSolver.java:56) at com.ibm.wala.ipa.callgraph.propagation.PropagationCallGraphBuilder.makeCallGraph(PropagationCallGraphBuilder.java:251) at adapters.WalaNCFA.getStaticCallGraph(WalaNCFA.java:83) Could you please help me in pointing out if there is another way of achieving this (giving all methods as entrypoints to generate a callgraph) or Is there any thing that I am missing in the above code?
Thanks in advance.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/wala/ML/issues/17, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMTO7QW4ZRX7RMNTJMAEEDSTPUGJANCNFSM4UPSW32A .
Does https://github.com/wala/ML/blob/16acfbcf22c66a220176c1b95d30e7026c7231b2/com.ibm.wala.cast.python/source/com/ibm/wala/cast/python/util/Util.java#L20-L33 help? I added Pytest entry points using this code (though it doesn't consider the decorators). I didn't override the default entrypoints; I kept those intact. Do you not want the default ones at all. I see above that you didn't call the super class method.
Hi,
I am using PythonAnalysisEngine to generate a callgraph for Python programs. However, when I give multiple input files which does not have a
main
function in them, I do not get any edges in the callgraph (I just generated a callgraph for a single file with and withoutmain
function and compared the edges in the callgraph. When the input file doesn't contain amain
function, then I get few to no edges in the call graph).I want to give custom entrypoints along with the
main
function, for example, all the functions in all the input files as the entrypoints and I tried the following code in PythonAnalysisEngine by overriding makeDefaultEntrypoints:I get the following exception:
Could you please help me in pointing out if there is another way of achieving this (giving all methods as entrypoints to generate a callgraph) or Is there any thing that I am missing in the above code?
Thanks in advance.