-
Notifications
You must be signed in to change notification settings - Fork 273
hide internal symbols in the goto trace #1272
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
Closed
Closed
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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
Binary file added
BIN
+350 Bytes
regression/cbmc-java/internal1/com/diffblue/javatest/nestedobjects/subpackage/Item.class
Binary file not shown.
5 changes: 5 additions & 0 deletions
5
regression/cbmc-java/internal1/com/diffblue/javatest/nestedobjects/subpackage/Item.java
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,5 @@ | ||
package com.diffblue.javatest.nestedobjects.subpackage; | ||
|
||
public class Item { | ||
public int cost; | ||
} |
Binary file added
BIN
+719 Bytes
regression/cbmc-java/internal1/com/diffblue/javatest/nestedobjects/subpackage/Order.class
Binary file not shown.
25 changes: 25 additions & 0 deletions
25
regression/cbmc-java/internal1/com/diffblue/javatest/nestedobjects/subpackage/Order.java
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,25 @@ | ||
package com.diffblue.javatest.nestedobjects.subpackage; | ||
|
||
public class Order { | ||
public Item item; | ||
|
||
/** | ||
* Checks if this order has an item. | ||
*/ | ||
public boolean hasItem() { | ||
if (item == null) { | ||
return false; | ||
} else { | ||
return true; | ||
} | ||
} | ||
|
||
/** | ||
* Sets the item for this order. | ||
*/ | ||
public boolean setItem(Item item) { | ||
boolean exists = hasItem(); | ||
this.item = item; | ||
return exists; | ||
} | ||
} |
2 changes: 2 additions & 0 deletions
2
regression/cbmc-java/internal1/com/diffblue/javatest/nestedobjects/subpackage/readme.txt
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,2 @@ | ||
Source of benchmark: | ||
https://github.com/DiffBlue-benchmarks/java-test |
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,13 @@ | ||
CORE | ||
com/diffblue/javatest/nestedobjects/subpackage/Order.class | ||
--json-ui --function 'com.diffblue.javatest.nestedobjects.subpackage.Order.setItem:(Lcom/diffblue/javatest/nestedobjects/subpackage/Item;)Z' --cover location --trace | ||
activate-multi-line-match | ||
EXIT=0 | ||
SIGNAL=0 | ||
"identifier": "__CPROVER_initialize",\n *"sourceLocation": [{][}]\n *[}],\n *"hidden": false,\n *"internal": true,\n *"stepType": "function-call", | ||
"internal": true,\n *"lhs": "tmp_object_factory[$][0-9]+", | ||
"internal": false,\n *"sourceLocation": [{]\n *"file": "com/diffblue/javatest/nestedobjects/subpackage/Order.java",\n *"function": "java::com.diffblue.javatest.nestedobjects.subpackage.Order.setItem:[(]Lcom/diffblue/javatest/nestedobjects/subpackage/Item;[)]Z",\n *"line": "21"\n *[}],\n *"stepType": "function-call", | ||
"internal": false,\n *"lhs": "this",\n *"mode": "java",\n *"sourceLocation": [{]\n *"file": "com/diffblue/javatest/nestedobjects/subpackage/Order.java",\n *"function": "java::com.diffblue.javatest.nestedobjects.subpackage.Order.setItem:[(]Lcom/diffblue/javatest/nestedobjects/subpackage/Item;[)]Z", | ||
"internal": false,\n *"lhs": "item",\n *"mode": "java",\n *"sourceLocation": [{]\n *"file": "com/diffblue/javatest/nestedobjects/subpackage/Order.java",\n *"function": "java::com.diffblue.javatest.nestedobjects.subpackage.Order.setItem:[(]Lcom/diffblue/javatest/nestedobjects/subpackage/Item;[)]Z", | ||
-- | ||
^warning: ignoring |
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 |
---|---|---|
|
@@ -109,6 +109,67 @@ exprt adjust_lhs_object( | |
return nil_exprt(); | ||
} | ||
|
||
/// set internal field for variable assignment related to dynamic_object[0-9] | ||
/// and dynamic_[0-9]_array. | ||
void set_internal_dynamic_object( | ||
const exprt &expr, | ||
goto_trace_stept &goto_trace_step, | ||
const namespacet &ns) | ||
{ | ||
if(expr.id()==ID_symbol) | ||
{ | ||
const irep_idt &id=to_ssa_expr(expr).get_original_name(); | ||
const symbolt *symbol; | ||
if(!ns.lookup(id, symbol)) | ||
{ | ||
bool result=symbol->type.get_bool("#dynamic"); | ||
if(result) | ||
goto_trace_step.internal=true; | ||
} | ||
} | ||
else | ||
{ | ||
forall_operands(it, expr) | ||
set_internal_dynamic_object(*it, goto_trace_step, ns); | ||
} | ||
} | ||
|
||
/// set internal for variables assignments related to dynamic_object and CPROVER | ||
/// internal functions (e.g., __CPROVER_initialize) | ||
void update_internal_field( | ||
const symex_target_equationt::SSA_stept &SSA_step, | ||
goto_trace_stept &goto_trace_step, | ||
const namespacet &ns) | ||
{ | ||
// set internal for dynamic_object in both lhs and rhs expressions | ||
set_internal_dynamic_object(SSA_step.ssa_lhs, goto_trace_step, ns); | ||
set_internal_dynamic_object(SSA_step.ssa_rhs, goto_trace_step, ns); | ||
|
||
// set internal field to CPROVER functions (e.g., __CPROVER_initialize) | ||
if(SSA_step.is_function_call()) | ||
{ | ||
if(SSA_step.source.pc->source_location.as_string().empty()) | ||
goto_trace_step.internal=true; | ||
} | ||
|
||
// set internal field to input and output steps | ||
if(goto_trace_step.type==goto_trace_stept::typet::OUTPUT || | ||
goto_trace_step.type==goto_trace_stept::typet::INPUT) | ||
{ | ||
goto_trace_step.internal=true; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps |
||
} | ||
|
||
// set internal field to _start function-return step | ||
if(SSA_step.source.pc->function==goto_functionst::entry_point()) | ||
{ | ||
// "__CPROVER_*" function calls in __CPROVER_start are already marked as | ||
// internal. Don't mark any other function calls (i.e. "main"), function | ||
// arguments or any other parts of a code_function_callt as internal. | ||
if(SSA_step.source.pc->code.get_statement()!=ID_function_call) | ||
goto_trace_step.internal=true; | ||
} | ||
} | ||
|
||
void build_goto_trace( | ||
const symex_target_equationt &target, | ||
symex_target_equationt::SSA_stepst::const_iterator end_step, | ||
|
@@ -216,6 +277,9 @@ void build_goto_trace( | |
goto_trace_step.formatted=SSA_step.formatted; | ||
goto_trace_step.identifier=SSA_step.identifier; | ||
|
||
// update internal field for specific variables in the counterexample | ||
update_internal_field(SSA_step, goto_trace_step, ns); | ||
|
||
goto_trace_step.assignment_type= | ||
(it->is_assignment()&& | ||
(SSA_step.assignment_type== | ||
|
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.
Perhaps
return
after setting internal to true?