[Soot-list] custom entry points on a CallGraph

Bodden, Eric eric.bodden at sit.fraunhofer.de
Thu Feb 6 11:48:51 EST 2014


Dear Moritz,

before we discuss any further - have you read this article and tried this out?
http://www.bodden.de/2012/07/26/soot-custom-entry-points/

If this does not work for you then it would help us to know what kind of entry points you would like to consider. Soot basically gives you three different options:

a) literally use a main method, provided using the -main-class command line argument, or
b) use *all* methods as entry points, using "-p cg all-reachable:true" as command-line argument, or
c) use custom entry points as described in the article above.

Cheers,
Eric

On 05.02.2014, at 11:37, Moritz Tiedje <moritztiedje at gmail.com> wrote:

> Hello,
> I need a complete callGraph of all the method calls in a library. The problem is, that upon calling soot.Main.main(), a main Method in the library to analyse is searched, found and used to derive a very incomplete call path. Using the following piece of code, I can overwrite this incomplete CallGraph with the complete CallGraph that I need:
> 
>      ArrayList<SootMethod> entryPoints = new ArrayList<SootMethod>();
>      for (SootClass currentClass : Scene.v().getClasses())
>           for (SootMethod method : currentClass.getMethods()) 
>                if(method.hasActiveBody())
>                     entryPoints.add(method);
>      Scene.v().setEntryPoints(entryPoints);
>      CHATransformer.v().transform();
> 
> Here, I set every single method that has an active Body as an entry Point for the call graph and proceed to calculating it. 
> 
> Could you help me find a way calculate the CallGraph only once? So far I have looked for ways to either suppress the calculation of the callGraph in soot.Main.main() or to set custom entry points for it but have been unsuccessful. You can find an abbreviated Version of my code below:
> 
> public static void main(String[] args) 
> {
>      PackManager
>           .v()
>           .getPack("wjtp")
>           .add(new Transform("wjtp.permissionAnalysis",
>                  new SceneTransformer() {
> 
>                       @Override
>                       protected void internalTransform(String arg0, Map arg1)
>                       {
>                            ArrayList<SootMethod> entryPoints = new ArrayList<SootMethod>();
>                            for (SootClass currentClass : Scene.v().getClasses())
>                                 for (SootMethod method : currentClass.getMethods()) 
>                                      if(method.hasActiveBody())
>                                           entryPoints.add(method);
>                            Scene.v().setEntryPoints(entryPoints);
>                            CHATransformer.v().transform();
>                                 
>                            //customAnalysis is an instance of a class that implements CallGraphAnalysis
>                            customAnalysis.performAnalysis(Scene.v().getCallGraph())
>                        }
>                   }));
> 
>      //createDefaultArgs is defined below
>      ArrayList<String> argList = createDefaultArgs(args);
>      
>      soot.Main.main(argList.toArray(new String[0]))
> }
> 
> 
> private static ArrayList<String> createDefaultArgs(String[] args) {
>      ArrayList<String> argList = new ArrayList<String>(Arrays.asList(args));
>      
>      argList.add("-no-bodies-for-excluded");
>      argList.add("-allow-phantom-refs");
>      argList.add("-w");
>         
>      argList.add("-f");
>      argList.add("none");
> 
>      argList.add("-pp");
> 
>      argList.add("-p");
>      argList.add("jb");
>      argList.add("use-original-names:true");
>    
>      argList.add("-p");
>      argList.add("cg.spark");
>      argList.add("enabled:true");
> 
>      argList.add("-p");
>      argList.add("cg.spark");
>      argList.add("pre-jimplify");     argList.add("-cp");
> 
>      //LIBRARY_JAR is a String that contains the path to the library we wish to analyze
>      argList.add(fileToItsPath(LIBRARY_JAR));
>         
>      argList.add("-process-path");
>         
>      argList.add(LIBRARY_JAR);
> 
>      return argList;
> } 
> 
> Thank you for your time, Moritz Tiedje
> _______________________________________________
> Soot-list mailing list
> Soot-list at sable.mcgill.ca
> http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list

--
Prof. Eric Bodden, Ph.D., http://sse.ec-spride.de/ http://bodden.de/
Head of Secure Software Engineering  at Fraunhofer SIT, TU Darmstadt and EC SPRIDE
Tel: +49 6151 16-75422    Fax: +49 6151 16-72051
Room 3.2.14, Mornewegstr. 30, 64293 Darmstadt

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 841 bytes
Desc: Message signed with OpenPGP using GPGMail
Url : http://mailman.cs.mcgill.ca/pipermail/soot-list/attachments/20140206/5c948cba/attachment.bin 


More information about the Soot-list mailing list