[Soot-list] Problem with line numbers and variable names

Pegah Jandaghi jandaghi72 at gmail.com
Fri Apr 3 07:39:09 EDT 2015


Hello everyone

I've been using soot eclipse plugin for running a simple method. And now
I'm trying to run the method without plugin but the result of method is
different for the same class:

the method is:

public static void Analysis(CompleteUnitGraph graph) {
     Iterator unitIt = graph.iterator();
  for (Unit unit : graph) {
  G.v().out.println(unit.toString());
      if (unit.t.getTag("SourceLnPosTag") != null)
           G.v().out.println( ((SourceLnPosTag)
unit.getTag("SourceLnPosTag")).startLn();
      }
}

and the simple class which I want to show the units is:

public class foo{
     public static void main(String[] args){
          int a = 1;
          System.out.println(a);
     }
}

and  main method which invokes Analysis on foo is :

String sep = File.separator;
String pathSep = File.pathSeparator;
String path =System.getProperty("java.home") + sep + "lib" + sep+ "rt.jar"
+ pathSep +  System.getProperty("java.home") + sep+"lib" + sep + "jce.jar"
+ path + fooPath;

Options.v().set_soot_classpath(path);
Options.v().set_keep_line_number(true);
Options.v().setPhaseOption("jb", "use-original-names:true");
SootClass sClass = Scene.v().loadClassAndSupport("foo");
sClass.setApplicationClass();
Scene.v().loadNecessaryClasses();
Body body = sClass.getMethodByName("main").retrieveActiveBody();
Analysis(new CompleteUnitGraph(body));

The first problem is that for all of the units "SourceLnPosTag" is null.
and the second problem is that the units have different variable names.
Is there any way to get the same units without using plugin?

Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://mailman.CS.McGill.CA/pipermail/soot-list/attachments/20150403/bac34b0e/attachment.html 


More information about the Soot-list mailing list