Comments (6)
Sorry for this mistake.
I have just forgotten the method pascal.taie.analysis.graph.cfg.StmtCFG#getIndex
which will take care of that:
Tai-e/src/main/java/pascal/taie/analysis/graph/cfg/StmtCFG.java
Lines 50 to 59 in 283d1ef
To replace s1.getIndex()
with stmtToCFG.get(s1).getIndex(s1)
(same for s2
).
from tai-e.
Are the CFGs in ICFG built with random orders?
from tai-e.
In Tai-e, ICFG construction uses unordered collections (e.g., java.util.HashSet
), so that traversals are unordered. Our practice tells that the correctness of many algorithms is usually orthogonal to the traversal sequence.
I agree with you that the same traversal sequence can help bug reproduction and debug.
Currently, one workaround to solve your issue is to modify the source code of pascal.taie.analysis.graph.icfg.DefaultICFG
, particularly its methods in which return value is a collection, so that they return ordered collection.
I give you some demos below (updated according to #12 (comment)):
@Override
public Set<ICFGEdge<Stmt>> getInEdgesOf(Stmt stmt) {
- return inEdges.get(stmt);
+ var results = new TreeSet<ICFGEdge<Stmt>>((e1, e2) -> {
+ Stmt s1 = e1.getSource();
+ Stmt s2 = e2.getSource();
+ JMethod m1 = getContainingMethodOf(s1);
+ JMethod m2 = getContainingMethodOf(s2);
+ if (!m1.equals(m2)) {
+ return m1.toString().compareTo(m2.toString());
+ }
+ return Integer.compare(stmtToCFG.get(s1).getIndex(s1), stmtToCFG.get(s2).getIndex(s2));
+ });
+ results.addAll(this.inEdges.get(stmt));
+ return results;
}
@Override
public Set<ICFGEdge<Stmt>> getOutEdgesOf(Stmt stmt) {
- return outEdges.get(stmt);
+ var results = new TreeSet<ICFGEdge<Stmt>>((e1, e2) -> {
+ Stmt s1 = e1.getTarget();
+ Stmt s2 = e2.getTarget();
+ JMethod m1 = getContainingMethodOf(s1);
+ JMethod m2 = getContainingMethodOf(s2);
+ if (!m1.equals(m2)) {
+ return m1.toString().compareTo(m2.toString());
+ }
+ return Integer.compare(stmtToCFG.get(s1).getIndex(s1), stmtToCFG.get(s2).getIndex(s2));
+ });
+ results.addAll(this.outEdges.get(stmt));
+ return results;
}
@Override
public Set<Stmt> getNodes() {
- return Collections.unmodifiableSet(stmtToCFG.keySet());
+ var results = new TreeSet<Stmt>((s1, s2) -> {
+ JMethod m1 = getContainingMethodOf(s1);
+ JMethod m2 = getContainingMethodOf(s2);
+ if (!m1.equals(m2)) {
+ return m1.toString().compareTo(m2.toString());
+ }
+ return Integer.compare(stmtToCFG.get(s1).getIndex(s1), stmtToCFG.get(s2).getIndex(s2));
+ });
+ results.addAll(stmtToCFG.keySet());
+ return results;
}
from tai-e.
That's really helpful. Thank you very much!
from tai-e.
This method will lose some statements. I find out that it is caused by the statement nop
both at the entry and the exit of the CFG, whose index and line number are -1.
from tai-e.
To replace
s1.getIndex()
withstmtToCFG.get(s1).getIndex(s1)
(same fors2
).
It does work, sincerely thanks!
from tai-e.
Related Issues (20)
- Reflection analysis for Method.invoke(Object, Object[]) miss target when the second argument is generated by ArrayList.toArray(T[]) HOT 1
- RuntimeException: couldn't find class HOT 2
- When using methods such as Map.get(), if the return value is an array, the elements in the array will not be tainted. HOT 6
- question about Build IR HOT 1
- Plugin [id: 'org.gradle.kotlin.kotlin-dsl', version: '4.3.0'] was not found in any of the following sources: HOT 6
- question about icfg with ImplicitEntries
- Null pointer exception when running BenchmarkRunner on benchmark `columba-1.4` HOT 5
- Tai-e did not detect any taint flows HOT 6
- Could not resolve java.lang.invoke.StringConcatFactory when test Java9StringConcat HOT 1
- How to correctly taint "%this"? HOT 5
- How to dump call graph, pointer flow graph, and points-to set? HOT 7
- Customize multiple entry methods HOT 5
- Inquiry about Method Caller Extraction in Java Library project Using Tai-e HOT 6
- Is there any way to be able to mock classes via tai-e at runtime. HOT 4
- *.tir contains only the class name, the interior of the class is empty and some confusion about analyzing springweb HOT 4
- tain transfers config problem
- In the `onNewStmt method`, how to get the context? HOT 2
- How to config to result[*] rule for return array type in taint analysis
- How to config to result[*] rule for return array type in taint analysis HOT 9
- Have any suggestion for back taint propagation in param var HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tai-e.