[Soot-list] Duplicating Locals!!

M Alsob m99m20 at hotmail.com
Wed Feb 26 22:09:18 EST 2014


Hi all,
Any idea why is that happening??
Thanx!




From: m99m20 at hotmail.com
To: steven.arzt at cased.de; soot-list at sable.mcgill.ca
Date: Sat, 22 Feb 2014 14:57:19 +0000
Subject: Re: [Soot-list] Duplicating Locals!!




Hi,this is the part of code lines that produces the output,
SootClass aMainClass = Scene.v().getMainClass();                List<SootMethod> mainClassMethods = aMainClass.getMethods();		for(int i =0;i<mainClassMethods.size();i++)		{		    	BriefUnitGraph methodCFG = new BriefUnitGraph(mainClassMethods.get(i).retrieveActiveBody()); // Retrieve method body and build its CFG		    	Chain<Local> methodLocals = methodCFG.getBody().getLocals();                        ArrayList<VarInfo> varsInfo = new ArrayList<VarInfo>();		    	Iterator<Local> localIt = methodLocals.iterator();			while(localIt.hasNext())		       	{				Value varVal = localIt.next();				VarInfo varInfo = new VarInfo();				varInfo.varName = varVal.toString();				varInfo.varType = varVal.getType().toString();				Iterator<Unit> gIt = methodCFG.iterator();			  	while (gIt.hasNext()) 				{					Unit u = (Unit)gIt.next();					for (ValueBox box : u.getDefBoxes())			  		{			  			if(box.getValue().equals(varVal))			  			varInfo.defLines.add(u.getTags().toString());			  		}			  		for (ValueBox box : u.getUseBoxes())			 		{			   			if(box.getValue().equals(varVal)){			   			varInfo.useLines.add(u.getTags().toString());					}				}				varsInfo.add(varInfo);			}			wirteVarsInformation(varsInfo);// prints the arraylist 		}Thanx,Modhi,,





From: Steven.Arzt at cased.de
To: m99m20 at hotmail.com; soot-list at sable.mcgill.ca
Subject: RE: [Soot-list] Duplicating Locals!!
Date: Fri, 21 Feb 2014 20:50:51 +0100

Hi, for reproducing the issue, it would be great if you could also send us the code you are using to create this output, i.e. the code you use to run Soot. Only from the target application and the short description of your approach, it’s hard to tell what’s going wrong here. Best regards,  Steven From: soot-list-bounces at sable.mcgill.ca [mailto:soot-list-bounces at sable.mcgill.ca] On Behalf Of M Alsob
Sent: Freitag, 21. Februar 2014 18:36
To: soot-list at sable.mcgill.ca
Subject: [Soot-list] Duplicating Locals!! Hi all,I am experiencing something odd with soot, and I am wondering whether is it supposed to happen this way or is it a bug in the system,,the code I am running is very simple, it just traverses a method unit graph,  it iterates over locals and for each local variable, it outputs the following info:given name, type, definition lines and use lines.. (just using getDefBoxs and getUseBoxes)for some variables the tool outputs two results with different types( e.g. w and y ) and for some it duplicates them and outputs them as two different vars( e.g. x)!! why is that happening and is there a way to fix that??Thanx.. this is a snapshot of the code in the java file: 38:   int w = 5, y,x,z;39:   y=w-1;40:   x = 3+y;41:   z = x*y;42:   if(y>0)43:   {44:       z=x++;45:       if(someCondtionThatDoesNotIncludeTheVars))46:       while(w>y)47:       {48:                   y += 10;49:                   fun(y);50:       }51:       else52:                   fun(y);53:   }54:   x = z*z;55:   w = x;56:   y = 0; and this is some of the result: -- Variable: w, Type: byte = {  Definition Lines: [[38, 38]] Use Lines: [[39, 39], [46]]}  -- Variable: y, Type: int = {  Definition Lines: [[39, 39], [48]] Use Lines: [[40, 40], [41, 41], [42], [48], [49], [46], [52]]} -- Variable: x, Type: int = {  Definition Lines: [[40, 40]] Use Lines: [[41, 41], [44], [44, 44]]}  -- Variable: z, Type: int = {  Definition Lines: [[41, 41], [44, 44]] Use Lines: [[54, 54], [54, 54], [58]] }  -- Variable: x, Type: int = {  Definition Lines: [[44], [54, 54]] Use Lines: [[55, 55], [58], [58]]}  -- Variable: w, Type: int = {  Definition Lines: [[55, 55]] Use Lines: [[58]]}  -- Variable: y, Type: boolean = {  Definition Lines: [[56, 56]] Use Lines: []}  



 		 	   		  

_______________________________________________
Soot-list mailing list
Soot-list at sable.mcgill.ca
http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.cs.mcgill.ca/pipermail/soot-list/attachments/20140227/15f34f23/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.jpg
Type: image/jpeg
Size: 407 bytes
Desc: not available
Url : http://mailman.cs.mcgill.ca/pipermail/soot-list/attachments/20140227/15f34f23/attachment-0001.jpg 


More information about the Soot-list mailing list