Skip to content

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
wants to merge 3 commits into from

Conversation

tautschnig
Copy link
Collaborator

None of this is my work - these are commits already merged into develop (test-gen-support).

lucasccordeiro and others added 3 commits August 22, 2017 16:01
…est-gen-support

set internal for variable assignments related to dynamic_object[0-9],
dynamic_[0-9]_array, _start function-return step, and CPROVER
internal functions (e.g., __CPROVER_initialize). This PR fixes
diffblue/test-gen#20.
Added internal field to json output so that we set it to tru
as we find some specific variable that is not supposed to be
shown in the counterexample trace.
Fixes issue https://github.com/diffblue/test-gen/issues/334. The patch
avoids marking any steps in _start whose source is a
code_function_callt, which includes the main function call and its
argument assignments. Internal function calls in _start (e.g.
__CPROVER_initialize) are marked by previous checks. Includes a minimal
test case from https://github.com/DiffBlue-benchmarks/java-test which
sparked the issue.
Copy link
Contributor

@pkesseli pkesseli left a comment

Choose a reason for hiding this comment

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

I added the function call check on 163 to 170 and the regression test. Both look good.

if(SSA_step.is_function_call())
{
if(SSA_step.source.pc->source_location.as_string().empty())
goto_trace_step.internal=true;
Copy link
Contributor

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?

if(goto_trace_step.type==goto_trace_stept::typet::OUTPUT ||
goto_trace_step.type==goto_trace_stept::typet::INPUT)
{
goto_trace_step.internal=true;
Copy link
Contributor

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?

Copy link
Contributor

@pkesseli pkesseli left a comment

Choose a reason for hiding this comment

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

I added the function call check on 163 to 170 and the regression test. Both look good.

Copy link
Contributor

@lucasccordeiro lucasccordeiro left a comment

Choose a reason for hiding this comment

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

LGTM

@tautschnig tautschnig changed the title [develop->master] hide internal symbols in the goto trace hide internal symbols in the goto trace Sep 2, 2017
@tautschnig
Copy link
Collaborator Author

tautschnig commented Sep 2, 2017

To be honest, I'm failing to understand what these commits are trying to achieve. There may be a clue in https://github.com/diffblue/test-gen/issues/20, but it's not public so I can't tell.

If it helps, #709 is the main original PR, but it doesn't have much of a discussion. My main question is: how is "internal" different from "hidden"? @lucasccordeiro @peterschrammel @pkesseli any insights? Thanks!

As a side note: I would have additional cleanup ready to go, following @pkesseli's suggestions. But doing this work made me wonder what's actually going on here.

Another note: this is blocking a series of further PRs to go into master.

@kroening
Copy link
Member

kroening commented Sep 3, 2017

The management of 'hiding steps' on the trace appears to be way to late to me. This PR seems to be a hack to me.

@lucasccordeiro
Copy link
Contributor

The UI team requested us to hide the dynamic_object and CPROVER internal functions (e.g., __CPROVER_initialize) from the CBMC counterexample. In order to keep compatibility, we decided to add the internal field to the JSON output so that the dynamic_object and CPROVER internal functions could be easily hidden in the UI application.

@tautschnig
Copy link
Collaborator Author

Thanks a lot for the input. I do not have sufficient state on customers to tell whether anyone does depend on those bits not being hidden and thus call out to @kroening for clarification. One of two things need to happen: either this feature needs to be documented properly to make clear what is "hidden" vs what is "internal", or "internal" should be removed and those bits simply be "hidden." Assigning to @kroening to request guidance.

@peterschrammel
Copy link
Member

See also #1311

@peterschrammel
Copy link
Member

peterschrammel commented Sep 4, 2017

I investigated this further:

Current sources of hidden:

  • goto_functionst::type has a hidden attribute that is set if the function contains a __CPROVER_hide label
  • symbols with #return_value! (sic) suffixes are hidden in symex_assign
  • assignment steps with source locations with hide attribute set are hidden in symex_assign (but this seems to be used only in goto_inline where the code setting it is deactivated)
  • declaration steps are set hidden if the identifier symbol is_auxiliary

Current uses of hidden:

  • hidden steps are hidden in show_goto_trace in the plain text output
  • hidden steps are hidden in graphml output.
  • hidden are not instrumented in cover

The purpose of hidden is to hide steps in the trace,
whereas the purpose of internalis to label all lhs symbols that are not known to occur in the user's program. The two notions do not coincide for dynamic objects, for example.

@kroening
Copy link
Member

kroening commented Sep 4, 2017

Ok, so "internal" is a property of a variable symbol, and not a property of a program step.

Would it not be better to have a namespace for the internal symbols?

Or we may wish to output a symbol table with the trace?

@kroening kroening removed their assignment Sep 7, 2017
@tautschnig
Copy link
Collaborator Author

@peterschrammel Would you be able to take a lead on this issue? This seems to be one that needs careful consideration within Diffblue. (And it is one of the blockers for progress on the develop->master transition.)

@peterschrammel
Copy link
Member

@tautschnig, yes.

@peterschrammel
Copy link
Member

peterschrammel commented Oct 23, 2017

@kroening, yes, it's true that internal is a property of a symbol rather than a step.
Yet, the symbols we have to know about are exactly those occurring in lhs of assignments in the trace (not everything in the symbol table). Therefore it seemed more appropriate to attach the information to the trace steps.

We could output a list of non-internal symbols if this is less contentious.

@tautschnig
Copy link
Collaborator Author

Had some further out-of-band discussion with @peterschrammel on this. Taking this onto my stack of tasks in order to clean it up/take it further.

@tautschnig
Copy link
Collaborator Author

While the develop->master transition might not happen as originally planned, this PR still includes a significant discussion about "internal" symbols. To be resolved by @peterschrammel and myself.

@NlightNFotis
Copy link
Contributor

Hi @tautschnig, is that still something we want to push through?

This looks in a relatively good state (no merge conflicts and approved by other contributors) but it will need some work still (it adds a file to regression/cbmc-java that no longer appears to be there (I'm assuming it's under jbmc/ somewhere).

@NlightNFotis
Copy link
Contributor

Also, I just noticed - this is merging to master, not develop.

Is that still something we want?

@martin-cs
Copy link
Collaborator

@NlightNFotis the PR or the master branch in general. I think both are valid questions but I think the later one probably needs an issue of it's own.

@NlightNFotis
Copy link
Contributor

@martin-cs I'm talking about both.

  1. Do we want to go through with the PR in general? Is this adding value? It looks in a better state than most other old PRs, but I realised that's probably because it's targeting master which hasn't seen action in months (probably years) so that's why there's probably no conflicts.
  2. Should we even be targeting master with PRs? My understanding is that we are using develop as our master (sort of) and any merge to master should be using develop as the source. Is that a fair statement?

By the way I looked into the code changes a bit, and they appear to be replicated in develop in any case, so maybe this PR is wholly obsolete?

@martin-cs
Copy link
Collaborator

  1. I think having some way to hide purely internal things in the traces is useful, esp. as they are getting larger. As the discussion says, it would be best to have 1 way of doing this, not lots.

  2. I wasn't at the meeting where the master / develop split was proposed but my understanding is that the original idea was that develop would move faster and things would be cherry-picked across to master when they were of sufficient quality. Releases would then be from master. I think. master has stagnated so much and releases are now from develop so ... I don't really see there being much point in having the master branch at all.

The comment at the top does suggest it is already in develop. I guess this might have been part of the "feeding changes back from develop to master" process. Maybe @tautschnig knows?

@peterschrammel
Copy link
Member

There was once a plan to merge releases from develop into master so that the head of master is always the last (stable) release version, but we never really started doing that and created releases from develop instead. Atm the master branch is completely stale, so merging PRs into it is pointless.

@peterschrammel
Copy link
Member

Based on #1272 (comment), #1272 (comment) and #1272 (comment) the management of hiding steps needs a complete overhaul.

@TGWDB
Copy link
Contributor

TGWDB commented Aug 5, 2021

Based on #1272 (comment), #1272 (comment) and #1272 (comment) the management of hiding steps needs a complete overhaul.

Based on this and the general concerns with this PR I'm closing it. While this does not resolve the question of hiding some internal symbols in the trace, since this PR is out of date, badly targeted, and not doing the hiding right anyway, it seems pointless to keep it open. Please create a new PR with a better approach (or create an RFC if you wish to discuss) for addressing the underlying problem in future. (Note that this PR can still be observed/referenced, closing only since it is not going to be merged/continued in it's current state.)

@TGWDB TGWDB closed this Aug 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants