-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix SVFA implementation #20
Open
galilasmb
wants to merge
46
commits into
rbonifacio:develop
Choose a base branch
from
galilasmb:testing_fields_svfa
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
46 commits
Select commit
Hold shift + click to select a range
221893d
fix: add value line in to string
ae2b31a
Merge branch 'rbonifacio:develop' into develop
galilasmb 42608f1
fix: add config to ignore resolution errors from soot
328bd75
Merge branch 'rbonifacio:develop' into develop
galilasmb 8886ead
feat: print depth methods visited and number of methods
c8834fb
fix: add edge to fields
2878d85
fix: adjusting algorithm
a26b50b
fix: adjusting field algoritms
b2c1bc1
fix: adjusting to casting
0558e55
fix: adjusting build.sbt
0858a27
refactoring: removing entryPointMethod
a87af2d
fix: adjusting algorithm
b978fa0
fix: adjusting pattern match
10aa6d2
fix: adjuting report number of conflicts
3795e47
refact: removing unused variables
7dd5569
refact: add field number line
8289f69
tests: adjusting tests
fe0f476
fix: add fields in allocationSites
2b13647
fix: adjusting load and store algorithm
56cb7a5
fix: adjusting algoritm
b1ad049
tests: new tests
b087045
fix: removing used code
102df9b
fix: removing used code
df5a213
fix: removing used code
00a38e4
tests: add more tests
d7d2e82
feat: add flag enableAllocationSiteDF
f4ec53b
fix: create assignStatements field
cf3bf95
refact: renaming variable
2307d67
refact: removing unsed methods
713419a
error: adjusting
a435da2
fix: adjusting tests and fixing algoritm
77296f7
tests: add more tests with integer
759eab6
fix: adjusting depth limit to 10
97fc372
fix: adjusting and refactoring
ec5f787
refact: renaming variable
392a128
feat: add call to InstanceInvokeExpr with an AssignStmt
847c738
fix: adjusting total visited methods
ec0fcb7
fix: updating allocation site before
b0a15af
adding visited methods in the node graph
d82467a
udpating svfa
c8362c3
adjusting path visited method
a32a1d2
add use field algorithm
e0a67f3
fix: adjusting patern matching
583c1ca
feat: add support for java 9 or higher
barbosamaatheus 77756a9
feat: add support for java 9 or higher
barbosamaatheus 915798a
Merge pull request #1 from barbosamaatheus/testing_fields_svfa
galilasmb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,4 +16,5 @@ project/plugins/project/ | |
# Scala-IDE specific | ||
.scala_dependencies | ||
.worksheet | ||
.idea | ||
.idea | ||
.gradle/ |
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
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 |
---|---|---|
|
@@ -4,6 +4,7 @@ import scalax.collection.edge.LkDiEdge | |
import soot.SootMethod | ||
|
||
import scala.collection.immutable.HashSet | ||
import scala.collection.mutable.ListBuffer | ||
|
||
/* | ||
* This trait define the base type for node classifications. | ||
|
@@ -27,6 +28,16 @@ trait GraphNode { | |
def unit(): soot.Unit | ||
def method(): soot.SootMethod | ||
def show(): String | ||
def line(): Int | ||
def pathVisitedMethods: ListBuffer[VisitedMethods] | ||
def pathVisitedMethodsToString(): String = { | ||
var methodsString = "" | ||
|
||
if (pathVisitedMethods != null){ | ||
methodsString = pathVisitedMethods.map(_. toString).mkString(" => ") | ||
} | ||
s"path: $methodsString" | ||
} | ||
} | ||
|
||
trait LambdaNode extends scala.AnyRef { | ||
|
@@ -44,24 +55,39 @@ trait LambdaNode extends scala.AnyRef { | |
*/ | ||
case class Statement(className: String, method: String, stmt: String, line: Int, sootUnit: soot.Unit = null, sootMethod: soot.SootMethod = null) | ||
|
||
case class VisitedMethods(sootMethod: soot.SootMethod = null, sootUnit: soot.Unit = null, line: Int) { | ||
override def toString: String = s"($sootMethod, $sootUnit, $line)" | ||
def getMethod = sootMethod | ||
def getUnit = sootUnit | ||
def getLine = line | ||
} | ||
|
||
/* | ||
* A graph node defined using the GraphNode abstraction specific for statements. | ||
* Use this class as example to define your own custom nodes. | ||
*/ | ||
case class StatementNode(value: Statement, nodeType: NodeType) extends GraphNode { | ||
case class StatementNode(value: Statement, nodeType: NodeType, pathVisitedMethods: ListBuffer[VisitedMethods]) extends GraphNode { | ||
type T = Statement | ||
|
||
// override def show(): String = "(" ++ value.method + ": " + value.stmt + " - " + value.line + " <" + nodeType.toString + ">)" | ||
override def show(): String = value.stmt | ||
def getPathVisitedMethods() = pathVisitedMethods | ||
|
||
override def pathVisitedMethodsToString(): String = { | ||
var methodsString = "" | ||
|
||
if (pathVisitedMethods != null){ | ||
methodsString = pathVisitedMethods.map(_. toString).mkString(" => ") | ||
} | ||
s"path: $methodsString" | ||
} | ||
|
||
override def show(): String = "(" ++ value.method + ": " + value.stmt + " - " + value.line + " <" + nodeType.toString + ">)" | ||
|
||
override def toString: String = | ||
"Node(" + value.method + "," + value.stmt + "," + "," + nodeType.toString + ")" | ||
"Node(" + value.method + "," + value.stmt + "," + value.line+ "," + nodeType.toString + ", "+pathVisitedMethodsToString+")" | ||
|
||
override def equals(o: Any): Boolean = { | ||
o match { | ||
// case stmt: StatementNode => stmt.value.toString == value.toString | ||
// case stmt: StatementNode => stmt.value == value && stmt.nodeType == nodeType | ||
case stmt: StatementNode => stmt.value.className.equals(value.className) && | ||
case stmt: StatementNode => stmt.value.className.equals(value.className) && | ||
stmt.value.method.equals(value.method) && | ||
stmt.value.stmt.equals(value.stmt) && | ||
stmt.value.line.equals(value.line) && | ||
|
@@ -75,6 +101,8 @@ case class StatementNode(value: Statement, nodeType: NodeType) extends GraphNode | |
override def unit(): soot.Unit = value.sootUnit | ||
|
||
override def method(): SootMethod = value.sootMethod | ||
|
||
override def line(): Int = value.line | ||
} | ||
|
||
/* | ||
|
@@ -164,6 +192,7 @@ class Graph() { | |
permitedReturnEdge = true | ||
} | ||
|
||
|
||
def gNode(outerNode: GraphNode): graph.NodeT = graph.get(outerNode) | ||
def gEdge(outerEdge: LkDiEdge[GraphNode]): graph.EdgeT = graph.get(outerEdge) | ||
|
||
|
@@ -445,13 +474,27 @@ class Graph() { | |
/* | ||
* creates a graph node from a sootMethod / sootUnit | ||
*/ | ||
def createNode(method: SootMethod, stmt: soot.Unit, f: (soot.Unit) => NodeType): StatementNode = | ||
def createNode(method: SootMethod, stmt: soot.Unit, f: (soot.Unit) => NodeType, pathVisitedMethods: ListBuffer[VisitedMethods]): StatementNode = | ||
StatementNode(br.unb.cic.soot.graph.Statement(method.getDeclaringClass.toString, method.getSignature, stmt.toString, | ||
stmt.getJavaSourceStartLineNumber, stmt, method), f(stmt)) | ||
stmt.getJavaSourceStartLineNumber, stmt, method), f(stmt), pathVisitedMethods) | ||
|
||
def reportConflicts(): scala.collection.Set[String] = | ||
findConflictingPaths().map(p => p.toString) | ||
|
||
def reportConflitcsMessage() = { | ||
val conflicts = findConflictingPaths() | ||
conflicts.foreach( conflict =>{ | ||
val h = conflict.head | ||
val l = conflict.last | ||
val p1 = conflict.head | ||
val p2 = conflict.last | ||
println("DF interference in class "+p1.method().getDeclaringClass+", method "+ p1.pathVisitedMethods.head.sootMethod.getName) | ||
println("Execution of line "+p1.pathVisitedMethods.head.line+" to "+p2.pathVisitedMethods.head.line+" defined in "+h.unit()+" and propagated in "+l.unit()) | ||
println("Caused by line "+p1.pathVisitedMethods.head.line+ " flow: "+p1.pathVisitedMethodsToString()) | ||
println("Caused by line "+p2.pathVisitedMethods.head.line+ " flow: "+p2.pathVisitedMethodsToString()) | ||
}) | ||
} | ||
|
||
def findConflictingPaths(): scala.collection.Set[List[GraphNode]] = { | ||
if (fullGraph) { | ||
val conflicts = findPathsFullGraph() | ||
|
@@ -464,7 +507,10 @@ class Graph() { | |
sourceNodes.foreach(source => { | ||
sinkNodes.foreach(sink => { | ||
val paths = findPath(source, sink) | ||
conflicts = conflicts ++ paths | ||
val pathsHaveSameSourceAndSinkRootTraversedLine: Boolean = conflicts.exists(c => paths.exists(p => c.head.line() == p.head.line() && c.last.line() == p.last.line())) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ignorar caminhos repetidos com mesma origem e destino. |
||
if (!pathsHaveSameSourceAndSinkRootTraversedLine){ | ||
conflicts = conflicts ++ paths | ||
} | ||
}) | ||
}) | ||
conflicts.filter(p => p.nonEmpty).toSet | ||
|
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
10 changes: 10 additions & 0 deletions
10
src/main/scala/br/unb/cic/soot/svfa/jimple/AnalysisDepth.scala
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,10 @@ | ||
package br.unb.cic.soot.svfa.jimple | ||
|
||
trait AnalysisDepth { | ||
def maxDepth(): Int = 0 | ||
def isLimited(): Boolean= maxDepth() > 0 | ||
} | ||
|
||
trait StandardLimitedAnalysis extends AnalysisDepth { | ||
override def maxDepth(): Int = 10 | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alterar isso para o de Rodrigo.