<div dir="ltr">I think I managed to get it to work, but I made a couple of newbie mistakes:<div><br></div><div>(1) My test example was incorrect. It does uses primitive variables rather than objects, so there is no aliasing. Duh!</div><div>(2) The biggest problem that I was having was to make sure that soot was initialized properly, particularly its class path. I ended up adapting initializeSoot() (in SetupApplication.java) from the infoflow-android project.</div><div><br></div><div>The only part that I was not able to figure out was how to keep the same variables names as in the source. In a standard java application, you can set&nbsp;</div><div><br></div><div>Options.v().setPhaseOption("jb","use-original-names:true")<br></div><div><br></div><div>Is there an equivalent option for Android?</div><div><br></div><div>Thanks,</div><div>-- Octav</div><div><br>On Wednesday, April 15, 2015 at 3:16:05 AM UTC-5, Octav Chipara wrote:<blockquote class="gmail_quote" style="margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir="ltr">Hi,<div><br></div><div>I am writing an static analysis that use call graph + point-to-sets on android applications. I was able to construct a call graph using infoflow's to generate a dummy main. Unfortunately, the point-to-sets that I am obtaining for local variables are always empty. Below are the relevant pieces of code. If you guys could point me in the right direction, I would really appreciate it.</div><div><br></div><div>Thanks!</div><div>-- Octav</div><div><br></div><div>===== Driver ====</div><div>public static void main(String[] args) throws Exception {<br></div><div>...</div><div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SetupApplication app = new SetupApplication(sdkLocation, apkLocation);</div><div><span style="white-space:pre">                </span>app.<wbr>calculateSourcesSinksEntrypoin<wbr>ts("SourcesAndSinks.txt");<span style="white-space:pre">                </span></div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; soot.G.reset();<span style="white-space:pre">                </span>&nbsp;</div><div><br></div><div><span style="white-space:pre">                </span>Options.v().set_src_prec(<wbr>Options.src_prec_apk);</div><div><span style="white-space:pre">                </span>Options.v().set_process_dir(<wbr>Collections.singletonList(<wbr>apkLocation));</div><div><span style="white-space:pre">                </span>Options.v().set_android_jars(<wbr>sdkLocation);</div><div><span style="white-space:pre">                </span>Options.v().set_whole_program(<wbr>true);</div><div><span style="white-space:pre">                </span>Options.v().set_allow_phantom_<wbr>refs(true);</div><div><span style="white-space:pre">                </span></div><div><span style="white-space:pre">                </span>Options.v().setPhaseOption("<wbr>jb","use-original-names:true")<wbr>;</div><div><span style="white-space:pre">                </span>Options.v().setPhaseOption("<wbr>cg.spark", "on");</div><div><span style="white-space:pre">                </span>Options.v().setPhaseOption("<wbr>cg.verbose", "true");<span style="white-space:pre">                </span></div><div><span style="white-space:pre">                </span></div><div><span style="white-space:pre">                </span>Options.v().set_output_format(<wbr>Options.output_format_none);<span style="white-space:pre">        </span></div><div><br></div><div><span style="white-space:pre">                </span>Scene.v().<wbr>loadNecessaryClasses();<br></div><div><span style="white-space:pre">                </span>SootMethod entryPoint = app.getEntryPointCreator().<wbr>createDummyMain();</div><div><span style="white-space:pre">                </span>Options.v().set_main_class(<wbr>entryPoint.getSignature());<br></div><div><span style="white-space:pre">                </span>Scene.v().setEntryPoints(<wbr>Collections.singletonList(<wbr>entryPoint));<span style="white-space:pre">                </span></div><div><span style="white-space:pre">                </span>PackManager.v().runPacks();<br></div></div><div><br></div><div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CallGraph cg = Scene.v().getCallGraph();</div><div><span style="white-space:pre">                </span>PointsToAnalysis pta = Scene.v().getPointsToAnalysis(<wbr>);</div><div><span style="white-space:pre">                </span>deadlineAnalysis(cg, pta);</div></div><div>...</div><div>}</div><div><br></div><div>==== deadlineAnalysis ====</div><div><div>Unit u = ...</div><div>PatchingChain&lt;Unit&gt; units = e.src().getActiveBody().<wbr>getUnits();</div></div><div>Unit nextUnit = units.getSuccOf(u);<br></div><div>List&lt;ValueBox&gt; nextValues = nextUnit.getDefBoxes();<br></div><div>Local localValue = (Local) nextValues.get(0).getValue();<br></div><div>pta.reachingObjects(<wbr>localValue) &nbsp; ===&gt; Returns empty point-to-sets for all the locals<br></div><div><br></div><div>=== testcase ===</div><div><div><span style="white-space:pre">        </span>protected void onResume() {</div><div><span style="white-space:pre">                </span>super.onResume();</div><div><span style="white-space:pre">                </span></div><div><span style="white-space:pre">                </span>int s;</div><div><span style="white-space:pre">                </span>int s2;</div><div><span style="white-space:pre">                </span>s = 0;<br></div><div><span style="white-space:pre">                </span></div><div><span style="white-space:pre">                </span>// junk code<span style="white-space:pre">                </span></div><div><span style="white-space:pre">                </span>for (int i = 0; i &lt; 100; i++) {</div><div><span style="white-space:pre">                        </span>s = s + i;</div><div><span style="white-space:pre">                </span>}</div><div><span style="white-space:pre">                </span>s2 = s;</div><div><br></div><div><span style="white-space:pre">                </span>System.out.println(s2);<br></div><div><span style="white-space:pre">        </span>}</div></div><div><br></div></div></blockquote></div></div>