[Soot-list] SPARK call graph generation

Upulee Kanewala upuleegk at gmail.com
Tue May 9 11:38:58 EDT 2017


Hi Bernhard,

I am using custom entry points as described in:
https://github.com/Sable/soot/wiki/Using-Soot-with-custom-entry-points

Following is my code:

public static void main(String[] args) {

  List<String> argsList = new ArrayList<String>(Arrays.asList(args));

  argsList.addAll(Arrays.asList(new String[]{

  "-allow-phantom-refs",

  "-w",

  //"-no-bodies-for-excluded",

  "-cp",

  "/Users/Downloads/jscience-4.2.3/jscience.jar",

  "-process-dir",

  "/Users//Downloads/jscience-4.2.3/jscience.jar"

  }));

  args = argsList.toArray(new String[0]);

  Options.v().parse(args);

   SootClass c = Scene.v().forceResolve(
"org.jscience.mathematics.vector.LUDecomposition", SootClass.BODIES);

    c.setApplicationClass();

    Scene.v().loadNecessaryClasses();

    SootMethod method=c.getMethodByName("solve");

    List entryPoints=new ArrayList();

    entryPoints.add(method);

    Scene.v().setEntryPoints(entryPoints);

    HashMap opt = new HashMap();

    opt.put("enabled","true");

   opt.put("verbose","true");

   opt.put("ignore-types","false");

   opt.put("force-gc","false");

   opt.put("pre-jimplify","false");

   opt.put("vta","false");

   opt.put("rta","false");

   opt.put("field-based","false");

   opt.put("types-for-sites","false");

   opt.put("merge-stringbuffer","true");

   opt.put("string-constants","false");

   opt.put("simulate-natives","true");

   opt.put("simple-edges-bidirectional","false");

   opt.put("on-fly-cg","true");

   opt.put("simplify-offline","false");

   opt.put("simplify-sccs","false");

   opt.put("ignore-types-for-sccs","false");

   opt.put("propagator","worklist");

   opt.put("set-impl","double");

   opt.put("double-set-old","hybrid");

   opt.put("double-set-new","hybrid");

   opt.put("dump-html","false");

   opt.put("dump-pag","false");

   opt.put("dump-solution","false");

   opt.put("topo-sort","false");

   opt.put("dump-types","true");

   opt.put("class-method-var","true");

   opt.put("dump-answer","false");

   opt.put("add-tags","false");

   opt.put("set-mass","false");

           //PackManager.v().runPacks();

   SparkTransformer.v().transform("",opt);

           CallGraph cg = Scene.v().getCallGraph();

      System.out.println(cg.size());

      serializeCallGraph(cg,"sparkCallGraph.dot")

}
Thanks,
- Upulee
------------------------------------------------------------------
Upulee Kanewala, Ph.D.
Assistant Professor
Computer Science Department
Montana State University
Email: upulee.kanewala at cs.montana.edu
URL: http://www.cs.montana.edu/upulee.kanewala/
---------------------------------------------------------------------

On Tue, May 9, 2017 at 2:06 AM, Bernhard Berger <berber at tzi.de> wrote:

> Hi Upulee,
>
> how do you generate the call graph? Normally Soot expects a static
> main-method to work correctly. Using non-static entry points has showed to
> result ins troubles: https://mailman.cs.mcgill.ca/pipermail/soot-list/
> 2013-January/005105.html
>
> Regards, Bernhard
>
> Am 08.05.2017 um 23:37 schrieb Upulee Kanewala <upuleegk at gmail.com>:
>
> Hello all,
>
> I am using SPARK to generate the call graph for a method from JScience
> listed below. The generated call graph only has the following three nodes
> and the edges:
>
> solve -> StringBuilder:<init>
> solve -> DimentionException:<init>
> DimentionException:<init> -> RunTimeException:<init>
>
> What is the reason for missing the other method calls in the solve()
> method. Am I missing an option that is causing this? (I followed the
> examples in the survivor's guide to write my code).
>
>
>  /**
>      * Returns the solution X of the equation: A * X = B  with
>      * <code>this = A.lu <http://a.lu/>()</code> using back and forward
> substitutions.
>      *
>      * @param  B the input matrix.
>      * @return the solution X = (1 / A) * B.
>      * @throws DimensionException if the dimensions do not match.
>      */
>     public DenseMatrix<F> solve(Matrix<F> B) {
>         if (_n != B.getNumberOfRows())
>             throw new DimensionException("Input vector has "
>                     + B.getNumberOfRows() + " rows instead of " + _n);
>
>         // Copies B with pivoting.
>         final int n = B.getNumberOfColumns();
>         DenseMatrix<F> X = createNullDenseMatrix(_n, n);
>         for (int i = 0; i < _n; i++) {
>             for (int j = 0; j < n; j++) {
>                 X.set(i, j, B.get(_pivots.get(i).intValue(), j));
>             }
>         }
>
>         // Solves L * Y = pivot(B)
>         for (int k = 0; k < _n; k++) {
>             for (int i = k + 1; i < _n; i++) {
>                 F luik = _LU.get(i, k);
>                 for (int j = 0; j < n; j++) {
>                     X.set(i, j, X.get(i, j).plus(
>                             luik.times(X.get(k, j).opposite())));
>                 }
>             }
>         }
>
>         // Solves U * X = Y;
>         for (int k = _n - 1; k >= 0; k--) {
>             for (int j = 0; j < n; j++) {
>                 X.set(k, j, (_LU.get(k, k).inverse()).times(X.get(k, j)));
>             }
>             for (int i = 0; i < k; i++) {
>                 F luik = _LU.get(i, k);
>                 for (int j = 0; j < n; j++) {
>                     X.set(i, j, X.get(i, j).plus(
>                             luik.times(X.get(k, j).opposite())));
>                 }
>             }
>         }
>         return X;
>     }
>
>
> Thanks,
> - Upulee
>
> _______________________________________________
> Soot-list mailing list
> Soot-list at CS.McGill.CA
> https://mailman.CS.McGill.CA/mailman/listinfo/soot-list
>
>
>
> _______________________________________________
> Soot-list mailing list
> Soot-list at CS.McGill.CA
> https://mailman.CS.McGill.CA/mailman/listinfo/soot-list
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.CS.McGill.CA/pipermail/soot-list/attachments/20170509/ac2a04af/attachment-0001.html>


More information about the Soot-list mailing list