Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
13 changes: 10 additions & 3 deletions configs/options.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
"maxSolverTime" : "5",
"maxForks" : "200",
"maxSymAlloc" : "32",
"symbolicAllocationThreshhold" : "2048"
"SymbolicAllocationThreshold" : "2048",
"minNumberElements" : "4",
"maxCycles" : 10,
"useSymbolicSizeLI" : false,
"writeKpaths": false
},
"configurations": [
{
Expand All @@ -33,10 +37,13 @@
"--extern-calls-can-return-null",
"--align-symbolic-pointers=false",
"--write-no-tests",
"--write-kpaths",
"--write-kpaths=${writeKpaths}",
"--use-lazy-initialization=only",
"--min-number-elements-li=${minNumberElements}",
"--use-sym-size-li=${useSymbolicSizeLI}",
"--max-cycles=${maxCycles}",
"--rewrite-equalities=simple",
"--symbolic-allocation-threshhold=${symbolicAllocationThreshhold}",
"--symbolic-allocation-threshold=${SymbolicAllocationThreshold}",
"--analysis-reproduce=${sarifTracesFilePath}",
"${bytecodeFilePath}"
]
Expand Down
9 changes: 5 additions & 4 deletions include/klee/Core/TerminationTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,17 @@
TTYPE(ReadOnly, 17U, "read_only.err") \
TTYPE(ReportError, 18U, "report_error.err") \
TTYPE(UndefinedBehavior, 19U, "undefined_behavior.err") \
TTYPE(InternalOutOfMemory, 20U, "out_of_memory.er") \
MARK(PROGERR, 20U) \
TTYPE(InternalOutOfMemory, 20U, "out_of_memory.err") \
TTYPE(MissedAllTargets, 21U, "miss_all_targets.err") \
MARK(PROGERR, 21U) \
TTYPE(User, 23U, "user.err") \
MARK(USERERR, 23U) \
TTYPE(Execution, 25U, "exec.err") \
TTYPE(External, 26U, "external.err") \
MARK(EXECERR, 26U) \
TTYPE(Replay, 27U, "") \
TTYPE(SilentExit, 28U, "") \
TTYPE(MissedAllTargets, 29U, "") \
MARK(END, 29U)
MARK(END, 28U)

///@brief Reason an ExecutionState got terminated.
enum class StateTerminationType : std::uint8_t {
Expand All @@ -61,6 +61,7 @@ enum Reason {
MaxInstructions,
MaxSteppedInstructions,
MaxTime,
MaxCycles,
CovCheck,
NoMoreStates,
ReachedTarget,
Expand Down
9 changes: 9 additions & 0 deletions include/klee/Expr/Expr.h
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,9 @@ class Expr {
/// isZero - Is this a constant zero.
bool isZero() const;

/// isZero - Is this a constant one.
bool isOne() const;

/// isTrue - Is this the true expression.
bool isTrue() const;

Expand Down Expand Up @@ -1553,6 +1556,12 @@ inline bool Expr::isZero() const {
return false;
}

inline bool Expr::isOne() const {
if (const ConstantExpr *CE = dyn_cast<ConstantExpr>(this))
return CE->isOne();
return false;
}

inline bool Expr::isTrue() const {
assert(getWidth() == Expr::Bool && "Invalid isTrue() call!");
if (const ConstantExpr *CE = dyn_cast<ConstantExpr>(this))
Expand Down
5 changes: 2 additions & 3 deletions include/klee/Expr/ExprVisitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,9 @@ class ExprVisitor {
virtual Action visitFNeg(const FNegExpr &);
virtual Action visitFRint(const FRintExpr &);

protected:
VisitorHash visited;

private:
typedef ExprHashMap<ref<Expr>> visited_ty;
visited_ty visited;
bool recursive;

ref<Expr> visitActual(const ref<Expr> &e);
Expand Down
35 changes: 24 additions & 11 deletions include/klee/Module/TargetForest.h
Original file line number Diff line number Diff line change
Expand Up @@ -218,12 +218,35 @@ class TargetForest {
static EquivTargetsHistoryHashSet cachedHistories;
static TargetsHistoryHashSet histories;
unsigned hashValue;
unsigned sizeValue;

explicit History(ref<Target> _target, ref<History> _visitedTargets)
: target(_target), visitedTargets(_visitedTargets) {
computeHash();
}

void computeHash() {
unsigned res = 0;
if (target) {
res = target->hash() * Expr::MAGIC_HASH_CONSTANT;
}
if (visitedTargets) {
res ^= visitedTargets->hash() * Expr::MAGIC_HASH_CONSTANT;
}
hashValue = res;
}

void computeSize() {
unsigned res = 0;
if (target) {
++res;
}
if (visitedTargets) {
res += visitedTargets->size();
}
sizeValue = res;
}

public:
const ref<Target> target;
const ref<History> visitedTargets;
Expand All @@ -238,21 +261,11 @@ class TargetForest {
}

unsigned hash() const { return hashValue; }
unsigned size() const { return sizeValue; }

int compare(const History &h) const;
bool equals(const History &h) const;

void computeHash() {
unsigned res = 0;
if (target) {
res = target->hash() * Expr::MAGIC_HASH_CONSTANT;
}
if (visitedTargets) {
res ^= visitedTargets->hash() * Expr::MAGIC_HASH_CONSTANT;
}
hashValue = res;
}

void dump() const;

~History();
Expand Down
2 changes: 1 addition & 1 deletion include/klee/Solver/SolverCmdLine.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ extern llvm::cl::opt<CoreSolverType> DebugCrossCheckCoreSolverWith;

extern llvm::cl::opt<bool> ProduceUnsatCore;

extern llvm::cl::opt<unsigned> SymbolicAllocationThreshhold;
extern llvm::cl::opt<unsigned> SymbolicAllocationThreshold;

#ifdef ENABLE_METASMT

Expand Down
6 changes: 1 addition & 5 deletions lib/Core/AddressSpace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,12 +274,8 @@ int AddressSpace::checkPointerInObject(ExecutionState &state,
// mustBeTrue before mayBeTrue for the first result. easy
// to add I just want to have a nice symbolic test case first.
const MemoryObject *mo = op.first;
ref<Expr> base = state.isGEPExpr(p) ? state.gepExprBases.at(p).first : p;
ref<Expr> inBounds = mo->getBoundsCheckPointer(p);
inBounds = AndExpr::create(
inBounds,
mo->getBoundsCheckPointer(base)); // FIXME: remove when segmented memory
// model will be implemented

bool mayBeTrue;
if (!solver->mayBeTrue(state.constraints.cs(), inBounds, mayBeTrue,
state.queryMetaData)) {
Expand Down
Loading