-
Notifications
You must be signed in to change notification settings - Fork 273
Hidden attribute for malloc is inconsistent in traces #5413
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
Comments
If you look here you’ll note it’s actually the entire body of |
I saw that instance of This is a real problem for me, because it makes it impossible to balance (in a principled way) function calls and returns in my representations of error traces. But it also doesn't explain the visibility of the malloc steps that I elided in my initial example. If I take the program
then the error trace includes
So the call and the assignments to .a and .b are visible and the return is hidden. The internal steps are not hidden. This is actually the visibility I want to see in an error trace, because I want to see the values assigned to struct members in the error trace. I just need the function return to be visible, too. |
So I have a small test like this:
And in the trace I get
If I remove the Which is in line with what I expect here, although I understand it’s not really what you want in this case. For clarification, what is the problem we are trying to solve? If it is just the attribute being set in the XML this could be fixed in post processing, I’m guessing though this isn’t why this is causing troubles for you? We could easily ‘fix’ this by making sure that returns don’t get marked as hidden in the standard library, or just have a general preprocessing rule unsetting the hidden flag from returns when we see it, I just want to make sure that’d actually solve your problem (and I’d like to hear from @peterschrammel, @martin-cs or @kroening if they can think of any reasons why doing so might cause other problems) before doing this. |
^- for clarification on the above questions: What I’m asking is, when are you expecting hidden to be set on calls and returns? I got the impression you are expecting returns to be visible or hidden whenever the corresponding function call is, is that correct? |
@hannes-steffenhagen-diffblue some historical context... I think its purpose is to omit the details modelling of the standard library from the traces. The traces are / were supposed to be human readable and just like you generally want your debugger to skip the internals of how malloc works, so the trace will omit the behaviour of our standard library 'implementation'. Is this a useful feature : probably because why should people need to know how our models work. Is My expectation is that it omits from the trace all steps from when it is called to the end of the function (including any function calls, not 100% sure about assertions). I think the caller should still have the call, return and assignment of return value. You might also want to look at #1272, to quote @tautschnig |
This is internally tracked as ADA-575 |
I’m closing this for now as it’s not obvious that there is anything that needs to be changed here, other than noting that the behaviour of internal flags can be a bit confusing to end users and should be better documented. |
CBMC version: 5.12.1
Operating system: MacOS
Exact command line resulting in the issue:
What behaviour did you expect:
What happened instead:
In error traces, for the function malloc, the function call is set to visible and the function return is set to hidden.
Can anyone help me debug this?
If I take the program main.c
and run the command
the xml output includes the tags
and
The call is visible and the return is hidden.
Similar incorrect behavior for the built-in function getenv
But surprisingly correct behavior for the built-in function
__builtin_alloca
(the example below is for an invocation of the built-in__builtin_alloca
nested within an invocation of the built-ingetenv
):The hidden attribute of an xml step appears to come from a trace step which appears to come from an ssa step, and the hidden attribute on an ssa step appears to be set in
goto_convert_functionst::hide
. I can't see where the inconsistency would be coming from.The text was updated successfully, but these errors were encountered: