Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Introduce StateLabel
  • Loading branch information
sergeypospelov committed Jul 8, 2022
commit 58ae325f74e9a82b50134fd377c52d482a7cca32
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,24 @@ const val CALL_DECISION_NUM = -2

data class Edge(val src: Stmt, val dst: Stmt, val decisionNum: Int)

/**
* Possible state types. Engine matches on them and processes differently.
*
* [INTERMEDIATE] is a label for an intermediate state which is suitable for further symbolic analysis.
*
* [TERMINAL] is a label for a terminal state from which we might (or might not) execute concretely and construct
* UtExecution. This state represents the final state of the program execution, that is a throw or return from the outer
* method.
*
* [CONCRETE] is a label for a state which is not suitable for further symbolic analysis and it is also not a terminal
* state. Such states are only suitable for a concrete execution and may appear from Assumptions constraints
Comment thread
sergeypospelov marked this conversation as resolved.
Outdated
*/
enum class StateLabel {
INTERMEDIATE,
TERMINAL,
CONCRETE
}

/**
* The stack element of the [ExecutionState].
* Contains properties, that are suitable for specified method in call stack.
Expand Down Expand Up @@ -112,6 +130,7 @@ data class ExecutionState(
val lastMethod: SootMethod? = null,
val methodResult: MethodResult? = null,
val exception: SymbolicFailure? = null,
val label: StateLabel = StateLabel.INTERMEDIATE,
private var stateAnalyticsProperties: StateAnalyticsProperties = StateAnalyticsProperties()
) : AutoCloseable {
val solver: UtSolver by symbolicState::solver
Expand Down Expand Up @@ -161,6 +180,7 @@ data class ExecutionState(
lastEdge = edge,
lastMethod = executionStack.last().method,
exception = exception,
label = label,
stateAnalyticsProperties = stateAnalyticsProperties.successorProperties(this)
)
}
Expand All @@ -187,7 +207,8 @@ data class ExecutionState(
pathLength = pathLength + 1,
lastEdge = edge,
lastMethod = executionStack.last().method,
methodResult,
methodResult = methodResult,
label = label,
stateAnalyticsProperties = stateAnalyticsProperties.successorProperties(this)
)
}
Expand Down Expand Up @@ -226,6 +247,7 @@ data class ExecutionState(
pathLength = pathLength + 1,
lastEdge = edge,
lastMethod = stackElement.method,
label = label,
stateAnalyticsProperties = stateAnalyticsProperties.successorProperties(this)
)
}
Expand Down Expand Up @@ -271,6 +293,7 @@ data class ExecutionState(
pathLength = pathLength + 1,
lastEdge = edge,
lastMethod = stackElement.method,
label = label,
stateAnalyticsProperties = stateAnalyticsProperties.successorProperties(this)
)
}
Expand All @@ -284,6 +307,8 @@ data class ExecutionState(
solver.expectUndefined = true
}

fun withLabel(newLabel: StateLabel) = copy(label = newLabel)

override fun close() {
solver.close()
}
Expand Down