about summary refs log tree commit diff homepage
path: root/lib/Core
AgeCommit message (Collapse)Author
2016-08-08Fix for klee_get_obj_size() crashing on 64-bit, resolves #446hutoTUM
2016-08-04klee: add exit-on-error-type parameterJiri Slaby
It allows stopping the execution on some conditions like assertions. The use is like: klee -exit-on-error-type=Assert -exit-on-error-type=External file.llvm This is especially useful in the SV-COMP. A test to cover the new parameter was added too. Signed-off-by: Jiri Slaby <jslaby@suse.cz>
2016-07-11Executor: do not crash on non-sized globalsJiri Slaby
Sometimes, globals are not sized and ->getTypeStoreSize on such type crashes inside the LLVM. Check whether type is sized prior to calling the function above. A minimalistic example of Y being unsized with no effect on the actual code is put to tests. [v2] Use klee_warning for printing. And use %.*s formatting string given StringRef.data() need not be null terminated. Signed-off-by: Jiri Slaby <jslaby@suse.cz>
2016-07-10Fix parsing of deterministic address.Martin Nowack
Allows to provide 0 as an address to allocate deterministic memory area at any free space.
2016-07-08Clang-formated MemoryManagerMartin Nowack
2016-07-08Add deterministic allocation of memoryMartin Nowack
Deterministic allocation provides an internal allocator which mmaps memory to a fixed static address. This way, same allocation is assured across different KLEE runs for the same application assuming a deterministic searcher. In addition, this patch provides following options: -allocate-determ: switch on/off deterministic allocation -allocate-determ-size: adjust preallocated memory -null-on-zero-malloc: returns null pointer in case a malloc of size 0 was requested. According to standard, also a non-null pointer can be returned (which happens with the default glibc malloc implementation) -allocation-space: space between allocations can be adjusted. KLEE is not able to detect out-of-bound accesses which are inside another but wrong object. Due the implementation of typical allocators adjacent mallocs have space in between for management purposes. This spaces helped KLEE to detect off-by-1/2 accesses. For higher numbers, the allocation space has to be increased. -allocate-determ-start-address: adjust deterministic start address. The addres has to be page aligned. KLEE fails if it cannot acquire this address
2016-07-08Handle aligned varargs allignment correctlyMartin Nowack
For vararg handling, arguments of size bigger than 64 bit need to be handled 128bit aligned according to AMD calling conventions AMD64-ABI 3.5.7p5. To handle that case correctly, we do: 1) make sure that every argument is aligned correctly in an allocation for function arguments 2) the allocation itself is aligned correctly
2016-07-08Generate forked states for switch instructions deterministicallyMartin Nowack
This patch generates the states based on the order of switch-cases. Before, switch-constraints were randomly assigned to forked states. As generated code might be different between LLVM versions, we use the case values, order them, and iterate in that order over the cases. This way we can also support deterministic execution of older LLVM versions.
2016-07-08Use vector instead of set to add/remove statesMartin Nowack
Deterministic adding/removing of states.
2016-07-08IterativeDeepeningTimeSearcher: Fix using wrong iteratorMartin Nowack
2016-07-08Refactoring: Extract method to dump remaining statesMartin Nowack
2016-07-08Merge pull request #391 from MartinNowack/feat_zipstream_compressMartinNowack
Support gzip-based compression of raw_outstreams
2016-07-08Support gzip-based compression of raw_outstreamsMartin Nowack
Provide initial zlib-based compression support for raw_outstreams. Replacing llvm::raw_fd_outstreams with compressed_fd_outstreams automatically compresses data in gzip format before writing to file. Options added: * --compress-log to compress all query log files (e.g. *.pc, *.smt2) on the fly. Every query log file gets extended with .gz. * --debug-compress-instructions to compress logfile for instruction stream on the fly.
2016-07-08Add feature to dump statistics after n instructionsMartin Nowack
Add -stats-write-after-instructions and -istats-write-after-instructions to update each statistic after n steps. Furthermore, the metric "minimal distance to uncovered state" is now updated independently if statistics are enabled or not. This metric is needed i.e. by weighted random searchers directed towards uncovered instructions. Remove some dead code.
2016-06-23Use klee_message for timeout informationAndrea Mattavelli
2016-05-18Modified -debug-print-instructions to allow to write directly on log file.Andrea Mattavelli
The option now contains 4 different options: 1) all:stderr, which logs all instructions to file in format [src, inst_id, llvm_inst]; 2) src:stderr, which logs all instructions to file in format [src, inst_id]; 3) compact:stderr, which logs all instructions to file in format [inst_id]; 4) all:file, which logs all instructions to file in format [src, inst_id, llvm_inst]; 5) src:file, which logs all instructions to file in format [src, inst_id]; 6) compact:file, which logs all instructions to file in format [inst_id]; Writing to file gives a speedup of ~50x.
2016-04-08Remove computation of ``isLocal`` that is always true when handlingDan Liew
AllocaInst.
2016-04-08Rename KLEE command line options fromDan Liew
* ``-replay-out`` to ``-replay-ktest-file`` * ``-replay-out-dir`` to ``-replay-ktest-dir`` and also rename * help descriptions * global variables corresponding to these options. * Names used in ``KleeHandler``, ``Interpreter``, ``Executor`` and in KLEE's ``main()`` function. The old name for the options/code was very unhelpful as it wasn't obvious that "out" files are ``.ktest`` files unless you examine KLEE's source code.
2016-03-01Documented default values for various options and improved the description ↵Cristian Cadar
of some.
2016-02-27Use klee-provided GetMallocUsage for consistencyMartin Nowack
2016-02-27Refactoring: Extract checking memory limit into own functionMartin Nowack
2016-01-12Refactor setting the core solver (i.e. STP, MetaSMT or DummySolver) by providingDan Liew
a ``createCoreSolver()`` function. The solver used is set by the new ``--solver-backend`` command line argument. The default is STP. This change necessitated refactoring the MetaSMT stuff. That clearly didn't belong in the Executor! The MetaSMT command line option is now ``--metasmt-backend`` as this only picks the MetaSMT backend. In order to use MetaSMT ``--solver-backend=metasmt`` needs to be passed. Note I don't have MetaSMT built on my development machine so I don't know if the MetaSMT stuff even compiles...
2015-12-18Move lib/Solver/SolverStats.h -> include/klee/SolverStats.hDan Liew
so that it is possible to ``#include "klee/util/ArrayExprHash.h"``
2015-12-18Fix memory leaks of ``Array`` objects detected by ASan.Dan Liew
Some of these leaks were introduced by the factory constructor for Array objects (f049ff3bc04daead8c3bb9f06e89e71e2054c82a) but a few others have been around for far longer. This leak was fixed by introducing a ``ArrayCache`` object which has two purposes * Retains ownership of all created ``Array`` objects and destroys them when the ``ArrayCache`` destructor is called. * Mimic the caching behaviour for symbolic arrays that was introduced by f049ff3bc04daead8c3bb9f06e89e71e2054c82a where arrays with the same name and size get "uniqued". The Executor now maintains a ``arrayCache`` member that it uses and passes by pointer to objects that need to construct ``Array`` objects (i.e. ``ObjectState``). This way when the Executor is destroyed all the ``Array`` objects get freed which seems like the right time to do this. For Kleaver the ``ParserImpl`` has a ``TheArrayCache`` member that is used for building ``Array`` objects. This means that the Parser must live as long as the built expressions will be used otherwise we will have a use after free. I'm not sure this is the right design choice. It might be better to transfer ownership of the ``Array`` objects to the root ``Decl`` returned by the parser.
2015-12-17Clean up the check in the previous commit by using one of KLEE'sDan Liew
helper functions.
2015-12-17Fixed a bug with how non power 2 values were written to memory, added test ↵Timotej Kapus
for it
2015-12-17Refactoring: Moving klee_warning/_error functions to ErrorHandling in ↵Martin Nowack
Support directory
2015-12-11Reword help description for ``--silent-klee-assume`` command lineDan Liew
flag as suggested by @ccadar
2015-12-11Add command line flag ``--silent-klee-assume``to suppress errors due toValentin Wüstholz
infeasible assumptions.
2015-06-03Added an option --readable-posix-inputs which is used to turn on/off the CEX ↵Cristian Cadar
preferences added in the POSIX model. Removed option --prefer-cex which controlled all CEX preferences.
2015-05-31Make use of prefer-cex optional rather than defaultEric Rizzi
Previously, default Klee would go through every byte in a test case and attempt to bound it to be between 0 and 127, making it human readable. While this may be useful when attempting to understand Klee, it also means that the time required to create large test suites was greatly increased. By making this behavior default off, unsuspecting users won't incur these additional costs.
2015-04-25Give KLEE release version information in the output of klee and kleaverDan Liew
when they are given the --version command line option. Unfortunately to make the build type and git revision available we need to check this for every build which means KLEE's support library will be rebuilt for every build which will slow down incremental builds. This addresses issue #231
2015-04-03Fixed issue introduce during a previous refactoring, related to field ordering.Cristian Cadar
2015-04-02Silenced some compilation warnings.Cristian Cadar
2015-04-02Merge pull request #209 from erakadjiev/timestamp_optimizeCristian Cadar
Cleaner, more efficient timestamps
2015-04-02Removed unused fakeState field from ExecutionStateCristian Cadar
2015-04-02Removed underConstrained field, which I believe was re-introduced byCristian Cadar
mistake in the last cleanup commit.
2015-04-02[Core] Documentation and cleanupMartin Nowack
* Removed unused member ShadowObjects in ExecutionState * Added documentation of members and reorder according to categories
2015-04-01[Core] Fixed typo in assertionMartin Nowack
2015-03-13Timestamp improvements.Emil Rakadjiev
Replaced inefficient llvm::sys::Process::GetTimeUsage() with TimeValue::now(), because in many cases only the wall clock time is needed, not the user and sys times (which are significantly more expensive to get). Updated TimingSolver and WallTimer accordingly.
2015-03-12[Core] Always warn if states get deleted due to memory limitsMartin Nowack
2015-02-27Improved some comments and fixed some formatting issues in the Array factory ↵Cristian Cadar
patch.
2015-02-27Merge branch 'ArrayFactory' of https://github.com/holycrap872/klee into ↵Cristian Cadar
holycrap872-ArrayFactory
2015-02-22Added factory method for Arrays + hid constructors from outside callsEric Rizzi
The way that Arrays were handled in the past led to the possibility of aliasing issues. This occured whenever a new branch discovered an array for the first time. Each branch would create a new instance of the same array without seeing if it had been created before. Therefore, should a new branch encounter the same state as some previous branch, the previous branch's solution wouldn't satisfy the new state since they didn't recognize they were referencing the same array. By creating an array factory that creates a single symbolic array, that problem is handled. Note: Concrete arrays should not be created by the factory method since their values are never shared between branches. The factory works by seeing if an array with a similar hash has been created before (the hash is based on the name and size of array). If there has been it then searches through all of the arrays with the same hash (stored in a vector) to see if there is one with an exact match. If there is one, the address of this previously created equivalent array is returned. Otherwise, the newly created array is unique, it is added to the map, and it's address is returned. This aliasing issue can be seen by comparing the output of the Dogfood/ImmutableSet.cpp test cases with and with out this commit. Both act correctly, but the number of queries making it to the solver in the previous version is much greater 244 vs 211. This is because the UBTree in the CexCachingSolver and the cache in the CachingSolver do not recognize queries whose solutions were previously calculated because it doesn't think the arrays in the two queries are the same. While this does not cause an error, it does mean that extra calls are made.
2015-02-13refactor integer overflow detection, add signed intLuca Dariz
Instead of checking for every possible casse which result in overflow, it is much simpler to perform the operation using integers with bigger dimension and check if the result overflow
2015-02-13Detect overflow of unsigned add, sub and mul operationsLuca Dariz
This requires clang with -fsanitize=unsigned-integer-overflow tested with clang and llvm 3.4.2
2015-02-13Revert "Merged @luckyluke's change for detecting overflow of unsigned add, sub"Cristian Cadar
Will redo the merge to preserve original commits. This reverts commit a743d7072d9ccf11f96e3df45f25ad07da6ad9d6.
2015-02-10Merged @luckyluke's change for detecting overflow of unsigned add, subCristian Cadar
and mul operations. Refactored tests into two main cases, and disabled them on LLVM 2.9, which does not support -fsanitized=*signed-integer-overflow.
2014-12-19Merge pull request #168 from willemp/fix-va-args-passing-for-big-typesCristian Cadar
Fix va args passing for big types
2014-12-02Implement :named and let abbreviation modes in ExprSMTLIBPrinterRaimondas Sasnauskas
* Set the default abbreviation mode to let (ExprSMTLIBPrinter::ABBR_LET) * Remove the now defunct ExprSMTLIBLetPrinter * Improve performance of ExprSMTLIBPrinter::scan() by keeping track of visited Expr to avoid visiting them again * Rename ExprSMTLIBPrinter::printQuery() to ExprSMTLIBPrinter::printQueryExpr()