-
Notifications
You must be signed in to change notification settings - Fork 273
User controlled havoc(ing) for memory-snapshot harness #4482
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
Merged
Changes from 1 commit
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
61bcb7c
Refactor and unify harness generator options
petr-bauch 7de08c8
Extract static option helpers into a separate class
petr-bauch 73d27e3
Handle the config specific options in-house
petr-bauch 1e8185c
Reflect the changes on individual generators
petr-bauch 40bd28b
Add a method to get the malloc(ed) size estimate
petr-bauch 93f4ee4
Optionalize the results of querying gdb
petr-bauch a13a86b
Sort the snapshot symbols based on pointer-depth
petr-bauch 02bae9a
Refactor snapshot-harness interface
petr-bauch 22c3b67
Clarify expected types of expressions
petr-bauch f6a8415
Avoid converting to string
petr-bauch 46cc6f3
Clear get_pointer_value
petr-bauch a6bd2a1
Add building temporary object for pointer-to-member
petr-bauch f554219
Handle the dynamically allocated pointers
petr-bauch e0d3e5e
Regression tests for user-control of havoc
petr-bauch 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 |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/******************************************************************\ | ||
|
||
Module: common_harness_generator_options | ||
|
||
Author: Diffblue Ltd. | ||
|
||
\******************************************************************/ | ||
|
||
#ifndef CPROVER_GOTO_HARNESS_COMMON_HARNESS_GENERATOR_OPTIONS_H | ||
#define CPROVER_GOTO_HARNESS_COMMON_HARNESS_GENERATOR_OPTIONS_H | ||
|
||
#define COMMON_HARNESS_GENERATOR_MIN_NULL_TREE_DEPTH_OPT "min-null-tree-depth" | ||
#define COMMON_HARNESS_GENERATOR_MAX_NONDET_TREE_DEPTH_OPT \ | ||
"max-nondet-tree-depth" | ||
#define COMMON_HARNESS_GENERATOR_MIN_ARRAY_SIZE_OPT "min-array-size" | ||
#define COMMON_HARNESS_GENERATOR_MAX_ARRAY_SIZE_OPT "max-array-size" | ||
|
||
// clang-format off | ||
#define COMMON_HARNESS_GENERATOR_OPTIONS \ | ||
"(" COMMON_HARNESS_GENERATOR_MIN_NULL_TREE_DEPTH_OPT "):" \ | ||
"(" COMMON_HARNESS_GENERATOR_MAX_NONDET_TREE_DEPTH_OPT "):" \ | ||
"(" COMMON_HARNESS_GENERATOR_MIN_ARRAY_SIZE_OPT "):" \ | ||
"(" COMMON_HARNESS_GENERATOR_MAX_ARRAY_SIZE_OPT "):" \ | ||
// COMMON_HARNESS_GENERATOR_OPTIONS | ||
|
||
// clang-format on | ||
|
||
// clang-format off | ||
#define COMMON_HARNESS_GENERATOR_HELP \ | ||
"--" COMMON_HARNESS_GENERATOR_MIN_NULL_TREE_DEPTH_OPT \ | ||
" N minimum level at which a pointer can first be NULL\n" \ | ||
" in a recursively nondet initialized struct\n" \ | ||
"--" COMMON_HARNESS_GENERATOR_MAX_NONDET_TREE_DEPTH_OPT \ | ||
" N limit size of nondet (e.g. input) object tree;\n" \ | ||
" at level N pointers are set to null\n" \ | ||
"--" COMMON_HARNESS_GENERATOR_MIN_ARRAY_SIZE_OPT \ | ||
" N minimum size of dynamically created arrays\n" \ | ||
" (default: 1)\n" \ | ||
"--" COMMON_HARNESS_GENERATOR_MAX_ARRAY_SIZE_OPT \ | ||
" N maximum size of dynamically created arrays\n" \ | ||
" (default: 2)\n" \ | ||
// COMMON_HARNESS_GENERATOR_HELP | ||
|
||
// clang-format on | ||
|
||
#endif // CPROVER_GOTO_HARNESS_COMMON_HARNESS_GENERATOR_OPTIONS_H |
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
63 changes: 63 additions & 0 deletions
63
src/goto-harness/memory_snapshot_harness_generator_options.h
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,63 @@ | ||
/******************************************************************\ | ||
|
||
Module: memory_snapshot_harness_generator_options | ||
|
||
Author: Diffblue Ltd. | ||
|
||
\******************************************************************/ | ||
|
||
#ifndef CPROVER_GOTO_HARNESS_MEMORY_SNAPSHOT_HARNESS_GENERATOR_OPTIONS_H | ||
#define CPROVER_GOTO_HARNESS_MEMORY_SNAPSHOT_HARNESS_GENERATOR_OPTIONS_H | ||
|
||
#include "common_harness_generator_options.h" | ||
|
||
#define MEMORY_SNAPSHOT_HARNESS_SNAPSHOT_OPT "memory-snapshot" | ||
#define MEMORY_SNAPSHOT_HARNESS_INITIAL_GOTO_LOC_OPT "initial-goto-location" | ||
#define MEMORY_SNAPSHOT_HARNESS_INITIAL_SOURCE_LOC_OPT "initial-source-location" | ||
#define MEMORY_SNAPSHOT_HARNESS_HAVOC_VARIABLES_OPT "havoc-variables" | ||
#define MEMORY_SNAPSHOT_HARNESS_TREAT_POINTER_AS_ARRAY_OPT "pointer-as-array" | ||
#define MEMORY_SNAPSHOT_HARNESS_ASSOCIATED_ARRAY_SIZE_OPT "size-of-array" | ||
|
||
// clang-format off | ||
#define MEMORY_SNAPSHOT_HARNESS_GENERATOR_OPTIONS \ | ||
"(" MEMORY_SNAPSHOT_HARNESS_SNAPSHOT_OPT "):" \ | ||
"(" MEMORY_SNAPSHOT_HARNESS_INITIAL_GOTO_LOC_OPT "):" \ | ||
"(" MEMORY_SNAPSHOT_HARNESS_INITIAL_SOURCE_LOC_OPT "):" \ | ||
"(" MEMORY_SNAPSHOT_HARNESS_HAVOC_VARIABLES_OPT "):" \ | ||
"(" MEMORY_SNAPSHOT_HARNESS_TREAT_POINTER_AS_ARRAY_OPT "):" \ | ||
"(" MEMORY_SNAPSHOT_HARNESS_ASSOCIATED_ARRAY_SIZE_OPT "):" \ | ||
// MEMORY_SNAPSHOT_HARNESS_GENERATOR_OPTIONS | ||
|
||
// clang-format on | ||
|
||
// clang-format off | ||
#define MEMORY_SNAPSHOT_HARNESS_GENERATOR_HELP \ | ||
"memory snapshot harness generator (--harness-type\n" \ | ||
" initialise-from-memory-snapshot)\n\n" \ | ||
"--" MEMORY_SNAPSHOT_HARNESS_SNAPSHOT_OPT " <file> initialise memory " \ | ||
"from JSON memory snapshot\n" \ | ||
"--" MEMORY_SNAPSHOT_HARNESS_INITIAL_GOTO_LOC_OPT " <func[:<n>]>\n" \ | ||
" use given function and location number as " \ | ||
"entry\n point\n" \ | ||
"--" MEMORY_SNAPSHOT_HARNESS_INITIAL_SOURCE_LOC_OPT " <file:<n>>\n" \ | ||
" use given file name and line number as " \ | ||
"entry\n point\n" \ | ||
"--" MEMORY_SNAPSHOT_HARNESS_HAVOC_VARIABLES_OPT " vars initialise" \ | ||
" variables from `vars' to\n" \ | ||
" non-deterministic values\n" \ | ||
COMMON_HARNESS_GENERATOR_HELP \ | ||
"--" MEMORY_SNAPSHOT_HARNESS_TREAT_POINTER_AS_ARRAY_OPT \ | ||
" p treat the global pointer with the name `p' as\n" \ | ||
" an array\n" \ | ||
"--" MEMORY_SNAPSHOT_HARNESS_ASSOCIATED_ARRAY_SIZE_OPT \ | ||
" array_name:size_name\n" \ | ||
" set the parameter <size_name> to the size" \ | ||
" of\n the array <array_name>\n" \ | ||
" (implies " \ | ||
"-- " MEMORY_SNAPSHOT_HARNESS_TREAT_POINTER_AS_ARRAY_OPT \ | ||
" <array_name>)\n" \ | ||
// MEMORY_SNAPSHOT_HARNESS_GENERATOR_HELP | ||
|
||
// clang-format on | ||
|
||
#endif // CPROVER_GOTO_HARNESS_MEMORY_SNAPSHOT_HARNESS_GENERATOR_OPTIONS_H |
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.
It seems surprising that this option isn't in
common_harness_generator_options.h
?!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.
Sorry, my bad. In fact, it's the other way around. This option is
function-harness
specific and will be renamed.