Compare commits
23 Commits
master
...
changes-fo
Author | SHA1 | Date |
---|---|---|
Michael Herzberg | 39b3cad56a | |
Michael Herzberg | 345acb559f | |
Michael Herzberg | 1e78b289e1 | |
Michael Herzberg | bc50020c61 | |
Michael Herzberg | fdb25cb7ed | |
Michael Herzberg | 5c061b7462 | |
Michael Herzberg | 2996a704e3 | |
Michael Herzberg | ab33d777fc | |
Michael Herzberg | 69a671680d | |
Michael Herzberg | 6a8bcdacfb | |
Michael Herzberg | 8f247b7fa6 | |
Michael Herzberg | d1010ff939 | |
Michael Herzberg | b620ae4c1d | |
Michael Herzberg | 50dbbba070 | |
Michael Herzberg | 6961dd9a08 | |
Michael Herzberg | 842ce920e7 | |
Michael Herzberg | 2e592889c8 | |
Michael Herzberg | 6d20fc80cd | |
Michael Herzberg | 4767929b66 | |
Michael Herzberg | 42e5ec14e6 | |
Michael Herzberg | dbe76a5145 | |
Michael Herzberg | 2cec69074c | |
Michael Herzberg | 3db294742e |
|
@ -6,6 +6,7 @@
|
||||||
*/bin/*
|
*/bin/*
|
||||||
*~
|
*~
|
||||||
.metadata/
|
.metadata/
|
||||||
|
com.ibm.wala.cast/lib/
|
||||||
com.ibm.wala.cast.java.jdt.test/
|
com.ibm.wala.cast.java.jdt.test/
|
||||||
com.ibm.wala.cast.java.polyglot/lib/
|
com.ibm.wala.cast.java.polyglot/lib/
|
||||||
com.ibm.wala.cast.java.test.data/src/JLex/
|
com.ibm.wala.cast.java.test.data/src/JLex/
|
||||||
|
@ -22,10 +23,12 @@ com.ibm.wala.cast.js.rhino.test/xxxx
|
||||||
com.ibm.wala.cast.js.rhino/lib/
|
com.ibm.wala.cast.js.rhino/lib/
|
||||||
com.ibm.wala.cast.js.test.data/examples-src/ajaxslt/
|
com.ibm.wala.cast.js.test.data/examples-src/ajaxslt/
|
||||||
com.ibm.wala.cast.js.test/examples-src/ajaxslt/
|
com.ibm.wala.cast.js.test/examples-src/ajaxslt/
|
||||||
|
com.ibm.wala.cast.js.test/test.jar
|
||||||
com.ibm.wala.cast.js/lib/
|
com.ibm.wala.cast.js/lib/
|
||||||
com.ibm.wala.core.testdata/*.jar
|
com.ibm.wala.core.testdata/*.jar
|
||||||
com.ibm.wala.core.testdata/@dot/
|
com.ibm.wala.core.testdata/@dot/
|
||||||
com.ibm.wala.core.testdata/lib/
|
com.ibm.wala.core.testdata/lib/
|
||||||
|
com.ibm.wala.core.testdata/ocaml
|
||||||
com.ibm.wala.core.tests/dat/wala.examples.properties
|
com.ibm.wala.core.tests/dat/wala.examples.properties
|
||||||
com.ibm.wala.core.tests/report
|
com.ibm.wala.core.tests/report
|
||||||
com.ibm.wala.core/@dot
|
com.ibm.wala.core/@dot
|
||||||
|
@ -35,3 +38,5 @@ com.ibm.wala.dalvik/src/logback.xml
|
||||||
com.ibm.wala.ide.jdt.test/testdata/
|
com.ibm.wala.ide.jdt.test/testdata/
|
||||||
edu.kit.wala.smali.test/out/
|
edu.kit.wala.smali.test/out/
|
||||||
target/
|
target/
|
||||||
|
.classpath
|
||||||
|
.project
|
|
@ -1,17 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<projectDescription>
|
|
||||||
<name>com.ibm.wala-feature</name>
|
|
||||||
<comment></comment>
|
|
||||||
<projects>
|
|
||||||
</projects>
|
|
||||||
<buildSpec>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.pde.FeatureBuilder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
</buildSpec>
|
|
||||||
<natures>
|
|
||||||
<nature>org.eclipse.pde.FeatureNature</nature>
|
|
||||||
</natures>
|
|
||||||
</projectDescription>
|
|
|
@ -10,6 +10,13 @@
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>com.ibm.wala.cast.js.rhino</artifactId>
|
<artifactId>com.ibm.wala.cast.js.rhino</artifactId>
|
||||||
<packaging>eclipse-plugin</packaging>
|
<packaging>eclipse-plugin</packaging>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.mozilla</groupId>
|
||||||
|
<artifactId>rhino</artifactId>
|
||||||
|
<version>1.7R3</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
|
source.. = harness-src/
|
||||||
|
output.. = bin/
|
||||||
source.test.jar = harness-src/
|
source.test.jar = harness-src/
|
||||||
output.test.jar = bin/
|
output.test.jar = bin/
|
||||||
bin.includes = test.jar,\
|
bin.includes = .,\
|
||||||
|
test.jar,\
|
||||||
META-INF/
|
META-INF/
|
||||||
|
|
|
@ -91,7 +91,7 @@ public class FieldBasedCGUtil {
|
||||||
return buildCG(loaders, scripts, builderType, monitor, supportFullPointerAnalysis);
|
return buildCG(loaders, scripts, builderType, monitor, supportFullPointerAnalysis);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Pair<JSCallGraph, PointerAnalysis<ObjectVertex>> buildCG(JavaScriptLoaderFactory loaders, SourceModule[] scripts, BuilderType builderType, IProgressMonitor monitor, boolean supportFullPointerAnalysis) throws IOException, WalaException, CancelException {
|
public static Pair<JSCallGraph, PointerAnalysis<ObjectVertex>> buildCG(JavaScriptLoaderFactory loaders, SourceModule[] scripts, BuilderType builderType, IProgressMonitor monitor, boolean supportFullPointerAnalysis) throws IOException, WalaException, CancelException {
|
||||||
CAstAnalysisScope scope = new CAstAnalysisScope(scripts, loaders, Collections.singleton(JavaScriptLoader.JS));
|
CAstAnalysisScope scope = new CAstAnalysisScope(scripts, loaders, Collections.singleton(JavaScriptLoader.JS));
|
||||||
IClassHierarchy cha = ClassHierarchy.make(scope, loaders, JavaScriptLoader.JS);
|
IClassHierarchy cha = ClassHierarchy.make(scope, loaders, JavaScriptLoader.JS);
|
||||||
Util.checkForFrontEndErrors(cha);
|
Util.checkForFrontEndErrors(cha);
|
||||||
|
|
|
@ -133,12 +133,12 @@ DOMNode = function DOMNode() { // An impostor for the Node class
|
||||||
|
|
||||||
this.selectNodes = function(a) {
|
this.selectNodes = function(a) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.addEventListener = function Node_prototype_addEventListener(name, fn) { fn(); };
|
||||||
|
|
||||||
|
this.removeEventListener = function Node_prototype_removeEventListener(name) {};
|
||||||
};
|
};
|
||||||
|
|
||||||
DOMNode.prototype.addEventListener = function Node_prototype_addEventListener(name, fn) { fn(); };
|
|
||||||
|
|
||||||
DOMNode.prototype.removeEventListener = function Node_prototype_removeEventListener(name) {};
|
|
||||||
|
|
||||||
DOMNode.prototype.cloneNode = function Node_prototype_cloneNode() {
|
DOMNode.prototype.cloneNode = function Node_prototype_cloneNode() {
|
||||||
// TODO: model me
|
// TODO: model me
|
||||||
};
|
};
|
||||||
|
|
|
@ -11,6 +11,13 @@
|
||||||
<groupId>com.ibm.wala</groupId>
|
<groupId>com.ibm.wala</groupId>
|
||||||
<artifactId>com.ibm.wala.cast.js</artifactId>
|
<artifactId>com.ibm.wala.cast.js</artifactId>
|
||||||
<packaging>eclipse-plugin</packaging>
|
<packaging>eclipse-plugin</packaging>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.htmlparser.jericho</groupId>
|
||||||
|
<artifactId>jericho-html</artifactId>
|
||||||
|
<version>3.2</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
|
|
|
@ -75,7 +75,7 @@ public abstract class FieldBasedCallGraphBuilder {
|
||||||
protected final MethodTargetSelector targetSelector;
|
protected final MethodTargetSelector targetSelector;
|
||||||
protected final boolean supportFullPointerAnalysis;
|
protected final boolean supportFullPointerAnalysis;
|
||||||
|
|
||||||
private static final boolean LOG_TIMINGS = true;
|
private static final boolean LOG_TIMINGS = false;
|
||||||
|
|
||||||
public FieldBasedCallGraphBuilder(IClassHierarchy cha, AnalysisOptions options, AnalysisCache cache, boolean supportFullPointerAnalysis) {
|
public FieldBasedCallGraphBuilder(IClassHierarchy cha, AnalysisOptions options, AnalysisCache cache, boolean supportFullPointerAnalysis) {
|
||||||
this.cha = cha;
|
this.cha = cha;
|
||||||
|
@ -218,7 +218,7 @@ public abstract class FieldBasedCallGraphBuilder {
|
||||||
// need to create nodes for reflective targets of call, and then add them
|
// need to create nodes for reflective targets of call, and then add them
|
||||||
// as callees of the synthetic method
|
// as callees of the synthetic method
|
||||||
OrdinalSet<FuncVertex> reflectiveTargets = getReflectiveTargets(flowgraph, callVertex, monitor);
|
OrdinalSet<FuncVertex> reflectiveTargets = getReflectiveTargets(flowgraph, callVertex, monitor);
|
||||||
System.err.println("adding callees " + reflectiveTargets + " for " + caller);
|
// System.err.println("adding callees " + reflectiveTargets + " for " + caller);
|
||||||
// there should only be one call site in the synthetic method
|
// there should only be one call site in the synthetic method
|
||||||
CallSiteReference reflectiveCallSite = functionPrototypeCallNode.getIR().iterateCallSites().next();
|
CallSiteReference reflectiveCallSite = functionPrototypeCallNode.getIR().iterateCallSites().next();
|
||||||
for (FuncVertex f : reflectiveTargets) {
|
for (FuncVertex f : reflectiveTargets) {
|
||||||
|
|
|
@ -126,7 +126,7 @@ public class OptimisticCallgraphBuilder extends FieldBasedCallGraphBuilder {
|
||||||
|
|
||||||
VarVertex receiverVertex = factory.makeVarVertex(caller, invk.getUse(1));
|
VarVertex receiverVertex = factory.makeVarVertex(caller, invk.getUse(1));
|
||||||
OrdinalSet<FuncVertex> realCallees = flowgraph.getReachingSet(receiverVertex, monitor);
|
OrdinalSet<FuncVertex> realCallees = flowgraph.getReachingSet(receiverVertex, monitor);
|
||||||
System.err.println("callees " + realCallees + " for " + caller);
|
// System.err.println("callees " + realCallees + " for " + caller);
|
||||||
for(FuncVertex realCallee: realCallees) {
|
for(FuncVertex realCallee: realCallees) {
|
||||||
// flow from arguments to parameters
|
// flow from arguments to parameters
|
||||||
for(int i=2;i<invk.getNumberOfParameters();++i)
|
for(int i=2;i<invk.getNumberOfParameters();++i)
|
||||||
|
|
|
@ -218,7 +218,7 @@ public class FlowGraph implements Iterable<Vertex> {
|
||||||
if (! dataflow.containsNode(prototype)) {
|
if (! dataflow.containsNode(prototype)) {
|
||||||
dataflow.addNode(prototype);
|
dataflow.addNode(prototype);
|
||||||
}
|
}
|
||||||
System.err.println("adding " + p + " --> " + prototype);
|
// System.err.println("adding " + p + " --> " + prototype);
|
||||||
dataflow.addEdge(p, prototype);
|
dataflow.addEdge(p, prototype);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,7 +87,9 @@ public class DomLessSourceExtractor extends JSSourceExtractor {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleEndTag(ITag tag) {
|
public void handleEndTag(ITag tag) {
|
||||||
if (tag.getName().equalsIgnoreCase("script")) {
|
if (tag.getName().equalsIgnoreCase("script")
|
||||||
|
&& (tag.getAttributeByName("type") == null
|
||||||
|
|| tag.getAttributeByName("type").fst.equals("text/javascript"))) {
|
||||||
assert currentScriptTag != null;
|
assert currentScriptTag != null;
|
||||||
currentScriptTag = null;
|
currentScriptTag = null;
|
||||||
} else if (currentScriptTag != null && tag.getName().equals("!--")) {
|
} else if (currentScriptTag != null && tag.getName().equals("!--")) {
|
||||||
|
@ -118,7 +120,9 @@ public class DomLessSourceExtractor extends JSSourceExtractor {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleStartTag(ITag tag) {
|
public void handleStartTag(ITag tag) {
|
||||||
if (tag.getName().equalsIgnoreCase("script")) {
|
if (tag.getName().equalsIgnoreCase("script")
|
||||||
|
&& (tag.getAttributeByName("type") == null
|
||||||
|
|| tag.getAttributeByName("type").fst.equals("text/javascript"))) {
|
||||||
handleScript(tag);
|
handleScript(tag);
|
||||||
assert currentScriptTag == null;
|
assert currentScriptTag == null;
|
||||||
currentScriptTag = tag;
|
currentScriptTag = tag;
|
||||||
|
@ -189,7 +193,7 @@ public class DomLessSourceExtractor extends JSSourceExtractor {
|
||||||
if (value.indexOf('"') < 0) {
|
if (value.indexOf('"') < 0) {
|
||||||
quote= '"';
|
quote= '"';
|
||||||
} else if (value.indexOf("'") < 0) {
|
} else if (value.indexOf("'") < 0) {
|
||||||
quote= '"';
|
quote= '\'';
|
||||||
} else {
|
} else {
|
||||||
quote= '"';
|
quote= '"';
|
||||||
value = value.replaceAll("\"", "\\\"");
|
value = value.replaceAll("\"", "\\\"");
|
||||||
|
@ -234,7 +238,7 @@ public class DomLessSourceExtractor extends JSSourceExtractor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void getScriptFromUrl(String urlAsString, ITag scriptTag) throws IOException, MalformedURLException {
|
protected void getScriptFromUrl(String urlAsString, ITag scriptTag) throws IOException, MalformedURLException {
|
||||||
URL scriptSrc = new URL(entrypointUrl, urlAsString);
|
URL scriptSrc = new URL(entrypointUrl, urlAsString);
|
||||||
Reader scriptInputStream;
|
Reader scriptInputStream;
|
||||||
try {
|
try {
|
||||||
|
@ -243,7 +247,7 @@ public class DomLessSourceExtractor extends JSSourceExtractor {
|
||||||
ByteOrderMark.UTF_16LE, ByteOrderMark.UTF_16BE,
|
ByteOrderMark.UTF_16LE, ByteOrderMark.UTF_16BE,
|
||||||
ByteOrderMark.UTF_32LE, ByteOrderMark.UTF_32BE);
|
ByteOrderMark.UTF_32LE, ByteOrderMark.UTF_32BE);
|
||||||
if (bs.hasBOM()) {
|
if (bs.hasBOM()) {
|
||||||
System.err.println("removing BOM " + bs.getBOM());
|
// System.err.println("removing BOM " + bs.getBOM());
|
||||||
}
|
}
|
||||||
scriptInputStream = new InputStreamReader(bs);
|
scriptInputStream = new InputStreamReader(bs);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
|
@ -57,14 +57,14 @@ public class JerichoTag implements ITag {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getFirstCol() {
|
public int getFirstCol() {
|
||||||
return -1;
|
// return -1;
|
||||||
// return e.getSource().getRowColumnVector(e.getBegin()).getColumn();
|
return e.getSource().getRowColumnVector(e.getBegin()).getColumn();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getLastCol() {
|
public int getLastCol() {
|
||||||
return -1;
|
// return -1;
|
||||||
//return e.getSource().getRowColumnVector(e.getEnd()).getColumn();
|
return e.getSource().getRowColumnVector(e.getEnd()).getColumn();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -34,6 +34,7 @@ import com.ibm.wala.types.MethodReference;
|
||||||
import com.ibm.wala.types.TypeName;
|
import com.ibm.wala.types.TypeName;
|
||||||
import com.ibm.wala.types.TypeReference;
|
import com.ibm.wala.types.TypeReference;
|
||||||
import com.ibm.wala.util.collections.HashSetFactory;
|
import com.ibm.wala.util.collections.HashSetFactory;
|
||||||
|
import com.ibm.wala.util.debug.UnimplementedError;
|
||||||
import com.ibm.wala.util.intset.OrdinalSet;
|
import com.ibm.wala.util.intset.OrdinalSet;
|
||||||
|
|
||||||
public class LoadFileTargetSelector implements MethodTargetSelector {
|
public class LoadFileTargetSelector implements MethodTargetSelector {
|
||||||
|
@ -55,7 +56,13 @@ public class LoadFileTargetSelector implements MethodTargetSelector {
|
||||||
|
|
||||||
Set<String> names = new HashSet<String>();
|
Set<String> names = new HashSet<String>();
|
||||||
SSAInstruction call = caller.getIR().getInstructions()[caller.getIR().getCallInstructionIndices(site).intIterator().next()];
|
SSAInstruction call = caller.getIR().getInstructions()[caller.getIR().getCallInstructionIndices(site).intIterator().next()];
|
||||||
LocalPointerKey fileNameV = new LocalPointerKey(caller, call.getUse(1));
|
LocalPointerKey fileNameV = null;
|
||||||
|
try {
|
||||||
|
fileNameV = new LocalPointerKey(caller, call.getUse(1));
|
||||||
|
} catch (UnsupportedOperationException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return target;
|
||||||
|
}
|
||||||
OrdinalSet<InstanceKey> ptrs = builder.getPointerAnalysis().getPointsToSet(fileNameV);
|
OrdinalSet<InstanceKey> ptrs = builder.getPointerAnalysis().getPointsToSet(fileNameV);
|
||||||
for(InstanceKey k : ptrs) {
|
for(InstanceKey k : ptrs) {
|
||||||
if (k instanceof ConstantKey) {
|
if (k instanceof ConstantKey) {
|
||||||
|
|
|
@ -15,16 +15,22 @@ import java.io.InputStreamReader;
|
||||||
import java.io.Reader;
|
import java.io.Reader;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
|
||||||
|
import org.apache.commons.io.IOUtils;
|
||||||
|
|
||||||
import com.ibm.wala.cast.tree.CAstSourcePositionMap.Position;
|
import com.ibm.wala.cast.tree.CAstSourcePositionMap.Position;
|
||||||
import com.ibm.wala.cast.tree.impl.AbstractSourcePosition;
|
import com.ibm.wala.cast.tree.impl.AbstractSourcePosition;
|
||||||
|
|
||||||
public class RangePosition extends AbstractSourcePosition implements Position {
|
public class RangePosition extends AbstractSourcePosition implements Position {
|
||||||
|
private final static int NUMBER_OF_CHARS_IN_TAB = 4;
|
||||||
private final URL url;
|
private final URL url;
|
||||||
private final int line;
|
private final int line;
|
||||||
private final int startOffset;
|
private final int startOffset;
|
||||||
private final int endOffset;
|
private final int endOffset;
|
||||||
|
|
||||||
|
private int col = -1;
|
||||||
|
private int lastLine = -1;
|
||||||
|
private int lastCol = -1;
|
||||||
|
|
||||||
public RangePosition(URL url, int line, int startOffset, int endOffset) {
|
public RangePosition(URL url, int line, int startOffset, int endOffset) {
|
||||||
super();
|
super();
|
||||||
this.url = url;
|
this.url = url;
|
||||||
|
@ -50,17 +56,85 @@ public class RangePosition extends AbstractSourcePosition implements Position {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getLastLine() {
|
public int getLastLine() {
|
||||||
return -1;
|
if (lastLine == -1) {
|
||||||
|
String content;
|
||||||
|
Reader reader = null;
|
||||||
|
try {
|
||||||
|
reader = getReader();
|
||||||
|
content = IOUtils.toString(reader).substring(startOffset, endOffset);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return -1;
|
||||||
|
} finally {
|
||||||
|
if (reader != null) {
|
||||||
|
try {
|
||||||
|
reader.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int nrOfNewlines = content.length() - content.replace("\n", "").length();
|
||||||
|
|
||||||
|
lastLine = line + nrOfNewlines;
|
||||||
|
}
|
||||||
|
|
||||||
|
return lastLine;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getFirstCol() {
|
public int getFirstCol() {
|
||||||
return -1;
|
if (col == -1) {
|
||||||
|
col = getCol(getFirstLine(), startOffset);
|
||||||
|
}
|
||||||
|
|
||||||
|
return col;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getLastCol() {
|
public int getLastCol() {
|
||||||
return -1;
|
if (lastCol == -1) {
|
||||||
|
lastCol = getCol(getLastLine(), endOffset);
|
||||||
|
}
|
||||||
|
|
||||||
|
return lastCol;
|
||||||
|
}
|
||||||
|
|
||||||
|
private int getCol(int line, int offset) {
|
||||||
|
int col = -1;
|
||||||
|
Reader reader = null;
|
||||||
|
try {
|
||||||
|
reader = getReader();
|
||||||
|
col = getCol(IOUtils.toString(reader), line, offset);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} finally {
|
||||||
|
IOUtils.closeQuietly(reader);
|
||||||
|
}
|
||||||
|
|
||||||
|
return col;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int getCol(String content, int line, int offset) {
|
||||||
|
if (line == 1) {
|
||||||
|
return offset + 1;
|
||||||
|
}
|
||||||
|
int pos = -1;
|
||||||
|
for (int i = 0; i < line - 1; i++) {
|
||||||
|
pos = content.indexOf('\n', pos + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
String lineBeginning = content.substring(pos, offset);
|
||||||
|
int nrOfTabs = lineBeginning.length() - lineBeginning.replace("\t", "").length();
|
||||||
|
|
||||||
|
return offset - pos + (NUMBER_OF_CHARS_IN_TAB - 1) * nrOfTabs;
|
||||||
|
} catch (StringIndexOutOfBoundsException e) {
|
||||||
|
System.err.println("Could not determine column!");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -68,7 +68,7 @@ public class CAstCallGraphUtil {
|
||||||
ByteOrderMark.UTF_32LE, ByteOrderMark.UTF_32BE);
|
ByteOrderMark.UTF_32LE, ByteOrderMark.UTF_32BE);
|
||||||
try {
|
try {
|
||||||
if (bs.hasBOM()) {
|
if (bs.hasBOM()) {
|
||||||
System.err.println("removing BOM " + bs.getBOM());
|
// System.err.println("removing BOM " + bs.getBOM());
|
||||||
}
|
}
|
||||||
return bs;
|
return bs;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
source.. = source/,\
|
source.. = source/,\
|
||||||
data/
|
data/
|
||||||
output.. = bin/
|
output.. = bin/
|
||||||
bin.includes = META-INF/,\
|
bin.includes = .,\
|
||||||
|
META-INF/,\
|
||||||
lib/dx.jar
|
lib/dx.jar
|
||||||
jars.extra.classpath = lib/dx.jar
|
jars.extra.classpath = lib/dx.jar
|
||||||
jre.compilation.profile = JavaSE-1.7
|
jre.compilation.profile = JavaSE-1.7
|
||||||
|
|
|
@ -35,6 +35,8 @@
|
||||||
<property name="bundleJavacTarget" value="${javacTarget}"/>
|
<property name="bundleJavacTarget" value="${javacTarget}"/>
|
||||||
<property name="bundleBootClasspath" value="${bootclasspath}"/>
|
<property name="bundleBootClasspath" value="${bootclasspath}"/>
|
||||||
|
|
||||||
|
<property environment="env"/>
|
||||||
|
|
||||||
<target name="sampleLexPresent" depends="init">
|
<target name="sampleLexPresent" depends="init">
|
||||||
<available file="${plugin.destination}/data/sample.lex" property="sample.lex.present"/>
|
<available file="${plugin.destination}/data/sample.lex" property="sample.lex.present"/>
|
||||||
</target>
|
</target>
|
||||||
|
@ -42,14 +44,6 @@
|
||||||
<target name="fetchSampleLex" depends="sampleLexPresent" unless="sample.lex.present">
|
<target name="fetchSampleLex" depends="sampleLexPresent" unless="sample.lex.present">
|
||||||
<get src="https://www.cs.princeton.edu/~appel/modern/java/JLex/current/sample.lex" dest="${plugin.destination}/data/sample.lex" />
|
<get src="https://www.cs.princeton.edu/~appel/modern/java/JLex/current/sample.lex" dest="${plugin.destination}/data/sample.lex" />
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="fetchSampleCup" depends="sampleCupPresent" unless="sample.cup.present">
|
|
||||||
<get src="http://casper.cii.saxion.nl:8083/~vanleeuw/pse/spanje/troff2html.cup" dest="${plugin.destination}/data/troff2html.cup" />
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="sampleCupPresent" depends="init">
|
|
||||||
<available file="${plugin.destination}/data/troff2html.cup" property="sample.cup.present"/>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="fetchAndroidJar" depends="androidJarPresent" unless="android.jar.present">
|
<target name="fetchAndroidJar" depends="androidJarPresent" unless="android.jar.present">
|
||||||
<get src="http://central.maven.org/maven2/com/google/android/android/4.1.1.4/android-4.1.1.4.jar" dest="${plugin.destination}/data/android.jar" />
|
<get src="http://central.maven.org/maven2/com/google/android/android/4.1.1.4/android-4.1.1.4.jar" dest="${plugin.destination}/data/android.jar" />
|
||||||
|
@ -59,7 +53,15 @@
|
||||||
<available file="${plugin.destination}/data/android.jar" property="android.jar.present"/>
|
<available file="${plugin.destination}/data/android.jar" property="android.jar.present"/>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="getJars" depends="fetchSampleLex,fetchSampleCup,fetchAndroidJar" />
|
<target name="copyDxJar" depends="dxJarPresent" unless="dx.jar.present">
|
||||||
|
<copy file="${env.ANDROID_HOME}/build-tools/20.0.0/lib/dx.jar" tofile="${basedir}/lib/dx.jar" />
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="dxJarPresent" depends="init">
|
||||||
|
<available file="${basedir}/lib/dx.jar" property="dx.jar.present"/>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="getJars" depends="fetchSampleLex,fetchAndroidJar,copyDxJar" />
|
||||||
|
|
||||||
<target name="init" depends="properties">
|
<target name="init" depends="properties">
|
||||||
<condition property="pluginTemp" value="${buildTempFolder}/plugins">
|
<condition property="pluginTemp" value="${buildTempFolder}/plugins">
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
source.. = src/
|
||||||
|
output.. = bin/
|
||||||
source.dalvik.jar = src/
|
source.dalvik.jar = src/
|
||||||
bin.includes = META-INF/,\
|
bin.includes = META-INF/,\
|
||||||
.,\
|
.,\
|
||||||
|
@ -8,4 +10,4 @@ bin.includes = META-INF/,\
|
||||||
lib/logback-classic-1.0.9.jar,\
|
lib/logback-classic-1.0.9.jar,\
|
||||||
lib/logback-core-1.0.9.jar,\
|
lib/logback-core-1.0.9.jar,\
|
||||||
lib/slf4j-api-1.7.2.jar,\
|
lib/slf4j-api-1.7.2.jar,\
|
||||||
dalvik.jar
|
dalvik.jar
|
||||||
|
|
|
@ -11,6 +11,19 @@
|
||||||
<artifactId>com.ibm.wala.dalvik</artifactId>
|
<artifactId>com.ibm.wala.dalvik</artifactId>
|
||||||
<packaging>eclipse-plugin</packaging>
|
<packaging>eclipse-plugin</packaging>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>dexlib</groupId>
|
||||||
|
<artifactId>dexlib</artifactId>
|
||||||
|
<version>1.3.4</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.guava</groupId>
|
||||||
|
<artifactId>guava</artifactId>
|
||||||
|
<version>13.0.1</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
|
|
|
@ -61,6 +61,7 @@ import static org.jf.dexlib.Util.AccessFlags.VOLATILE;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
@ -180,9 +181,11 @@ public class DexIMethod implements IBytecodeMethod {
|
||||||
private TypeReference typeReference;
|
private TypeReference typeReference;
|
||||||
|
|
||||||
private ExceptionHandler[][] handlers;
|
private ExceptionHandler[][] handlers;
|
||||||
|
|
||||||
protected InstructionArray instructions;
|
protected InstructionArray instructions;
|
||||||
|
|
||||||
|
private Map<Integer, Integer> lineNumbers = new HashMap<Integer, Integer>();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private static int totalInsts = 0;
|
private static int totalInsts = 0;
|
||||||
|
@ -537,7 +540,12 @@ public class DexIMethod implements IBytecodeMethod {
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getLineNumber(int bcIndex) {
|
public int getLineNumber(int bcIndex) {
|
||||||
return getInstructionIndex(bcIndex);
|
// return getInstructionIndex(bcIndex);
|
||||||
|
return lineNumbers.getOrDefault(bcIndex, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLineNumber(int bcIndex, int lineNumber) {
|
||||||
|
lineNumbers.put(bcIndex, lineNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -766,7 +766,7 @@ public class DexSSABuilder extends AbstractIntRegisterMachine {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void visitGoto(Goto instruction) {
|
public void visitGoto(Goto instruction) {
|
||||||
emitInstruction(insts.GotoInstruction(getCurrentInstructionIndex(), -1));
|
emitInstruction(insts.GotoInstruction(getCurrentInstructionIndex(), method.getInstructionIndex(instruction.pc + instruction.destination)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<projectDescription>
|
|
||||||
<name>com.ibm.wala.ide-feature</name>
|
|
||||||
<comment></comment>
|
|
||||||
<projects>
|
|
||||||
</projects>
|
|
||||||
<buildSpec>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.pde.FeatureBuilder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
</buildSpec>
|
|
||||||
<natures>
|
|
||||||
<nature>org.eclipse.pde.FeatureNature</nature>
|
|
||||||
</natures>
|
|
||||||
</projectDescription>
|
|
|
@ -1,8 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<classpath>
|
|
||||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
|
||||||
<classpathentry kind="src" path="source"/>
|
|
||||||
<classpathentry kind="src" path="data"/>
|
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
|
|
||||||
<classpathentry kind="output" path="bin"/>
|
|
||||||
</classpath>
|
|
|
@ -1,28 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<projectDescription>
|
|
||||||
<name>com.ibm.wala.ide.jdt.test</name>
|
|
||||||
<comment></comment>
|
|
||||||
<projects>
|
|
||||||
</projects>
|
|
||||||
<buildSpec>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.pde.ManifestBuilder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.pde.SchemaBuilder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
</buildSpec>
|
|
||||||
<natures>
|
|
||||||
<nature>org.eclipse.pde.PluginNature</nature>
|
|
||||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
|
||||||
</natures>
|
|
||||||
</projectDescription>
|
|
|
@ -452,4 +452,10 @@ public class FakeExceptionTypeBinding implements ITypeBinding {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// I guess the comments above apply here as well...
|
||||||
|
public IBinding getDeclaringMember() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<classpath>
|
|
||||||
<classpathentry kind="src" path="src"/>
|
|
||||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
|
|
||||||
<classpathentry kind="output" path="bin"/>
|
|
||||||
</classpath>
|
|
|
@ -1,28 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<projectDescription>
|
|
||||||
<name>com.ibm.wala.ide.jsdt.tests</name>
|
|
||||||
<comment></comment>
|
|
||||||
<projects>
|
|
||||||
</projects>
|
|
||||||
<buildSpec>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.pde.ManifestBuilder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.pde.SchemaBuilder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
</buildSpec>
|
|
||||||
<natures>
|
|
||||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
|
||||||
<nature>org.eclipse.pde.PluginNature</nature>
|
|
||||||
</natures>
|
|
||||||
</projectDescription>
|
|
Loading…
Reference in New Issue