-
Notifications
You must be signed in to change notification settings - Fork 274
hide specific variables in the counterexample trace for test-gen-support #605
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
hide specific variables in the counterexample trace for test-gen-support #605
Conversation
src/goto-symex/build_goto_trace.cpp
Outdated
if (expr.id()==ID_symbol) | ||
{ | ||
std::string identifier = expr.get(ID_identifier).c_str(); | ||
if (identifier.find("dynamic_")!=std::string::npos) |
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.
This looks like a hack...
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.
Yes, I also agree that this looks like a hack. I was thinking about alternatives to get rid of this hack. What do you think if we create a new field called "dynamic_object" that is properly set during the convert method call in goto-programs? This might create some additional overhead when we build the respective goto-program.
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.
Looking at the symbol behind that name, you should find #dynamic
to be set in the type of the symbol. See goto-symex/symex_builtin_functions.cpp.
src/goto-symex/build_goto_trace.cpp
Outdated
{ | ||
if (expr.id()==ID_symbol) | ||
{ | ||
std::string identifier = expr.get(ID_identifier).c_str(); |
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.
use id2string
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.
Implemented as suggested.
src/goto-symex/build_goto_trace.cpp
Outdated
else | ||
{ | ||
forall_operands(it, expr) | ||
hide_dynamic_object(*it,goto_trace_step); |
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.
cpplint (more instances)
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.
Implemented as suggested.
0611b0e
to
5ab0933
Compare
Why is this hiding actually necessary? |
@tautschnig: We would like to hide all variable assignments in the counterexample trace related to
I have tried to implement your suggestion as follows:
However, it does not work if we have expressions that contain "dynamic_object[0-9]". For "dynamic_[0-9]_array", it seems to work well. This is the test program that I'm using:
I'm running CBMC as follows:
|
I believe you will need to look up the symbol in the namespace and then look at the symbol's type. Comments like |
Yes, sure. I'll take a look at it. |
@tautschnig: I have tried to look for examples in the source code, but I couldn't find what you have suggested (maybe I have misunderstood it). Is there some chance to point to some particular portion of the CBMC code, where I could look at your suggestion? |
@tautschnig: It seems that expressions like dynamic_object[0-9] and dynamic_[0-9]_array are not in the symbol table. If I understood your comment correctly, I have tried to look for the symbol in the namespace as follows:
However, I'm unable to look further at the symbol's type since the second if-condition is always false. I have also run CBMC with the option ''--show-symbol-table'', but I was unable to find expressions like dynamic_object[0-9] and dynamic_[0-9]_array in the symbol table. |
src/goto-symex/build_goto_trace.cpp
Outdated
s_it2=goto_trace.steps.erase(s_it2)); | ||
|
||
s_it2=goto_trace.steps.erase(s_it2)) | ||
{ }; |
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.
As you are touching this code: I believe this can be rewritten to goto_trace.steps.erase(s_it1, goto_trace.steps.end());
instead of this strange for loop.
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.
Implemented as suggested.
Indeed you wouldn't find them using |
@tautschnig: I have tried to implement your suggestion as:
However, we get this in the trace:
In json format:
|
I am sorry, I had misguided you: you need |
@tautschnig: I still get the same behavior as previously mentioned if I replace "get_object_name" by "get_original_name". Do you have another suggestion? |
- strip <CR> from end of lines in test.pl - tests for test-script do not depend on gcc - Makefile in regression/goto-analyser has the same structure as other test Makefiles - remove tests for empty lines
Would you mind adding |
@tautschnig: yes, sure. Find below the output of expr.pretty() method:
|
Ok, this looks good - there might be a minor omission in your code; the following should work:
|
@tautschnig: I have used get_original_name() for both calls:
|
015b1c2
to
b29b80b
Compare
@tautschnig: many thanks for your support to fix this issue. @peterschrammel: Now I believe we have a proper fix for this issue. Let me know if you have further comments. |
Fix several test problems on Windows
Simply assigning to a temporary symbol of the correct type and amending the type passed to the elaboration of the sub-array seems to suffice to properly initialise a multi-dimensional array.
Correct pretty-printing of code_returnt
The default behaviour of CBMC for the options --show-goto-functions, --show-properties and --cover is to consider all functions. This is particularly annoying for --cover where coverage goals are reported from functions that are trivially unreachable from the entry point. Also, --show-reachable-properties has been introduced in the past to hide such properties. We could change the default behaviour to slicing away everything that is trivially unreachable from the entry point. However, this would require an extra option to be able to view all functions and properties. This commit preserves the default behaviour and enables focussing the output of --show-goto-functions --show-properties and --cover on functions that are not trivially unreachable using --drop-unused-functions.
The same effect can now be achieved by --show-properties --drop-unused-functions
…le-fun-only Cover (and others) for reachable functions only
This commit changes the behahaviour of --no-assertions so that only user assertions are ignored. Built-in assertions can be hidden by the new option --no-built-in-assertions.
skip_classid was always false, so there wasn't any point having it.
gen_nondet_init() is only used once, and is only two lines long, so get rid of it and just put those two lines. This also avoids confusion with java_object_factory::gen_nondet_init().
Do not slice away array_copy expressions during the implicit call in the full-slicert class. We do not process array_copy in value_set_fit.
…ay_copy added two test cases related to array copy in the goto-instrument regression suite to further test the full-slice option
consider array_copy expressions in the full-slice
Fix multinewarray
Updates to compiling instructions for GCC 6
…-object-factory Cleanup/java object factory
…-user-only No-assertions should not affect assertions in built-ins
hide variable assignments related to dynamic_object[0-9], dynamic_[0-9]_array, and CPROVER internal functions (e.g., __CPROVER_initialize). This PR is related to test-gen-support issue diffblue#20
b29b80b
to
0feaaef
Compare
Due to several merge conflicts, I have created a new PR to address this issue: #709 |
…-webgoat SEC-608: Add extra rule for StringBuilder::append(String)
hide variable assignments related to dynamic_object[0-9],
dynamic_[0-9]_array, and CPROVER internal functions
(e.g., __CPROVER_initialize). This PR is related to
test-gen-support issue https://github.com/diffblue/test-gen/issues/20