klee
KQueryLoggingSolver.cpp
Go to the documentation of this file.
1//===-- KQueryLoggingSolver.cpp -----------------------------------------------===//
2//
3// The KLEE Symbolic Virtual Machine
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#include "QueryLoggingSolver.h"
11
12#include "klee/Expr/Expr.h"
14#include "klee/System/Time.h"
15
16using namespace klee;
17
19
20private :
22
23 virtual void printQuery(const Query& query,
24 const Query* falseQuery = 0,
25 const std::vector<const Array*>* objects = 0) {
26
27 const ref<Expr>* evalExprsBegin = 0;
28 const ref<Expr>* evalExprsEnd = 0;
29
30 if (0 != falseQuery) {
31 evalExprsBegin = &query.expr;
32 evalExprsEnd = &query.expr + 1;
33 }
34
35 const Array* const *evalArraysBegin = 0;
36 const Array* const *evalArraysEnd = 0;
37
38 if ((0 != objects) && (false == objects->empty())) {
39 evalArraysBegin = &((*objects)[0]);
40 evalArraysEnd = &((*objects)[0]) + objects->size();
41 }
42
43 const Query* q = (0 == falseQuery) ? &query : falseQuery;
44
46 evalExprsBegin, evalExprsEnd,
47 evalArraysBegin, evalArraysEnd);
48 }
49
50public:
51 KQueryLoggingSolver(Solver *_solver, std::string path, time::Span queryTimeToLog, bool logTimedOut)
52 : QueryLoggingSolver(_solver, path, "#", queryTimeToLog, logTimedOut),
54 }
55
57 delete printer;
58 }
59};
60
62
63Solver *klee::createKQueryLoggingSolver(Solver *_solver, std::string path,
64 time::Span minQueryTimeToLog, bool logTimedOut) {
65 return new Solver(new KQueryLoggingSolver(_solver, path, minQueryTimeToLog, logTimedOut));
66}
67
KQueryLoggingSolver(Solver *_solver, std::string path, time::Span queryTimeToLog, bool logTimedOut)
virtual void printQuery(const Query &query, const Query *falseQuery=0, const std::vector< const Array * > *objects=0)
llvm::raw_string_ostream logBuffer
const unsigned size
Definition: Expr.h:489
static void printQuery(llvm::raw_ostream &os, const ConstraintSet &constraints, const ref< Expr > &q, const ref< Expr > *evalExprsBegin=0, const ref< Expr > *evalExprsEnd=0, const Array *const *evalArraysBegin=0, const Array *const *evalArraysEnd=0, bool printArrayDecls=true)
Definition: main.cpp:291
Solver * createKQueryLoggingSolver(Solver *s, std::string path, time::Span minQueryTimeToLog, bool logTimedOut)
ref< Expr > expr
Definition: Solver.h:35
const ConstraintSet & constraints
Definition: Solver.h:34