-
Notifications
You must be signed in to change notification settings - Fork 274
Tidying up the options for goto-instrument #6475
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
tautschnig
merged 14 commits into
diffblue:develop
from
martin-cs:tidy/goto-instrument-options
Dec 1, 2021
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
96306e4
--all is not implemented, not clear that it has a sensible implementa…
27d4ab6
OPT_ and HELP_ macros for the document properties flags
f836466
Add basic "does it run" tests for the --document options
6a18cb1
OPT_ and HELP_ macros for the dump-c flags
033506b
Remove --no-pointer-check from CBMC KNOWNBUG tests
49f44f8
Remove the --no-*-check options from goto-instrument
62c3062
OPT_ and HELP_ macros for the remove options flag
75873b5
Document the XML output option
8c47a4f
OPT_ and HELP_ macros for the uninitialized local variable check flag
8a6ff17
Improve the error messages given by the uninitialized checks
44a1fc9
Add a test for the uninitialized local variable check
6fb3bff
Fix up the include order of local headers
b1c61dc
OPT_ and HELP_ macros for the weak memory model flags
b71a830
Remove the --mm option from goto-diff
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
KNOWNBUG | ||
main.cpp | ||
--no-pointer-check | ||
|
||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
^VERIFICATION SUCCESSFUL$ | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
KNOWNBUG | ||
main.cpp | ||
--unwind 1 --no-pointer-check | ||
--unwind 1 | ||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
^VERIFICATION SUCCESSFUL$ | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
KNOWNBUG | ||
main.cpp | ||
--unwind 1 --no-pointer-check | ||
--unwind 1 | ||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
^VERIFICATION SUCCESSFUL$ | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
KNOWNBUG | ||
main.cpp | ||
--no-pointer-check | ||
|
||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
^VERIFICATION SUCCESSFUL$ | ||
|
10 changes: 10 additions & 0 deletions
10
regression/goto-instrument/document-properties-basic/html.desc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
CORE | ||
main.c | ||
--document-properties-html | ||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
^<em> assert\(1 == 1\);<\/em>$ | ||
-- | ||
^warning: ignoring | ||
-- | ||
Tests whether this option works at all. |
10 changes: 10 additions & 0 deletions
10
regression/goto-instrument/document-properties-basic/latex.desc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
CORE | ||
main.c | ||
--document-properties-latex | ||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
^\\claim\{assertion 1 == 1\}$ | ||
-- | ||
^warning: ignoring | ||
-- | ||
Tests whether this option works at all. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#include <assert.h> | ||
|
||
int main(int argc, char **argv) | ||
{ | ||
assert(1 == 1); | ||
|
||
return 0; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#include <stdlib.h> | ||
|
||
int globals_are_actually_initialized; // See ISO-9899! | ||
|
||
int main(int argc, char **argv) | ||
{ | ||
int definitely_uninitialized; | ||
int maybe_uninitialized; | ||
int actually_initialized; | ||
|
||
if(argc > 1) | ||
{ | ||
maybe_uninitialized = 1; | ||
} | ||
|
||
if(argc <= 3) | ||
{ | ||
actually_initialized = 0; | ||
} | ||
if(argc >= 4) | ||
{ | ||
actually_initialized = 1; | ||
} | ||
|
||
int *heap_variables_uninitialized = malloc(sizeof(int)); | ||
|
||
return definitely_uninitialized + maybe_uninitialized + actually_initialized + | ||
globals_are_actually_initialized + *heap_variables_uninitialized; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
CORE | ||
main.c | ||
--uninitialized-check | ||
^\[main.uninitialized_local.1\] line \d+ use of uninitialized local variable main::1::definitely_uninitialized: FAILURE$ | ||
^\[main.uninitialized_local.2\] line \d+ use of uninitialized local variable main::1::maybe_uninitialized: FAILURE$ | ||
^\[main.uninitialized_local.3\] line \d+ use of uninitialized local variable main::1::actually_initialized: SUCCESS$ | ||
^VERIFICATION FAILED$ | ||
^EXIT=10$ | ||
^SIGNAL=0$ | ||
-- | ||
^warning: ignoring | ||
-- | ||
A basic test of the uninitialized variable check. | ||
In an ideal world there would be a check for heap_variables_uninitialized | ||
that would fail however this is beyond the current scope of the analysis. | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,7 +52,6 @@ Author: Daniel Kroening, [email protected] | |
#include <goto-programs/write_goto_binary.h> | ||
|
||
#include <pointer-analysis/add_failed_symbols.h> | ||
#include <pointer-analysis/goto_program_dereference.h> | ||
#include <pointer-analysis/show_value_sets.h> | ||
#include <pointer-analysis/value_set_analysis.h> | ||
|
||
|
@@ -85,9 +84,7 @@ Author: Daniel Kroening, [email protected] | |
#include "branch.h" | ||
#include "call_sequences.h" | ||
#include "concurrency.h" | ||
#include "document_properties.h" | ||
#include "dot.h" | ||
#include "dump_c.h" | ||
#include "full_slicer.h" | ||
#include "function.h" | ||
#include "havoc_loops.h" | ||
|
@@ -110,11 +107,9 @@ Author: Daniel Kroening, [email protected] | |
#include "stack_depth.h" | ||
#include "thread_instrumentation.h" | ||
#include "undefined_functions.h" | ||
#include "uninitialized.h" | ||
#include "unwind.h" | ||
#include "unwindset.h" | ||
#include "value_set_fi_fp_removal.h" | ||
#include "wmm/weak_memory.h" | ||
|
||
/// invoke main modules | ||
int goto_instrument_parse_optionst::doit() | ||
|
@@ -1722,14 +1717,13 @@ void goto_instrument_parse_optionst::help() | |
" goto-instrument in out perform instrumentation\n" | ||
"\n" | ||
"Main options:\n" | ||
" --document-properties-html generate HTML property documentation\n" | ||
" --document-properties-latex generate Latex property documentation\n" | ||
" --dump-c generate C source\n" | ||
" --dump-c-type-header m generate a C header for types local in m\n" | ||
" --dump-cpp generate C++ source\n" | ||
HELP_DOCUMENT_PROPERTIES | ||
" --dot generate CFG graph in DOT format\n" | ||
" --interpreter do concrete execution\n" | ||
"\n" | ||
"Dump Source:\n" | ||
HELP_DUMP_C | ||
"\n" | ||
"Diagnosis:\n" | ||
" --show-loops show the loops in the program\n" | ||
HELP_SHOW_PROPERTIES | ||
|
@@ -1762,7 +1756,7 @@ void goto_instrument_parse_optionst::help() | |
"Safety checks:\n" | ||
" --no-assertions ignore user assertions\n" | ||
HELP_GOTO_CHECK | ||
" --uninitialized-check add checks for uninitialized locals (experimental)\n" // NOLINT(*) | ||
HELP_UNINITIALIZED_CHECK | ||
" --stack-depth n add check that call stack size of non-inlined functions never exceeds n\n" // NOLINT(*) | ||
" --race-check add floating-point data race checks\n" | ||
"\n" | ||
|
@@ -1780,7 +1774,7 @@ void goto_instrument_parse_optionst::help() | |
" --nondet-static-exclude e same as nondet-static except for the variable e\n" //NOLINT(*) | ||
" (use multiple times if required)\n" | ||
" --check-invariant function instruments invariant checking function\n" | ||
" --remove-pointers converts pointer arithmetic to base+offset expressions\n" // NOLINT(*) | ||
HELP_REMOVE_POINTERS | ||
" --splice-call caller,callee prepends a call to callee in the body of caller\n" // NOLINT(*) | ||
" --undefined-function-is-assume-false\n" | ||
// NOLINTNEXTLINE(whitespace/line_length) | ||
|
@@ -1798,17 +1792,7 @@ void goto_instrument_parse_optionst::help() | |
" --skip-loops <loop-ids> add gotos to skip selected loops during execution\n" // NOLINT(*) | ||
"\n" | ||
"Memory model instrumentations:\n" | ||
" --mm <tso,pso,rmo,power> instruments a weak memory model\n" | ||
" --scc detects critical cycles per SCC (one thread per SCC)\n" // NOLINT(*) | ||
" --one-event-per-cycle only instruments one event per cycle\n" | ||
" --minimum-interference instruments an optimal number of events\n" | ||
" --my-events only instruments events whose ids appear in inst.evt\n" // NOLINT(*) | ||
" --cfg-kill enables symbolic execution used to reduce spurious cycles\n" // NOLINT(*) | ||
" --no-dependencies no dependency analysis\n" | ||
// NOLINTNEXTLINE(whitespace/line_length) | ||
" --no-po-rendering no representation of the threads in the dot\n" | ||
" --render-cluster-file clusterises the dot by files\n" | ||
" --render-cluster-function clusterises the dot by functions\n" | ||
HELP_WMM_FULL | ||
"\n" | ||
"Slicing:\n" | ||
HELP_REACHABILITY_SLICER | ||
|
@@ -1853,11 +1837,9 @@ void goto_instrument_parse_optionst::help() | |
HELP_ENFORCE_CONTRACT | ||
"\n" | ||
"Other options:\n" | ||
" --no-system-headers with --dump-c/--dump-cpp: generate C source expanding libc includes\n" // NOLINT(*) | ||
" --use-all-headers with --dump-c/--dump-cpp: generate C source with all includes\n" // NOLINT(*) | ||
" --harness with --dump-c/--dump-cpp: include input generator in output\n" // NOLINT(*) | ||
" --version show version and exit\n" | ||
HELP_FLUSH | ||
" --xml output files in XML where supported\n" | ||
" --xml-ui use XML-formatted output\n" | ||
" --json-ui use JSON-formatted output\n" | ||
HELP_TIMESTAMP | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,42 +28,37 @@ Author: Daniel Kroening, [email protected] | |
|
||
#include <analyses/goto_check.h> | ||
|
||
#include <pointer-analysis/goto_program_dereference.h> | ||
|
||
#include "aggressive_slicer.h" | ||
#include "contracts/contracts.h" | ||
#include "count_eloc.h" | ||
#include "document_properties.h" | ||
#include "dump_c.h" | ||
#include "generate_function_bodies.h" | ||
#include "insert_final_assert_false.h" | ||
#include "nondet_volatile.h" | ||
#include "replace_calls.h" | ||
|
||
#include "count_eloc.h" | ||
#include "uninitialized.h" | ||
#include "wmm/weak_memory.h" | ||
|
||
// clang-format off | ||
#define GOTO_INSTRUMENT_OPTIONS \ | ||
"(all)" \ | ||
"(document-claims-latex)(document-claims-html)" \ | ||
"(document-properties-latex)(document-properties-html)" \ | ||
"(dump-c-type-header):" \ | ||
"(dump-c)(dump-cpp)(no-system-headers)(use-all-headers)(dot)(xml)" \ | ||
"(harness)" \ | ||
OPT_DOCUMENT_PROPERTIES \ | ||
OPT_DUMP_C \ | ||
"(dot)(xml)" \ | ||
OPT_GOTO_CHECK \ | ||
/* no-X-check are deprecated and ignored */ \ | ||
"(no-bounds-check)(no-pointer-check)(no-div-by-zero-check)" \ | ||
"(no-nan-check)" \ | ||
"(remove-pointers)" \ | ||
OPT_REMOVE_POINTERS \ | ||
"(no-simplify)" \ | ||
"(uninitialized-check)" \ | ||
"(race-check)(scc)(one-event-per-cycle)" \ | ||
"(minimum-interference)" \ | ||
"(mm):(my-events)" \ | ||
OPT_UNINITIALIZED_CHECK \ | ||
OPT_WMM \ | ||
"(race-check)" \ | ||
"(unwind):(unwindset):(unwindset-file):" \ | ||
"(unwinding-assertions)(partial-loops)(continue-as-loops)" \ | ||
"(log):" \ | ||
"(max-var):(max-po-trans):(ignore-arrays)" \ | ||
"(cfg-kill)(no-dependencies)(force-loop-duplication)" \ | ||
"(call-graph)(reachable-call-graph)" \ | ||
OPT_INSERT_FINAL_ASSERT_FALSE \ | ||
OPT_SHOW_CLASS_HIERARCHY \ | ||
"(no-po-rendering)(render-cluster-file)(render-cluster-function)" \ | ||
"(isr):" \ | ||
"(stack-depth):(nondet-static)" \ | ||
"(nondet-static-exclude):" \ | ||
|
@@ -87,7 +82,6 @@ Author: Daniel Kroening, [email protected] | |
"(remove-function-pointers)" \ | ||
"(show-claims)(property):" \ | ||
"(show-symbol-table)(show-points-to)(show-rw-set)" \ | ||
"(cav11)" \ | ||
OPT_TIMESTAMP \ | ||
"(show-natural-loops)(show-lexical-loops)(accelerate)(havoc-loops)" \ | ||
"(string-abstraction)" \ | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to add some documentation in the
docs/
folder for this? I wasn't aware of the difference between--xml
and--xml-ui
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is but...
A. The current state of the
goto-instrument
documentation ( https://github.com/diffblue/cbmc/blob/develop/doc/cprover-manual/goto-instrument.md ), apart from function body generation and contracts is pretty abysmal. I do want to improve it but it is after "tidying up, figuring out and testing" the options on my TODO list.B. I am not sure that it should even be an option or called that. At the moment I am going with preserving functionality but I am also building a set of "I think this would be sensible" changes. As it stands it is a formerly undocumented option that works with only two of the flags. I do wonder if it would make more sense if it followed the same convention as
goto-analyzer
. Or maybe it would be better to move all of the functionality over togoto-analyzer
?