{"action":"created","issue":{"url":"https://api.github.com/repos/Sable/soot/issues/332","labels_url":"https://api.github.com/repos/Sable/soot/issues/332/labels{/name}","comments_url":"https://api.github.com/repos/Sable/soot/issues/332/comments","events_url":"https://api.github.com/repos/Sable/soot/issues/332/events","html_url":"https://github.com/Sable/soot/issues/332","id":54303691,"number":332,"title":"Is points-to analysis still maintained and supported?","user":{"login":"sertel","id":3703100,"avatar_url":"https://avatars.githubusercontent.com/u/3703100?v=3","gravatar_id":"","url":"https://api.github.com/users/sertel","html_url":"https://github.com/sertel","followers_url":"https://api.github.com/users/sertel/followers","following_url":"https://api.github.com/users/sertel/following{/other_user}","gists_url":"https://api.github.com/users/sertel/gists{/gist_id}","starred_url":"https://api.github.com/users/sertel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sertel/subscriptions","organizations_url":"https://api.github.com/users/sertel/orgs","repos_url":"https://api.github.com/users/sertel/repos","events_url":"https://api.github.com/users/sertel/events{/privacy}","received_events_url":"https://api.github.com/users/sertel/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-01-14T10:01:21Z","updated_at":"2015-01-14T10:32:34Z","closed_at":null,"body":"Hi,\r\n\r\nI'm trying to use Soot's points to analysis and found this e-mail from the Soot mailing list that says I should be using SPARK instead of PADDLE:\r\nhttps://mailman.cs.mcgill.ca/pipermail/soot-list/2012-September/004823.html\r\n\r\nSo I started trying to use the example from the survivor guide and hit several problems:\r\n\r\n1. I'm on a MAC OS X. Scene.getDefaultClasspath is differentiating between the classpaths depending on the OS version. Sadly, it constructed the wrong one for me and I had to copy the code for \"normal\" OS and define it explicitly in my test code.\r\n2. One has to explicit turn the optimization on via ```opt.put(\"enabled\", \"true\");``` otherwise the transformation is just not performed. This is not mentioned in the example code of the Soot survivor guide.\r\n3. The \"on-fly-cg\" option is a no-op. Looking into the source code, it always uses the OnFlyCallGraphBuilder.\r\n4. The transformation finally hits an error in the call graph construction: ```java.lang.ClassCastException: soot.baf.internal.BIdentityInst cannot be cast to soot.jimple.Stmt```. I also looked into the code and saw no easy way to essentially fix this from the outside. Seems like the OnFloyCallGraphBuilder expects an entirely different internal data structure tree at this point.\r\n\r\nI was running on the soot-trunk.jar of today (14.01.2015) using Java 1.8.\r\n\r\nHere is the code of the test case:\r\n```\r\npublic class testSoot {\r\n  \r\n  /*\r\n   * Example taken from the Soot survivors guide.\r\n   */\r\n  public static class Item {\r\n    Object data;\r\n  }\r\n  \r\n  public static class Container {\r\n    private Item item = new Item();\r\n    \r\n    void setItem(Item item) {\r\n      this.item = item;\r\n    }\r\n    \r\n    Item getItem() {\r\n      return this.item;\r\n    }\r\n  }\r\n  \r\n  public static class MyContainer {\r\n    public void go() {\r\n      Container c1 = new Container();\r\n      Item i1 = new Item();\r\n      c1.setItem(i1);\r\n      Container c2 = new Container();\r\n      Item i2 = new Item();\r\n      c2.setItem(i2);\r\n      Container c3 = c2;\r\n    }\r\n  }\r\n  \r\n  private static SootClass loadClass(String name) {\r\n    SootClass c = Scene.v().loadClassAndSupport(name);\r\n    c.setApplicationClass();\r\n    return c;\r\n  }\r\n  \r\n  @SuppressWarnings(\"unused\")\r\n  @Test\r\n  public void testSpark() throws Throwable {\r\n    // code copied from Scene.getDefaultClasspath\r\n    StringBuffer sb = new StringBuffer();\r\n    sb.append(System.getProperty(\"java.class.path\") + File.pathSeparator);\r\n    sb.append(System.getProperty(\"java.home\"));\r\n    sb.append(File.separator);\r\n    sb.append(\"lib\");\r\n    sb.append(File.separator);\r\n    sb.append(\"rt.jar\");\r\n    \r\n    // configure soot (it tries to do something sophisticated in Scene.getDefaultClasspath for\r\n    // MAC OS X and fails)\r\n    Options.v().set_soot_classpath(sb.toString());\r\n        \r\n    // load class to be inspected into Soot\r\n    SootClass i = loadClass(Item.class.getName());\r\n    SootClass s = loadClass(Container.class.getName());\r\n  \r\n    SootClass c = Scene.v().forceResolve(MyContainer.class.getName(), SootClass.BODIES);\r\n    c.setApplicationClass();\r\n    Scene.v().loadNecessaryClasses();\r\n    SootMethod method = c.getMethodByName(\"go\");\r\n    List<SootMethod> entryPoints = new ArrayList<>();\r\n    entryPoints.add(method);\r\n    Scene.v().setEntryPoints(entryPoints);\r\n    PackManager.v().runPacks();\r\n\r\n    // call SPARK\r\n    HashMap<String, String> opt = new HashMap<>();\r\n    opt.put(\"verbose\", \"true\");\r\n    opt.put(\"propagator\", \"worklist\");\r\n    opt.put(\"simple-edges-bidirectional\", \"false\");\r\n    opt.put(\"on-fly-cg\", \"false\"); // <- does not work anymore!\r\n    opt.put(\"set-impl\", \"double\");\r\n    opt.put(\"double-set-old\", \"hybrid\");\r\n    opt.put(\"double-set-new\", \"hybrid\");\r\n    opt.put(\"enabled\", \"true\"); // <- need to explicitly enable it\r\n    SparkTransformer.v().transform(\"\", opt);\r\n  }\r\n}\r\n```\r\n\r\nCheers,\r\nSebastian."},"comment":{"url":"https://api.github.com/repos/Sable/soot/issues/comments/69897250","html_url":"https://github.com/Sable/soot/issues/332#issuecomment-69897250","issue_url":"https://api.github.com/repos/Sable/soot/issues/332","id":69897250,"user":{"login":"StevenArzt","id":2691304,"avatar_url":"https://avatars.githubusercontent.com/u/2691304?v=3","gravatar_id":"","url":"https://api.github.com/users/StevenArzt","html_url":"https://github.com/StevenArzt","followers_url":"https://api.github.com/users/StevenArzt/followers","following_url":"https://api.github.com/users/StevenArzt/following{/other_user}","gists_url":"https://api.github.com/users/StevenArzt/gists{/gist_id}","starred_url":"https://api.github.com/users/StevenArzt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/StevenArzt/subscriptions","organizations_url":"https://api.github.com/users/StevenArzt/orgs","repos_url":"https://api.github.com/users/StevenArzt/repos","events_url":"https://api.github.com/users/StevenArzt/events{/privacy}","received_events_url":"https://api.github.com/users/StevenArzt/received_events","type":"User","site_admin":false},"created_at":"2015-01-14T10:32:34Z","updated_at":"2015-01-14T10:32:34Z","body":"Please do no invoke SPARK manually. Instead, enable whole-program mode and then call runPacks(). This will automatically prepare everything that is needed and then generate the callgraph. Normally, you don't need to give any options to SPARK aside from enabling it in the Soot options.\r\n\r\nTry this:\r\n\r\n```\r\nOptions.v().set_whole_program(true);\r\nOptions.v().setPhaseOption(\"cg.spark\", \"on\");\r\nScene.v().loadNecessaryClasses();\r\n\r\nOptions.v().set_main_class(entryPoint.getSignature());\r\nPackManager.v().runPacks();\r\n\r\n// Happily use the callgraph\r\nSystem.out.println(Scene.v().getCallGraph().size());\r\n```\r\n\r\nOf course, you still need to set your Soot classpath and so on, but for SPARK that should be it."}}