Skip to content

Commit

Permalink
[feat] Add mocks
Browse files Browse the repository at this point in the history
  • Loading branch information
misonijnik committed Apr 30, 2023
1 parent 6983578 commit 36ee656
Show file tree
Hide file tree
Showing 9 changed files with 332 additions and 157 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
"Latest klee-uclibc",
"Asserts enabled",
"No TCMalloc, optimised runtime",
]
]
include:
- name: "LLVM 13"
env:
Expand Down
3 changes: 2 additions & 1 deletion include/klee/Core/TerminationTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
TTYPE(ReadOnly, 17U, "read_only.err") \
TTYPE(ReportError, 18U, "report_error.err") \
TTYPE(UndefinedBehavior, 19U, "undefined_behavior.err") \
MARK(PROGERR, 19U) \
TTYPE(InternalOutOfMemory, 20U, "out_of_memory.er") \
MARK(PROGERR, 20U) \
TTYPE(User, 23U, "user.err") \
MARK(USERERR, 23U) \
TTYPE(Execution, 25U, "exec.err") \
Expand Down
4 changes: 4 additions & 0 deletions lib/Core/ExecutionState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ ExecutionState::ExecutionState(KFunction *kf)
: initPC(kf->instructions), pc(initPC), prevPC(pc),
roundingMode(llvm::APFloat::rmNearestTiesToEven) {
pushFrame(nullptr, kf);
setID();
}

ExecutionState::ExecutionState(KFunction *kf, KBlock *kb)
Expand Down Expand Up @@ -346,6 +347,7 @@ bool ExecutionState::merge(const ExecutionState &b) {

std::set<ref<Expr>> aConstraints(constraints.begin(), constraints.end());
std::set<ref<Expr>> bConstraints(b.constraints.begin(), b.constraints.end());

std::set<ref<Expr>> commonConstraints, aSuffix, bSuffix;
std::set_intersection(
aConstraints.begin(), aConstraints.end(), bConstraints.begin(),
Expand All @@ -357,6 +359,7 @@ bool ExecutionState::merge(const ExecutionState &b) {
std::set_difference(bConstraints.begin(), bConstraints.end(),
commonConstraints.begin(), commonConstraints.end(),
std::inserter(bSuffix, bSuffix.end()));

if (DebugLogStateMerge) {
llvm::errs() << "\tconstraint prefix: [";
for (std::set<ref<Expr>>::iterator it = commonConstraints.begin(),
Expand Down Expand Up @@ -472,6 +475,7 @@ bool ExecutionState::merge(const ExecutionState &b) {
constraints = ConstraintSet();

ConstraintManager m(constraints);

for (const auto &constraint : commonConstraints)
m.addConstraint(constraint);
m.addConstraint(OrExpr::create(inA, inB));
Expand Down
Loading

0 comments on commit 36ee656

Please sign in to comment.