[Soot-list] list of invoked method from an ASTNode

Bernhard Berger berber at tzi.de
Thu Mar 22 02:06:08 EDT 2012


Hi Gias,

> Given a method body as a single ASTNode (org.eclipse.jdt.core.dom),
> can we use Soot to get a list of all the invoked method(s) inside the
> method?
> 
I think it is possible if you traverse the call graph and collect all
call-edges starting at the corresponding SootMethod. My solution would
look like the following:

> Set<SootMethod> callees = new HashSet<SootMethod>();
> QueueReader<Edge> callIterator = Scene.v().getCallGraph().listener();
> while(callIterator.hasNext()) {
>   Edge call = callIterator.next();
> 
>   if(call.getSrc().method().getSignature().equals("<link name of AST
> Node>")) {
>     callees.add(call.getTgt().method());
>   }
> }

@all: Is there a more efficient way to get all MethodOrMethodContext
for a given method?

Regards

Bernhard

On Do, 2012-03-22 at 01:55 -0400, Gias Uddin wrote:
> Hi,
> 
> 
> Thank you for your helps,
> - Gias 
> _______________________________________________
> Soot-list mailing list
> Soot-list at sable.mcgill.ca
> http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list

-- 
Dipl. Inf. Bernhard Berger

TZI – Universität Bremen, AG Softwaretechnik
E-Mail  berber at tzi.de
Telefon +49 421 218-64472



More information about the Soot-list mailing list