[Soot-list] Call-Graph target edge - Determining target class

Eric Bodden bodden at st.informatik.tu-darmstadt.de
Wed Jul 20 17:58:20 EDT 2011


Hi John.

Yes, this is possible. The easiest way should be like this:

Define a filter over the edges. You can do so by subclassing this class:
http://www.sable.mcgill.ca/soot/doc/soot/jimple/toolkits/callgraph/Filter.html

Then the filter can check if the declaringClass of the target is an
applicationClass:
target.getDeclaringClass().isApplicationClass()

That should be all.

Eric

On 20 July 2011 17:53, John Dee <jdsoot at hotmail.com> wrote:
> Hi all.
> I have a question regarding call graphs. I'm looking to build a call graph
> for a method in my java source code.
> Supposing I have 2 simple classes like so.
>
> package com;
> import com.foo.Bar;
> public class Foo {
>    public void doJaa() {
>       StringBuilder s = new StringBuilder("Silly");
>       s.append(" String");
>       Bar b = new Bar();
>       b.print(s.toString());
>    }
> }
>
> package com.foo;
> public class Bar {
>    public void print(String s) {
>       System.out.println(s);
>    }
> }
> Imagine I want to build a call graph starting with method 'doJaa' in class
> Foo. I can get an edge iterator using the method
> 'edgesOutOf(dooJa);'. My question is this - Is it possible to tell Soot to
> ignore target methods that are part of Binary classes?
> So, in the above example, I'm not interested in including the StringBuilder
> 's.append(" String");' method, nor the StringBuilder 'new
> StringBuilder("Silly");'
> constructor in the call graph, as these are to binary class files included
> on the java class path. Instead, I want to include the 'b.print()' method
> and 'new Bar()' constructor in the call graph.
> In other words, I'm only interested in examining source code methods in the
> call graph. Is this possible?
> Many Thanks
> JD
> _______________________________________________
> Soot-list mailing list
> Soot-list at sable.mcgill.ca
> http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
>
>



-- 
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