Commit Graph

705 Commits

Author SHA1 Message Date
xbauch 01da544262 Add check that gdb is on the path
No functional change.  Only wraps the test cases in an if-statements checking
the presence of gdb.
2019-03-24 17:03:08 +00:00
Peter Schrammel 2e04b54cfc
Merge pull request #4217 from peterschrammel/move-bmct-jbmc
Move cbmc/bmc and all_properties to jbmc
2019-03-21 14:15:43 +00:00
Daniel Poetzl 468717f39e Make the shared pointers and write_* methods of the sharing nodes protected
The data member and the write_* methods of sharing_node_innert and
sharing_node_leaft are made protected and existing external callers are
refactored to not use write_* directly.
2019-03-21 11:15:12 +00:00
Daniel Poetzl 2614c5bac9 Add reset() method to small_shared_two_way_ptrt
This adds a reset() method which clears the contents of the shared pointer.
Furthermore, the code to remove a reference to the pointed-to object is factored
out into a method destruct(). The method is used both by the destructor and by
reset().
2019-03-21 10:59:59 +00:00
Michael Tautschnig d61900d41c
Merge pull request #4370 from tautschnig/fix-cudd-Makefile-build
Fix Makefile-based build for with CUDD
2019-03-21 10:12:16 +00:00
Peter Schrammel 14109a48ba Fix path explorer unit test
Cannot use deprecated bmct anymore.
2019-03-21 09:57:38 +00:00
Peter Schrammel 90a041da9c Move bmct and all_properties to jbmc/
These aren't used by CBMC anymore, but only
for the symex-driven lazy-loading mode of JBMC.
2019-03-21 09:54:48 +00:00
Daniel Poetzl 6533631183
Merge pull request #3983 from danpoe/feature/gdb-api
GDB API [blocks: #4261]
2019-03-19 17:04:26 +00:00
Petr Bauch d803bde3c9 Fix based on comments 2019-03-19 16:01:40 +00:00
Daniel Poetzl fcbe7b933b Add new unit tests for the gdb api
This adds new unit tests for gdb_apit. The tests compile a test file test.c and
then run gdb on it (via gdb_apit).
2019-03-19 15:52:32 +00:00
Daniel Poetzl aece5a5644 Enable and update gdb api unit tests
This enables the gdb api unit tests (in memory-analyzer/gdb_api.cpp) and adapts
them to include use_catch.h instead of catch.hpp.
2019-03-19 15:52:32 +00:00
Daniel Poetzl 7e6bd17018 Replace #ifdef __linux__ by guards allowing more Unices
We require the Unix fork() system call (in unistd.h)
2019-03-19 15:52:32 +00:00
Daniel Poetzl 0b9480bb40 Update banners for gdb api files 2019-03-19 13:42:01 +00:00
Daniel Poetzl d44dfb99c9 Adapt gdb interaction exception to cprover style 2019-03-19 13:42:01 +00:00
Malte Mues 1e71fd7fbc Add an api to analyze a core dump with gdb
Applying CBMC on large code bases
requires sometimes to model a test environment.
Running a program until a certain point and let it
crash, allows to analyze the memory state at this point in time.
In continuation, the memory state might be reconstructed as base for
the test environment model.

By using gdb to analyze the core dump, I don't have to take
care of reading and interpreting the core dump myself.
2019-03-19 13:42:01 +00:00
Chris Smowton c5d7bae08d Symex: propagate constants implied by assumptions and conditions
When passing `assume(symbol == constant)` or `if symbol == constant then GOTO`, we can populate the
constant propagator and value-set accordingly and use that information until the next merge point without
that constraint. We implement this by allocating and defining a fresh L2 generation on this path, which
will be merged as "real", assignment-derived generations are. Symbols are subject to propagation under
the same conditions as they are on assignment (e.g. requiring that they are not subject to concurrent
modification by other threads).
2019-03-18 16:15:59 +00:00
Michael Tautschnig c7db0c9e6f Fix Makefile-based build for with CUDD
The previous set-up failed to compile (as cudd.h was not found), and
first fixes to make it compile and link resulted in persistent
segmentation faults. These were caused by inconsistent includes as
HAVE_CUDD was only set in selected directories (unlike the CMake
configuration).
2019-03-14 21:41:47 +00:00
Michael Tautschnig 4fa790bdc2
Merge pull request #4385 from smowton/smowton/fix/expr-iterator-mutated
Expr-depth-iterator: support iterating over mutated expressions
2019-03-14 20:37:18 +00:00
Chris Smowton 17bee52504 Add unit tests for expr_iterator 2019-03-14 18:09:17 +00:00
Michael Tautschnig 027760b479 Pass irept by value in modifying irept::add/set operations
This should enable use (with performance benefit) of rvalue references in
higher-level APIs.
2019-03-14 15:03:12 +00:00
Romain Brenguier e80340d31a Unit test for ranget drop
This tests that these operations behave as expected and gives examples
on how to use them.
2019-03-08 14:13:53 +00:00
Romain Brenguier f9a698ce24 Remove root field of bdd_exprt
Instead the result of from_exprt and the input of as_expr should be
BDDs.
This makes it possible to reuse the same manager for several exprt
conversion and to combine the results obtain from the from_expr
conversion with BDD operations.
2019-03-07 11:02:35 +00:00
Romain Brenguier 4da4bd3dbe Remove unused field ns field of bdd_exprt
A reference to a namespace was stored without being ever used.
2019-03-07 11:02:35 +00:00
Romain Brenguier 9727c5e7e8 Add guard_manager class and pass it around
This in preparation to using BDDs to encode guards,
every part of the code creating guards need to reference a guard_manager.
2019-03-07 11:02:35 +00:00
Michael Tautschnig ab09a6c134 A decision_proceduret isn't a messaget
Some derived classes may want to generate output, but then it's safe for them to
be messaget's.
2019-03-07 06:56:11 +00:00
Michael Tautschnig 0a73e03b24 std_expr.h: add/enable missing can_cast, validate_expr
Some were unnecessarily missing, others were wrongly commented out.
2019-03-06 23:25:22 +00:00
Peter Schrammel 55f7bafeca Remove obsolete cbmc/bmc_cover
The goto-checker infrastructure is used now.
2019-03-04 18:22:31 +00:00
Michael Tautschnig 2bb84ade66
Merge pull request #3191 from sonodtt/goto_programs-validation
Goto programs validation
2019-03-04 14:37:57 +00:00
Michael Tautschnig ebfab8d2c1 Store "is hidden" attribute of goto functions in the symbol table
There should only be a single place to hold type information, including
attributes, to ensure consistency. Future changes will remove the "type" member
of goto_functiont, making the type information stored in the symbol table the
single, authoritative source of information.

With this commit the information will remain available in both places, but all
read accesses only use the information in the symbol table.
2019-03-04 10:22:10 +00:00
Peter Schrammel 585ea91c72 Remove obsolete cbmc/fault_localization
The goto-checker infrastructure is used now.
2019-03-03 21:57:51 +00:00
Sonny Martin 6ba2cf43b4 Reorder unit test headers for consistency. 2019-03-01 14:50:19 +00:00
Sonny Martin a1de5dc259 Remove extraneous goto-program checks in unit tests.
Although additional checks may hold, they have their own unit
tests and it is these tests that should fail when these checks fail.
2019-03-01 14:50:19 +00:00
Sonny Martin b5b1f64a2b Address review comments - Kroening
Removed previously disabled checks:
Not every instruction has a code member - so removed checks that both 
instruction sourcelocation and code sourcelocation are set and identical
Remove also remaining check that every instruction have a non-nil 
sourcelocation as this would have to be optional (if enabled fails 
many regression tests). This also simplifies considerably the overall 
validation pass (removes much passing around of the options structure).

Removes check on function return type - this will be preserved (#4266)

goto_model::validate now has default parameters.

Minor fixes.
2019-03-01 14:50:02 +00:00
Sonny Martin 971c788ae0 Address review comments - Kroening
Removed previously disabled checks:
Not every instruction has a code member - so removed checks that both 
instruction sourcelocation and code sourcelocation are set and identical
Remove also remaining check that every instruction have a non-nil 
sourcelocation as this would have to be optional (if enabled fails 
many regression tests). This also simplifies considerably the overall 
validation pass (removes much passing around of the options structure).

Removes check on function return type - this will be preserved (#4266)

goto_model::validate now has default parameters.

Minor fixes.
2019-03-01 14:05:54 +00:00
Michael Tautschnig 5377c2c4ef
Merge pull request #4301 from romainbrenguier/refactor/simplify_expr_copy
Make simplify_expr take copy instead of reference
2019-02-28 17:40:45 +00:00
Romain Brenguier 94b2145fdd Move arguments into simplify_expr call
We use std::move in a few places where this is made possible by the
change in interface.
2019-02-28 15:09:02 +00:00
Vojtěch Forejt be4cee2fa9
Merge pull request #4180 from forejtv/forejtv/cover-instrumentations
Extend the options for coverage instrumentation
2019-02-28 15:04:28 +00:00
Daniel Kroening d285eb8e90 pointer_offset_size functions now use optional
This reminds the user of these functionst that they might return an error.
2019-02-27 11:55:09 +00:00
Sonny Martin 1fb11297d5 Rebase and address review comments 2019-02-27 11:32:21 +00:00
Sonny Martin ab3cb608d5 Adjustments for new location of program checks 2019-02-27 10:43:26 +00:00
Sonny Martin ca1116608b Add options structure to unit tests 2019-02-27 10:43:25 +00:00
Sonny Martin 6cc09c9d4b Add boolean constructor to options structure 2019-02-27 10:43:24 +00:00
Sonny Martin a3b55130ff Use catch exception macros 2019-02-27 10:43:24 +00:00
Sonny Martin 5fddbcdcd1 Validation checks for Goto Programs
There are several checks, implemented with separate methods, and
some flagged as optional.
NB use of validate_goto_model(*this, vm) in goto_functions.h is to avoid
circular inclusion as function_mapt is a nested type and so cannot be
forward declared.
2019-02-27 10:43:07 +00:00
Vojtech Forejt 0689f81fed Unit tests for cover-only 2019-02-26 22:04:40 +00:00
Michael Tautschnig 05af336b50 Byte-operator lowering: support structs containing bit-fields
This removes the constraint on aligned member accesses. Includes factoring out
of unpack_struct to avoid growing the size of unpack_rec even further.
2019-02-26 19:09:24 +00:00
Michael Tautschnig 6a0d998124 Rewrite byte_update lowering to respect endianness, support composite types
byte_update lowering now proceeds as follows:
1) Determine the size of the update, with the size of the object to be
updated as an upper bound. We fail if neither can be determined.
2) Turn the update value into a byte array of the size determined above.
3) If the offset is not constant, turn the object into a byte array, and
use a "with" expression to encode the update; else update the values in
place.
4) Construct a new object.
2019-02-26 19:09:24 +00:00
Daniel Kroening 85ba2253fe prefer .add over .emplace
This is easier to read.
2019-02-26 13:56:53 +00:00
Romain Brenguier e1fb6b7fec Add unit test for BDD
This adds a test case to check there are no mistakes in the BDD to expr
conversions.
This test can fail without the previous fix.
2019-02-25 17:28:16 +00:00
Michael Tautschnig 24bf054b07 Do not use has_prefix in source_location.h
source_location.h is transitivly included in almost every translation unit.
Avoid the prefix.h include by moving the a method definition to the cpp file.
2019-02-21 09:57:17 +00:00