<div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small">I tried running the analysis with Soot-2.5.0 and it ran without any exception. <br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small">The later versions of Soot are not supporting the ThreadLocalObjectsAnalysis and throwing an exception. Reason is, the DataFlowSummary object is null and being dereferenced at soot.jimple.toolkits.infoflow.SmartMethodInfoFlowAnalysis.handleInvokeExpr(SmartMethodInfoFlowAnalysis.java:408).</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small">Can someone fix this?<br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small">Also, ThreadLocalObjectsAnalysis can only be used with Jimple. <br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small">I want to find the thread local objects in Shimple. Is there any other analysis? If not, where should I make the changes in Soot to support Shimple?</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small">Thanks,</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small">Rajendra.<br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small"><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Apr 7, 2020 at 5:04 PM Eric Bodden <<a href="mailto:eric.bodden@uni-paderborn.de" target="_blank">eric.bodden@uni-paderborn.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi.<br>
<br>
This is just a guess but might it be that the project you are analyzing contains InvokeDynamic bytecodes? I am pretty sure that the TLO-Analysis is too old to be able to handle these. I’d need to be extended.<br>
<br>
Cheers<br>
Eric<br>
<br>
> On 6. Apr 2020, at 13:28, Rajendra Kumar Dangwal <<a href="mailto:dangwalrajendra888@gmail.com" target="_blank">dangwalrajendra888@gmail.com</a>> wrote:<br>
> <br>
> Hi All,<br>
> <br>
> I want to find all the references to the objects which are not escaping a thread i.e. Thread local objects. I am using ThreadLocalObjectAnalysis to do it. But it is throwing NullPointerException in SmartMethodInfoFlowAnalysis. I don't know the reason. I am using Soot version 3.0 and Java version 1.7.<br>
> <br>
> Code and output are attached for the reference:<br>
> <br>
> Soot-Args and addition to pack:<br>
> -------------------------------------------------------------------<br>
> String sootArgs[] = {"-cp", classPath, "-pp", "-keep-bytecode-offset", "-main-class", "test.Test", "-no-bodies-for-excluded", "-w", "-process-dir", dirPath, "-p", "cg", "enabled:true", "-p", "cg.spark", "enabled:true",  "-p", "jb", "use-original-names:true", "test.Test"};<br>
> <br>
> EscapeAnalysis analysisTransformer = new EscapeAnalysis();<br>
> <br>
> PackManager.v().getPack("wjtp").add(new Transform("wjtp.esc", analysisTransformer));<br>
> <br>
> soot.Main.main(sootArgs);<br>
> ----------------------------------------------------------------------<br>
> <br>
> Analysis: <br>
> <br>
> public class EscapeAnalysis extends SceneTransformer {<br>
> <br>
>      @Override<br>
>      protected void internalTransform(String arg0, Map<String, String> arg1) {<br>
> <br>
>      ThreadLocalObjectsAnalysis tlo = new ThreadLocalObjectsAnalysis(new SynchObliviousMhpAnalysis());<br>
>      tlo.precompute();<br>
> <br>
>      Chain<SootClass> classChain = Scene.v().getApplicationClasses();<br>
>      for(SootClass c : classChain) {<br>
>           System.out.println("\nClass : " + c + "\n");<br>
>           List<SootMethod> methodList = c.getMethods();<br>
> <br>
>           for(SootMethod m : methodList) {<br>
>               if(m.isConcrete()) {<br>
>                    System.out.println("\nMethod : "+ m);<br>
>                    System.out.print("Thread Local var: ");<br>
>                    Chain<Local> localVars = m.retrieveActiveBody().getLocals();<br>
>                    for(Local l : localVars) {<br>
>                     if(tlo.isObjectThreadLocal(l, m))<br>
>                    System.out.print(l.getName() + " ");<br>
>                    }<br>
>                }<br>
>             }<br>
>          }<br>
>      }<br>
> }<br>
> <br>
> <br>
> ----------------------------------------------------------------------------------------<br>
> <br>
> Code to be analyzed:<br>
> <br>
> package test;<br>
> <br>
> class Test{<br>
> <br>
>   public static void main(String args[]){<br>
>     ClassA obj = new ClassA();<br>
>     MyThread t1 = new MyThread(obj);<br>
>     MyThread t2 = new MyThread(obj);<br>
>     t1.start();<br>
>     t2.start();<br>
> <br>
>   }<br>
> }<br>
> <br>
> class MyThread extends Thread{<br>
>   int localInt;<br>
>   ClassA obj;<br>
>   public MyThread(ClassA obj){<br>
>     localInt = 1;<br>
>     this.obj = obj;<br>
>   }<br>
> <br>
>   public void run(){<br>
>     System.out.println("localInt: "+ localInt);<br>
>     System.out.println("obj.i: "+ obj.i);<br>
>   }<br>
> }<br>
> <br>
> class ClassA{<br>
>   public int i = 10;<br>
> }<br>
> <br>
> <br>
> -----------------------------------------------------------------------------------<br>
> <br>
> Output:<br>
> <br>
> Soot started on Fri Apr 03 12:09:42 IST 2020<br>
> [Call Graph] For information on where the call graph may be incomplete, use the verbose option to the cg phase.<br>
> [Spark] Pointer Assignment Graph in 0.1 seconds.<br>
> [Spark] Type masks in 0.0 seconds.<br>
> [Spark] Pointer Graph simplified in 0.0 seconds.<br>
> [Spark] Propagation in 0.3 seconds.<br>
> [Spark] Solution found in 0.3 seconds.<br>
> [local-objects] Analyzing local objects for test.MyThread<br>
> [local-objects]   preparing class             Fri Apr 03 12:09:44 IST 2020<br>
> [local-objects]   analyzing class             Fri Apr 03 12:09:44 IST 2020<br>
> java.lang.NullPointerException<br>
> at soot.jimple.toolkits.infoflow.SmartMethodInfoFlowAnalysis.handleInvokeExpr(SmartMethodInfoFlowAnalysis.java:408)<br>
> at soot.jimple.toolkits.infoflow.SmartMethodInfoFlowAnalysis.addFlowToCdfg(SmartMethodInfoFlowAnalysis.java:793)<br>
> at soot.jimple.toolkits.infoflow.SmartMethodInfoFlowAnalysis.generateAbbreviatedInfoFlowGraph(SmartMethodInfoFlowAnalysis.java:151)<br>
> at soot.jimple.toolkits.infoflow.SmartMethodInfoFlowAnalysis.<init>(SmartMethodInfoFlowAnalysis.java:128)<br>
> at soot.jimple.toolkits.infoflow.ClassInfoFlowAnalysis.getMethodInfoFlowSummary(ClassInfoFlowAnalysis.java:91)<br>
> .....<br>
> <br>
> Please help.<br>
> <br>
> Thanks,<br>
> Rajendra<br>
> _______________________________________________<br>
> Soot-list mailing list<br>
> <a href="mailto:Soot-list@CS.McGill.CA" target="_blank">Soot-list@CS.McGill.CA</a><br>
> <a href="https://mailman.CS.McGill.CA/mailman/listinfo/soot-list" rel="noreferrer" target="_blank">https://mailman.CS.McGill.CA/mailman/listinfo/soot-list</a><br>
<br>
</blockquote></div>