[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Scene.v().getPack() unresolved
hi .
i am registering the tranformation class in to the
GPRT pack but here the error it is giving is
getpack("wjtp") is not recognised in the scene
please any body has got this problem than give me a
solution why this i am getting
i am new to the soot and i am compiling the the
program which is downloaded from the moreabout soot
article
the program is
package com;
import soot.*;
import soot.jimple.*;
import soot.util.*;
import java.io.*;
import java.util.*;
/**
Example of iterating all the classes.
*/
public class SimplePrinter
{
public static void main(String[] args)
{
if(args.length == 0)
{
System.out.println("Syntax: java
SimplePrinter [soot options]");
System.exit(0);
}
// Register class GPrt as a transformer,
// So that the "internalTransform" will be called
after all classes
// loaded
Scene.v().getPack("wjtp").add(new
Transform("wjtp.gprinter", GPrt.v()));
// Execute soot
soot.Main.main(args);
}
}
class GPrt extends SceneTransformer
{
// Hooks needed by Framwork:
private static GPrt instance = new GPrt();
private GPrt() {}
public static GPrt v() { return instance; }
// This is the key method:
protected void internalTransform(String phaseName,
Map options)
{
System.out.println("Start Printer");
System.out.println("=======================================");
// Scene is the root of AST
Chain classList = Scene.v().getApplicationClasses();
Iterator classIt = classList.iterator();
while (classIt.hasNext()){
// Iterate over all classes
SootClass sc = (SootClass) classIt.next();
System.out.println(sc.getName());
Iterator fIt = sc.getFields().iterator();
while (fIt.hasNext()){
// Iterate over all fields of the current class
SootField sf = (SootField) fIt.next();
System.out.println(" "+sf.getName());
}
Iterator mIt = sc.getMethods().iterator();
while (mIt.hasNext()){
// Iterate over all methods of the current class
SootMethod sm = (SootMethod) mIt.next();
System.out.println(" "+sm.getSignature());
if (sc.isContextClass() ||
sc.isPhantomClass()){
continue;
}
Body mthdBody = sm.retrieveActiveBody();
Iterator varIt = mthdBody.getLocals().iterator();
while (varIt.hasNext()){
// Iterate over all variables of the current
method
Local l = (Local) varIt.next();
System.out.print(" "+l.getType().toString());
System.out.println(" "+l.getName());
}
System.out.println("");
Iterator stmtIt = mthdBody.getUnits().iterator();
while (stmtIt.hasNext()){
// Iterate over all statements of the current
method
Stmt s = (Stmt) stmtIt.next();
System.out.println("
StmtClass:"+s.getClass());
System.out.println(" "+s.toString());
}
}
}
System.out.println("====================================");
System.out.println("Finished!");
}
}
__________________________________
Do you Yahoo!?
Yahoo! Mail - 50x more storage than other providers!
http://promotions.yahoo.com/new_mail