[Soot-list] Soot call graph

Eric Bodden eric.bodden at ec-spride.de
Wed Feb 29 09:05:09 EST 2012


Dear Seriai,

would you please email the list instead of mailing me personally? Thanks.

About your error message: You should not provide a main class. After
all, you are supplying other entry points.

Eric

On 29 February 2012 14:56, Abderrahmene Seriai
<seriai.abdelrahmene at gmail.com> wrote:
> Hi again.,
>
> I made a small example where I used setEntryPoints () but it does not work.
> here is the example that I made :
>
> public class CallGraphExample
> {
>     public static void main(String[] args) {
>        List<String> argsList = new ArrayList<String>(Arrays.asList(args));
>        argsList.addAll(Arrays.asList(new String[]{
>                "-w",
>                "-main-class",
>                "testers.CallGraphs",//main-class
>                "testers.CallGraphs",//argument classes
>                "testers.A"            //
>        }));
>
>
>        PackManager.v().getPack("wjtp").add(new Transform("wjtp.myTrans", new
> SceneTransformer() {
>
>         @Override
>         protected void internalTransform(String phaseName, Map options) {
>                CHATransformer.v().transform();
>                        SootClass a = Scene.v().getSootClass("testers.A");
>
>                SootMethod src =
> Scene.v().getMainClass().getMethodByName("doStuff");
>                //----------------------------------------------------------
>
>                 List<SootMethod> ep = new ArrayList<SootMethod>();
>
> ep.add(Scene.v().getSootClass("CallGraphs").getMethodByName("doStuff"));
>                 Scene.v().setEntryPoints(ep);
>                 System.out.println("getEntryPoints : "+ep.get(0).getName());
>
>                 //---------------------------------------------------------
>                CallGraph cg = Scene.v().getCallGraph();
>
>                Iterator<MethodOrMethodContext> targets = new
> Targets(cg.edgesOutOf(src));
>                while (targets.hasNext()) {
>                    SootMethod tgt = (SootMethod)targets.next();
>                    System.out.println(src + " may call " + tgt);
>                }
>         }
>
>        }));
>
>            args = argsList.toArray(new String[0]);
>
>            soot.Main.main(args);
>     }
> }
>
> here are the errors that it gives me :
>
>
> Exception in thread "main" java.lang.RuntimeException: Main-class has no
> main method!
>     at soot.Scene.setMainClass(Scene.java:127)
>     at soot.Scene.setMainClassFromOptions(Scene.java:1191)
>     at soot.Scene.getMainClass(Scene.java:157)
>     at soot.EntryPoints.application(EntryPoints.java:65)
>     at soot.EntryPoints.all(EntryPoints.java:95)
>     at soot.Scene.getEntryPoints(Scene.java:683)
>     at soot.Scene.getReachableMethods(Scene.java:730)
>     at
> soot.jimple.toolkits.callgraph.CallGraphBuilder.<init>(CallGraphBuilder.java:59)
>     at
> soot.jimple.toolkits.callgraph.CHATransformer.internalTransform(CHATransformer.java:42)
>     at soot.SceneTransformer.transform(SceneTransformer.java:39)
>     at soot.Transform.apply(Transform.java:89)
>     at soot.RadioScenePack.internalApply(RadioScenePack.java:57)
>     at
> soot.jimple.toolkits.callgraph.CallGraphPack.internalApply(CallGraphPack.java:47)
>     at soot.Pack.apply(Pack.java:114)
>     at soot.PackManager.runWholeProgramPacks(PackManager.java:408)
>     at soot.PackManager.runPacks(PackManager.java:329)
>     at soot.Main.run(Main.java:198)
>     at soot.Main.main(Main.java:141)
>     at
> dk.brics.soot.callgraphs.CallGraphExample.main(CallGraphExample.java:63)
>
>
> Regards,
> Seriai
>
> 2012/2/29 Eric Bodden <eric.bodden at ec-spride.de>
>>
>> Hi again.
>>
>> The idea is to call Scene.v().setEntryPoints(...) with the list of
>> possible entry points to your program. I am not sure which those would
>> be for OSGi but it should be possible to find out.
>>
>> Cheers,
>> Eric
>>
>> On 29 February 2012 14:05, Abderrahmene Seriai
>> <seriai.abdelrahmene at gmail.com> wrote:
>> > Hi,
>> >
>> > I saw the comments that have been placed on the server, it seems that
>> > nobody
>> > has solved the problem of call graph without main.
>> > I'll be really happy if you can give me an example that shows the
>> > construction of call graph of an application that has not
>> > public static void main(.....).
>> >
>> > regards,
>> > Seriai
>> >
>> >
>> > 2012/2/29 Abderrahmene Seriai <seriai.abdelrahmene at gmail.com>
>> >>
>> >> Thanks for your reply! I will see it.
>> >>
>> >>
>> >>
>> >> Regards,
>> >>
>> >>
>> >> Seriai
>> >>
>> >>
>> >>
>> >> 2012/2/29 Eric Bodden <eric.bodden at ec-spride.de>
>> >>>
>> >>> Hi Seriai.
>> >>>
>> >>> There was recently a thread on this, so please browser the archives.
>> >>> (There seems to be a permission issue with the archives at the moment
>> >>> but I have already notified our admin.)
>> >>>
>> >>> Cheers,
>> >>> Eric
>> >>>
>> >>> On 29 February 2012 10:48, Abderrahmene Seriai
>> >>> <seriai.abdelrahmene at gmail.com> wrote:
>> >>> > Hi everyone,
>> >>> >
>> >>> >
>> >>> >
>> >>> > I would like to use Soot to obtain the  static call graph of an
>> >>> > application
>> >>> > that consists of OSGi bundles.
>> >>> >
>> >>> > Since there is no main class or single entry point, is this possible
>> >>> > to
>> >>> > do?
>> >>> >
>> >>> >
>> >>> >
>> >>> >
>> >>> >
>> >>> > Thanks in advance
>> >>> >
>> >>> >
>> >>> >
>> >>> > Regards,
>> >>> >
>> >>> > Seriai
>> >>> >
>> >>> >
>> >>> > _______________________________________________
>> >>> > Soot-list mailing list
>> >>> > Soot-list at sable.mcgill.ca
>> >>> > http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
>> >>> >
>> >>>
>> >>>
>> >>>
>> >>> --
>> >>> Eric Bodden, Ph.D., http://bodden.de/
>> >>> Head of Secure Software Engineering Group at EC SPRIDE
>> >>> Principal Investigator in Secure Services at CASED
>> >>> Tel: +49 6151 16-75422    Fax: +49 6151 16-72051
>> >>> Room 3.2.14, Mornewegstr. 30, 64293 Darmstadt
>> >>
>> >>
>> >
>>
>>
>>
>> --
>> Eric Bodden, Ph.D., http://bodden.de/
>> Head of Secure Software Engineering Group at EC SPRIDE
>> Principal Investigator in Secure Services at CASED
>> Tel: +49 6151 16-75422    Fax: +49 6151 16-72051
>> Room 3.2.14, Mornewegstr. 30, 64293 Darmstadt
>
>



-- 
Eric Bodden, Ph.D., http://bodden.de/
Head of Secure Software Engineering Group at EC SPRIDE
Principal Investigator in Secure Services at CASED
Tel: +49 6151 16-75422    Fax: +49 6151 16-72051
Room 3.2.14, Mornewegstr. 30, 64293 Darmstadt


More information about the Soot-list mailing list