[Soot-list] (no subject)

Yu Adam ykff8725 at gmail.com
Thu Oct 24 04:49:50 EDT 2013


Greetings !
I want to instrument a .class file to output some values at runtime, while
I found that when acheiving the cfg of the instrumented method, the option
"use-original-names:true" doesn't work, so that the values cann't be
mapped. The code of getting cfg is as shown below:

PhaseOptions.v().setPhaseOption("jb","use-original-names:true");
Body methodBody=method.retrieveActiveBody();
ExceptionalUnitGraph graph = new ExceptionalUnitGraph(methodBody);
Unit i=null;
Iterator<Unit>  it = graph.iterator();
while(it.hasNext()){
i=it.next();
System.out.println(i.toString());
}

I also have tried the soot.Main.main(args). Certainly, the original .class
can get the right cfg. I used the example on
http://www.sable.mcgill.ca/soot/tutorial/profiler2/ and get the same
result. The original cfg of the method "main" in class "TestInvoke" is:
args := @parameter0: java.lang.String[]
i = 0
goto [?= (branch)]
staticinvoke <TestInvoke: void foo()>()
i = i + 1
...

 while the cfg of the instrumented method shows as:
l0 := @parameter0: java.lang.String[]
l0 = 0
goto [?= (branch)]
staticinvoke <MyCounter: void increase(int)>(1)
staticinvoke <TestInvoke: void foo()>()
l0 = l0 + 1
...
The option keep_line_number has the same situation.
Can anyone help ?

Best regards!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.cs.mcgill.ca/pipermail/soot-list/attachments/20131024/4e7b6343/attachment.html 


More information about the Soot-list mailing list