[Soot-list] about reaching definition

Peng Li lipeng360 at gmail.com
Fri Dec 8 14:59:00 EST 2006


HI,
I am using the following code to find all the reaching def of a very simple
progam


 ExceptionalUnitGraph EUG=new ExceptionalUnitGraph(body);
        SimpleLocalDefs sld = new SimpleLocalDefs(EUG);
        Iterator it = body.getUnits().iterator();
        while (it.hasNext()){
            Stmt s = (Stmt)it.next();
  Iterator usesIt = s.getUseBoxes().iterator();
            while (usesIt.hasNext()){
                ValueBox vbox = (ValueBox)usesIt.next();
                if (vbox.getValue() instanceof Local) {
                    Local l = (Local)vbox.getValue();
                    Iterator rDefsIt = sld.getDefsOfAt(l, s).iterator();
                    while (rDefsIt.hasNext()){
                        Stmt next = (Stmt)rDefsIt.next();
                        String info = l+" has reaching def:
"+next.toString();
                        System.out.println(info);

                    }
                }
            }
        }


the program is

public class test {
 public static void main(String[] args) throws Exception {
 int x,y,z,m;
 y=3;
 x=y;
 m=x;
 z=m;}
}

when i run soot, i got the following result

r0 has reaching def: r0 := @this: test
b0 has reaching def: b0 = 3
b1 has reaching def: b1 = b0
b2 has reaching def: b2 = b1

looks like soot just find partial reaching defs. for example, y=3 is a
reaching def of x=y, m=x and z=m, but from the results,we can see that soot
just find one. Furthermore, for the last stmt z=m, soot even doesnot find
any reaching def.

Could anyone give some suggestions?

Cheers

P
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.CS.McGill.CA/pipermail/soot-list/attachments/20061209/963b84df/attachment.htm


More information about the Soot-list mailing list