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

Bodden, Eric eric.bodden at sit.fraunhofer.de
Sun Apr 5 06:31:30 EDT 2015


Hi Pegah.

Try calling Soot's original mail method, i.e., soot.Main.main, unless you really know what you are doing. It might well be that your Options are not being picked up because they are never being parsed in your code.

Cheers,
Eric

> On 03.04.2015, at 13:39, Pegah Jandaghi <jandaghi72 at gmail.com> wrote:
> 
> 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
> _______________________________________________
> Soot-list mailing list
> Soot-list at CS.McGill.CA
> https://mailman.CS.McGill.CA/mailman/listinfo/soot-list

--
Prof. Eric Bodden, Ph.D., http://sse.ec-spride.de/ http://bodden.de/
Head of Secure Software Engineering at Fraunhofer SIT, TU Darmstadt and EC SPRIDE
Tel: +49 6151 16-75422    Fax: +49 6151 869-127
Room B5.11, Fraunhofer SIT, Rheinstraße 75, 64295 Darmstadt

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 841 bytes
Desc: Message signed with OpenPGP using GPGMail
Url : https://mailman.CS.McGill.CA/pipermail/soot-list/attachments/20150405/1d18a6f8/attachment.bin 


More information about the Soot-list mailing list