-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add driver for building indirection-bounded call graphs
- Loading branch information
Showing
2 changed files
with
38 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
src/main/java/com/ibm/wala/examples/drivers/BoundedJSCallGraphDriver.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package com.ibm.wala.examples.drivers; | ||
|
||
import com.ibm.wala.cast.js.callgraph.fieldbased.FieldBasedCallGraphBuilder; | ||
import com.ibm.wala.cast.js.translator.CAstRhinoTranslatorFactory; | ||
import com.ibm.wala.cast.js.util.CallGraph2JSON; | ||
import com.ibm.wala.cast.js.util.FieldBasedCGUtil; | ||
import com.ibm.wala.ipa.callgraph.CallGraph; | ||
import com.ibm.wala.ipa.callgraph.CallGraphStats; | ||
import com.ibm.wala.util.CancelException; | ||
import com.ibm.wala.util.NullProgressMonitor; | ||
import com.ibm.wala.util.WalaException; | ||
|
||
import java.io.IOException; | ||
import java.net.URL; | ||
import java.nio.file.Path; | ||
import java.nio.file.Paths; | ||
|
||
public class BoundedJSCallGraphDriver { | ||
|
||
/** | ||
* Driver for building indirection-bounded approximate call graphs. | ||
* | ||
* Usage: BoundedJSCallGraphDriver script_directory bound | ||
*/ | ||
public static void main(String[] args) | ||
throws IllegalArgumentException, IOException, CancelException, WalaException { | ||
Path scriptDir = Paths.get(args[0]); | ||
int bound = Integer.parseInt(args[1]); | ||
FieldBasedCGUtil f = new FieldBasedCGUtil(new CAstRhinoTranslatorFactory()); | ||
FieldBasedCallGraphBuilder.CallGraphResult results = | ||
f.buildScriptDirBoundedCG(scriptDir, new NullProgressMonitor(), false, bound); | ||
CallGraph CG = results.getCallGraph(); | ||
System.out.println(CallGraphStats.getStats(CG)); | ||
System.out.println((new CallGraph2JSON()).serialize(CG)); | ||
} | ||
} |