[Soot-list] ***SPAM*** 回复: 回复: call graph
水言子
1241635403 at qq.com
Thu Sep 20 08:06:25 EDT 2012
谢啦啊,嘿嘿 你也是国内的,就说中文吧 哈哈
这样也会报错 小妹我初学 所以还请您指点一下下
E:\yan>java MainDriver -w -Xmx1000m Test
Invalid option -Xmx1000m
Exception in thread "main" soot.CompilationDeat
at soot.Main.processCmdLine(Main.java:8
at soot.Main.run(Main.java:161)
at soot.Main.main(Main.java:141)
at MainDriver.main(MainDriver.java:76)
类:
public class MainDriver{
public static void main(String[] args){
List<String> argsList = new ArrayList<String>(Arrays.asList(args));
argsList.addAll(Arrays.asList(new String[]{
"-w",
"-main-class",
"Test",//main-class
"Test"}));
/* add a phase to transformer pack by call Pack.add */
Pack jtp = PackManager.v().getPack("wjtp");
jtp.add(new Transform("wjtp.myInter",new SceneTransformer() {
@Override
protected void internalTransform(String phaseName, Map options) {
CHATransformer.v().transform();
CallGraph cg = Scene.v().getCallGraph();
// SootClass c = Scene.v().getMainClass();
SootClass sClass =
Scene.v().loadClassAndSupport("Test");
sClass.setApplicationClass();
List<SootMethod> list1 = sClass.getMethods();
for(SootMethod m : list1)
{
Body body = m.getActiveBody();
Chain units = body.getUnits();
Iterator stmtIt = units.snapshotIterator();
while (stmtIt.hasNext()) {
Stmt stmt = (Stmt)stmtIt.next();
if (!stmt.containsInvokeExpr()) {
continue;
}
InvokeExpr expr = (InvokeExpr)stmt.getInvokeExpr();
List<Value> listArgs = (List<Value>)expr.getArgs();
SootMethod classTar = expr.getMethod();
}
}//while
}//for
//in function
}));
/* Give control to Soot to process all options,
* InvokeStaticInstrumenter.internalTransform will get called.
*/
args = argsList.toArray(new String[0]);
soot.Main.main(args);
}
}
public class A
{
public void fly()
{
System.out.println("I believe A can fly!");
}
}
public class B extends A
{
public void fly()
{
System.out.println("I believe B can fly!");
}
}
public class C extends B
{
@Override
public void fly()
{
System.out.println("I believe c can fly!");
}
}
public class D extends B
{
@Override
public void fly()
{
System.out.println("I believe D can fly!");
}
}
public class Test
{
public static void main(String[] args)
{
B b1 = new B();
fun1(b1); // I believe B can fly!
fun2(b1); // I believe C can fly!
}
public static void fun1(A a1)
{
a1.fly();
}
public static void fun2(B b1)
{
B b2 = b1;
b2 = new C();
b2.fly();
}
}
------------------ 原始邮件 ------------------
发件人: "Cheng Zhang";
发送时间: 2012年9月20日(星期四) 晚上8:01
收件人: "水言子"<1241635403 at qq.com>;
抄送: "soot-list";
主题: Re: 回复: [Soot-list] call graph
Hi,
As indicated by the error message, please set the -Xmx option (e.g. -Xmx1000m) to allocate larger heap space.
Best,
Cheng
On Thu, Sep 20, 2012 at 7:39 PM, 水言子 <1241635403 at qq.com> wrote:
Hi:
I am very glad to your replay!But when I put:" java CallGraphs -w CallExampleGraph"
Soot started on Thu Sep 20 19:22:55 CST 2012
[Call Graph] For information on where the call graph may be incomplete,
verbose option to the cg phase.
Soot has run out of the memory allocated to it by the Java VM.
To allocate more memory to Soot, use the -Xmx switch to Java.
For example (for 400MB): java -Xmx400m soot.Main ...
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
------------------ 原始邮件 ------------------
发件人: "Cheng Zhang";
发送时间: 2012年9月20日(星期四) 晚上6:17
收件人: "水言子"<1241635403 at qq.com>;
抄送: "soot-list";
主题: Re: [Soot-list] call graph
Hi,
Sorry, I am not familiar with the example "callGraphs" you mentioned.
But if your purpose is to obtain the call graph in Soot, here are some general steps:
1. Enable the -w option on the command line fed to soot.Main
2. Extend the class soot.SceneTransformer and implement the method internalTransform
3. In the method internalTransform, use Scene.v().getCallGraph() to obtain the call graph.
For more details, you may refer to the survivor guide, especially chapters 4 and 7.
http://www.brics.dk/SootGuide/sootsurvivorsguide.pdf
Best,
Cheng
On Thu, Sep 20, 2012 at 5:05 PM, 水言子 <1241635403 at qq.com> wrote:
hello:
I am a new to Soot.I want to know how to run the example "callGraphs" in Soot's examples
file ,using common line!
Can you help me!
I need you help!!!
Thanks!
_______________________________________________
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/20120920/9bfe0e7d/attachment-0001.html
More information about the Soot-list
mailing list