[Soot-list] Howto generate a CallGraph?
Marco Bakera
marco.bakera at uni-dortmund.de
Fri Apr 18 06:26:06 EDT 2008
Thank you for that hint li xin. Now Soot seems to create the calling graph.
However I am not able to fetch it from Scene afterwards since soot terminates
after invocation of soot.Main.main() with a System.exit(). :(
Any suggestions?
I used the following snippet for my tests.
public CallGraphCreator(String clazz) {
G.reset();
// setup soot class path
String cp = System.getProperty("java.class.path");
String java_home = System.getProperty("java.home");
Scene.v().setSootClassPath(String.format("%s:%s/lib/rt.jar:%s/lib/jce.jar",
cp,java_home,java_home));
String opts = "-w " + clazz;
Main.main(opts.split(" "));
CallGraph callGraph = Scene.v().getCallGraph();
// The following debug outputs do not appear on console
LOG.debug("Created call graph");
LOG.debug(callGraph);
LOG.debug(new Date());
}
public static void main(String[] args) {
new CallGraphCreator(CallGraphCreator.class.getName());
}
On Friday 18 April 2008 09:27:00 li xin wrote:
> Hi,
>
> The error message at least shows that you have to put jce.jar into your
> soot-class-path.
>
> Regards, LI
>
>
> On Fri, Apr 18, 2008 at 3:52 PM, Marco Bakera
> <marco.bakera at uni-dortmund.de>
>
> wrote:
> > Hey everybody,
> >
> > I try to generate a call graph from a given class. I thought the
> > following snippet would do but ran into troubles.
> >
> > public CallGraphCreator(String clazz) {
> > G.reset();
> >
> >
> >
> > Scene.v().setSootClassPath("/home/bakera/tools/jdk1.5.0_15/jre/lib/rt.jar
> >");
> >
> > // SootClass sootClass =
> > Scene.v().loadClassAndSupport(clazz);
> >
> > String opts = "-w -keep-line-number -x javax " + clazz;
> > // sootClass.setApplicationClass();
> > // Scene.v().setMainClass(sootClass);
> > Main.main(opts.split(" "));
> >
> > CallGraph callGraph = Scene.v().getCallGraph();
> >
> > }
> >
> > public static void main(String[] args) {
> > new CallGraphCreator(CallGraphCreator.class.getName());
> > }
> >
> >
> >
> > When starting the program I get the following stacktrace.
> >
> > Exception in thread "main" java.lang.RuntimeException: couldn't find
> > class:
> > javax.crypto.Cipher (is your soot-class-path set properly?)
> > at soot.SootResolver.bringToHierarchy(SootResolver.java:139)
> > at soot.SootResolver.bringToSignatures(SootResolver.java:172)
> > at soot.SootResolver.bringToBodies(SootResolver.java:214)
> > at soot.SootResolver.processResolveWorklist(SootResolver.java:100)
> > at soot.SootResolver.resolveClass(SootResolver.java:89)
> > at soot.Scene.tryLoadClass(Scene.java:305)
> > at soot.Scene.loadBasicClasses(Scene.java:855)
> > at soot.Scene.loadNecessaryClasses(Scene.java:881)
> > at soot.Main.run(Main.java:170)
> > at soot.Main.main(Main.java:146)
> > at
> >
> > de.metaframe.plugin.soot2jabc.CallGraphCreator.<init>(CallGraphCreator.ja
> >va:32) at
> >
> > de.metaframe.plugin.soot2jabc.CallGraphCreator.main(CallGraphCreator.java
> >:39)
> >
> >
> > What's the common way to create a simple call graph? Thanks for any
> > hint/code
> > snippet/pointer in documentation on this. :)
> >
> >
> > Greetings from Germany,
> > Marco.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://mailman.CS.McGill.CA/pipermail/soot-list/attachments/20080418/2a72498b/attachment.bin
More information about the Soot-list
mailing list