11#include "klee/Config/config.h"
19llvm::cl::opt<bool> DumpPartialQueryiesEarly(
20 "log-partial-queries-early", llvm::cl::init(
false),
21 llvm::cl::desc(
"Log queries before calling the solver (default=false)"),
25llvm::cl::opt<bool> CreateCompressedQueryLog(
26 "compress-query-log", llvm::cl::init(
false),
27 llvm::cl::desc(
"Compress query log files (default=false)"),
33 const std::string &commentSign,
36 : solver(_solver), BufferString(
""), logBuffer(BufferString), queryCount(0),
37 minQueryTimeToLog(queryTimeToLog), logTimedOutQueries(logTimedOut),
38 queryCommentSign(commentSign) {
41 if (!CreateCompressedQueryLog) {
47 os = klee_open_compressed_output_file(path, error);
51 klee_error(
"Could not open file %s : %s", path.c_str(), error.c_str());
71 const Query *falseQuery,
72 const std::vector<const Array *> *objects) {
77 <<
"Type: " << typeName <<
", "
82 if (DumpPartialQueryiesEarly) {
93 if (
false == success) {
95 << SolverImpl::getOperationStatusString(
121 <<
" Is Valid: " << (isValid ?
"true" :
"false") <<
"\n";
167 const Query &query,
const std::vector<const Array *> &objects,
168 std::vector<std::vector<unsigned char> > &values,
bool &hasSolution) {
169 startQuery(query,
"InitialValues", 0, &objects);
178 <<
" Solvable: " << (hasSolution ?
"true" :
"false") <<
"\n";
180 std::vector<std::vector<unsigned char> >::iterator values_it =
183 for (std::vector<const Array *>::const_iterator i = objects.begin(),
185 i != e; ++i, ++values_it) {
186 const Array *array = *i;
187 std::vector<unsigned char> &data = *values_it;
190 for (
unsigned j = 0; j < array->
size; j++) {
193 if (j + 1 < array->
size) {
SolverRunStatus getOperationStatusCode()
getOperationStatusCode - get the status of the last solver operation
virtual ~QueryLoggingSolver()
bool computeTruth(const Query &query, bool &isValid)
implementation of the SolverImpl interface
std::unique_ptr< llvm::raw_ostream > os
virtual void printQuery(const Query &query, const Query *falseQuery=0, const std::vector< const Array * > *objects=0)=0
virtual void startQuery(const Query &query, const char *typeName, const Query *falseQuery=0, const std::vector< const Array * > *objects=0)
time::Span lastQueryDuration
char * getConstraintLog(const Query &)
time::Span minQueryTimeToLog
bool computeValue(const Query &query, ref< Expr > &result)
void setCoreSolverTimeout(time::Span timeout)
const std::string queryCommentSign
llvm::raw_string_ostream logBuffer
bool computeValidity(const Query &query, Solver::Validity &result)
QueryLoggingSolver(Solver *_solver, std::string path, const std::string &commentSign, time::Span queryTimeToLog, bool logTimedOut)
virtual void finishQuery(bool success)
void flushBufferConditionally(bool writeToFile)
bool computeInitialValues(const Query &query, const std::vector< const Array * > &objects, std::vector< std::vector< unsigned char > > &values, bool &hasSolution)
virtual void setCoreSolverTimeout(time::Span timeout)
virtual bool computeTruth(const Query &query, bool &isValid)=0
virtual bool computeInitialValues(const Query &query, const std::vector< const Array * > &objects, std::vector< std::vector< unsigned char > > &values, bool &hasSolution)=0
@ SOLVER_RUN_STATUS_TIMEOUT
virtual bool computeValue(const Query &query, ref< Expr > &result)=0
virtual char * getConstraintLog(const Query &query)
virtual bool computeValidity(const Query &query, Solver::Validity &result)
virtual SolverRunStatus getOperationStatusCode()=0
getOperationStatusCode - get the status of the last solver operation
Statistic * getStatisticByName(const std::string &name) const
std::uint64_t getValue() const
getValue - Get the current primary statistic value.
Point getWallTime()
Returns point in time using a monotonic steady clock.
std::unique_ptr< llvm::raw_fd_ostream > klee_open_output_file(const std::string &path, std::string &error)
void klee_error(const char *msg,...) __attribute__((format(printf
llvm::cl::OptionCategory SolvingCat
StatisticManager * theStatisticManager
Query withFalse() const
withFalse - Return a copy of the query with a false expression.