[Soot-list] Preferred method to obtain SootMethod from .class or .java file
Eric Bodden
bodden at st.informatik.tu-darmstadt.de
Tue May 10 03:13:20 EDT 2011
Hi Rick.
> My question is: what is the preferred method for obtaining a SootMethod of
> the main function from a .class or .java file? Should I do something else
> with the InputStream I give to the JimpleAST, do I need to try another way
> entirely?
I think you went the wrong way. As our tutorials would tell you, the
way to go is to insert a BodyTransformer:
public static void main(String[] args) {
PackManager.v().getPack("jtp").add(
new Transform("jtp.myTransform", new BodyTransformer() {
protected void internalTransform(Body body, String phase, Map options) {
//just use "body" here
}
}));
soot.Main.main(args);
}
In this code, Soot will call internalTransform once for every method
body in your program, passing a JimpleBody in as "body". You can use
this main class and just apply it to .java and .class files alike.
Eric
--
Dr. Eric Bodden, http://bodden.de/
Principal Investigator in Secure Services at CASED
Coordinator of the CASED Advisory Board of Study Affairs
PostDoc at Software Technology Group, Technische Universität Darmstadt
Tel: +49 6151 16-5478 Fax: +49 6151 16-5410
Mailing Address: S2|02 A209, Hochschulstraße 10, 64289 Darmstadt
More information about the Soot-list
mailing list