Skip to content
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

formatting of debug output of traces #2182

Merged
merged 1 commit into from
May 14, 2018
Merged

formatting of debug output of traces #2182

merged 1 commit into from
May 14, 2018

Conversation

kroening
Copy link
Member

This does minor tweaks to the debug output of goto_traces; in particular, this now uses format().

@@ -149,6 +134,10 @@ std::string trace_value_binary(
if(!to_integer(expr, i) && i>=0)
return integer2string(i, 2);
}
else if(type.id()==ID_string)
{
return integer2string(expr.get(ID_value).get_no(), 2);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't work with USE_STD_STRING enabled: https://travis-ci.org/diffblue/cbmc/jobs/378446491#L1421

Copy link
Contributor

@smowton smowton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One question, plus should we be outputting something generic but useful for the other instruction types instead of just printing "SHARED_WRITE" by itself?


out << "\n";
out << pc->type << '\n';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this one changed but the switch statement at the top of this method isn't?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Switching over something different!

@@ -104,14 +104,18 @@ class goto_trace_stept
// for assert
std::string comment;

// the object being assigned
// The object being assigned.
// This will get removed, use full_lhs instead.
ssa_exprt lhs_object;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is blocking immediate removal?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are still being output to the XML output, and I am unsure whether there are still any users of this. I have been warning about this for ~3 years.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The motivation for removal is that the full object may be huge (think of a large array of a big struct). Various users have raised the sheer size of the XMLs as a concern.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The introduced comment suggests that there equivalent replacements. If that isn't the case (which is what your comments here suggest), then the comment needs to be fixed.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are equivalent in the sense that you can reconstruct the lhs_object value from the full_lhs values; same for lhs_object and lhs.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So ... that should be done?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, will drop this commit, and will do a separate PR for the removal.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes a lot of sense, thanks!

if(!comment.empty())
out << " " << comment << '\n';

out << " " << format(pc->guard) << '\n';
Copy link
Collaborator

@tautschnig tautschnig May 14, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not convinced there is value in making the debug output language-independent when the plain-text user-directed output is and should remain language-specific? Clarified by @peterschrammel's comment.

@peterschrammel
Copy link
Member

I think that we should make a clear distinction between output that is GOTO and output that is language-specific. We are sometimes a bit fooled by the similarity of GOTO and C, but for Java this is no more the case and language-specific output is indeed required by downstream tools. This mostly concerns the structured (JSON, XML) outputs of goto traces. (Non-front-end) debug output should always be GOTO. For all other output functions, we should provide them with a formatter function supplied by the driver program, as @kroening suggests. The driver program can then decide whether to call format() or a language-specific version of it. Hard-coded calls to from_expr/format should be replaced by that.

@kroening
Copy link
Member Author

To add, some of the "debug output" methods could likely be replaced by a "generic output" method that then gets given format_expr as the formatter. On the side, we will eventually need a uniform name for a "debug output" method.

@kroening kroening merged commit da61186 into develop May 14, 2018
@kroening kroening deleted the trace-debug branch May 14, 2018 13:23
NathanJPhillips pushed a commit to NathanJPhillips/cbmc that referenced this pull request Aug 22, 2018
da61186 Merge pull request diffblue#2182 from diffblue/trace-debug
5acf313 Merge pull request diffblue#2176 from mgudemann/fix/glucose_build_g++
e82dca0 formatting of debug output of traces
f891f37 Merge pull request diffblue#2168 from JohnDumbell/bugfix/phi_merge_uninitialized
6faf376 Enable 'm' flag on regex for multi-line tests
646cf29 Add nondet assignment to non-zero'd allocations in symex
213db5f Remove trailing `;` from namespace closing bracket

git-subtree-dir: cbmc
git-subtree-split: da61186
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants