[Soot-list] Regarding Call Graph

John Ng john.ng162014 at gmail.com
Tue Sep 1 19:30:25 EDT 2015


Hello,

I have a class as follows:
------------------------
package testers;

import java.util.Iterator;

public class CallGraphs {

  Cell[] cells;

  class Cell {
    private int cell = 0;

    public Cell(int cell) {
      this.cell = cell;
    }

    public int getCell() {
      return cell;
    }
  }

  class CellIterator implements Iterator<Cell> {
    private int idx, end;

    public CellIterator(int idx, int end) {
      this.idx = idx;
      this.end = end;
    }

    public boolean hasNext() {
      return idx < end;
    }

    public Cell next() {
      return cells[idx++];
    }

    public void remove() {
    }
  }

  void testIterator() {
    cells = new Cell[5];
    Cell c0 = new Cell(0);
    Cell c1 = new Cell(1);
    Cell c2 = new Cell(2);
    cells[0] = c0;
    cells[1] = c1;
    cells[2] = c2;
    Iterator<Cell> iterator = new CellIterator(0, 3);
    while (iterator.hasNext()) {
      Cell c = iterator.next();
      System.out.println(c.getCell());
    }
  }

  public static void main(String[] args) {
    CallGraphs cG = new CallGraphs();
    cG.testIterator();
  }
}
---------------------------------

I used Soot to build a call graph for the class. The call graph is exploded
because of the method: <testers.CallGraphs$CellIterator: java.lang.Object
next()>.
The method  <testers.CallGraphs$CellIterator: java.lang.Object next()> is
the target method of <testers.CallGraphs$CellIterator:
testers.CallGraphs$Cell next()>. The tool reported that this method is
called by many other methods such as:
<sun.security.util.DisabledAlgorithmConstraints$KeySizeConstraints: boolean
disables(java.security.Key)>
<sun.misc.ProxyGenerator$ProxyMethod: sun.misc.ProxyGenerator$MethodInfo
generateMethod()>
<sun.misc.ProxyGenerator$MethodInfo: void write(java.io.DataOutputStream)>
<sun.misc.ProxyGenerator$ConstantPool: void write(java.io.OutputStream)>
<sun.misc.ProxyGenerator: sun.misc.ProxyGenerator$MethodInfo
generateStaticInitializer()>
<sun.misc.ProxyGenerator: sun.misc.ProxyGenerator$MethodInfo
generateStaticInitializer()>
<sun.misc.ProxyGenerator: void
addProxyMethod(java.lang.reflect.Method,java.lang.Class)>
<sun.security.x509.ExtendedKeyUsageExtension: java.util.List
getExtendedKeyUsage()>
<java.security.KeyFactory: java.security.KeyFactorySpi
nextSpi(java.security.KeyFactorySpi)>
<sun.misc.ProxyGenerator: void checkReturnTypes(java.util.List)>
<sun.misc.ProxyGenerator: byte[] generateClassFile()>
<sun.misc.ProxyGenerator: byte[] generateClassFile()>
....
It seems the result is not correct. Can you let me know how to deal with
this case.

Thank you very much!

Best,
John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://mailman.CS.McGill.CA/pipermail/soot-list/attachments/20150901/0af36f69/attachment.html 


More information about the Soot-list mailing list