2007-02-02 17:25:09 +00:00
|
|
|
/******************************************************************************
|
|
|
|
* Copyright (c) 2002 - 2006 IBM Corporation.
|
|
|
|
* All rights reserved. This program and the accompanying materials
|
|
|
|
* are made available under the terms of the Eclipse Public License v1.0
|
|
|
|
* which accompanies this distribution, and is available at
|
|
|
|
* http://www.eclipse.org/legal/epl-v10.html
|
|
|
|
*
|
|
|
|
* Contributors:
|
|
|
|
* IBM Corporation - initial API and implementation
|
|
|
|
*****************************************************************************/
|
2007-11-16 20:57:58 +00:00
|
|
|
import com.ibm.wala.cast.js.ipa.callgraph.JSCFABuilder;
|
|
|
|
import com.ibm.wala.cast.js.ipa.callgraph.JSZeroOrOneXCFABuilder;
|
2007-02-02 17:25:09 +00:00
|
|
|
import com.ibm.wala.cast.js.ipa.callgraph.Util;
|
2009-04-09 20:31:14 +00:00
|
|
|
import com.ibm.wala.cast.js.loader.JavaScriptLoader;
|
|
|
|
import com.ibm.wala.cast.js.loader.JavaScriptLoaderFactory;
|
2007-07-20 15:20:23 +00:00
|
|
|
import com.ibm.wala.ipa.callgraph.AnalysisCache;
|
2007-02-02 17:25:09 +00:00
|
|
|
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
|
|
|
|
import com.ibm.wala.ipa.callgraph.AnalysisScope;
|
|
|
|
import com.ibm.wala.ipa.callgraph.CallGraph;
|
2007-05-15 17:44:43 +00:00
|
|
|
import com.ibm.wala.ipa.callgraph.Entrypoint;
|
2007-02-02 17:25:09 +00:00
|
|
|
import com.ibm.wala.ipa.callgraph.propagation.cfa.ZeroXInstanceKeys;
|
2007-06-01 03:32:56 +00:00
|
|
|
import com.ibm.wala.ipa.cha.IClassHierarchy;
|
2007-02-02 17:25:09 +00:00
|
|
|
|
|
|
|
class dumpCallGraph {
|
|
|
|
|
2007-07-06 22:09:08 +00:00
|
|
|
public static void main(String[] args) throws Exception {
|
2007-02-02 17:25:09 +00:00
|
|
|
|
2007-07-06 22:09:08 +00:00
|
|
|
JavaScriptLoaderFactory loaders = Util.makeLoaders();
|
2007-12-10 04:32:54 +00:00
|
|
|
AnalysisScope scope = Util.makeScope(args, loaders, JavaScriptLoader.JS);
|
2007-07-06 22:09:08 +00:00
|
|
|
IClassHierarchy cha = Util.makeHierarchy(scope, loaders);
|
|
|
|
Iterable<Entrypoint> roots = Util.makeScriptRoots(cha);
|
2008-12-16 14:54:09 +00:00
|
|
|
AnalysisOptions options = Util.makeOptions(scope, cha, roots);
|
|
|
|
AnalysisCache cache = Util.makeCache();
|
2007-07-20 15:20:23 +00:00
|
|
|
|
2007-11-06 04:14:03 +00:00
|
|
|
JSCFABuilder builder = new JSZeroOrOneXCFABuilder(cha, options, cache, null, null, null, ZeroXInstanceKeys.ALLOCATIONS, false);
|
2007-02-02 17:25:09 +00:00
|
|
|
|
2007-07-06 22:09:08 +00:00
|
|
|
CallGraph cg = builder.makeCallGraph(options);
|
2007-02-02 17:25:09 +00:00
|
|
|
|
2007-07-06 22:09:08 +00:00
|
|
|
System.err.println(cg);
|
|
|
|
}
|
2007-02-02 17:25:09 +00:00
|
|
|
|
|
|
|
}
|