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

Call stacks #995

Merged
merged 27 commits into from
Dec 9, 2020
Merged

Call stacks #995

merged 27 commits into from
Dec 9, 2020

Conversation

robdockins
Copy link
Contributor

Builds on PR #985

This PR adds call stack handling to the interpreter, and prints backtraces when evaluation errors occur. Getting this to work is a bit fiddly, but this seems to be operating more or less the way I expect.

into the typechecked AST.  This should eventually allow
us to emit more useful error messages for runtime errors.
for primitives that is evaluated to values when a primitive is looked up
at evaluation time.  Currently, this does not add any additional capabilities,
but gives us the ability to modify the representation of values
without touching all the primitive definitions, and gives us a place to
hook in additional capabilies to the primitives.

As part of this refactoring, the primitives that are defined totally
generically are moved to the `Cryptol.Eval.Generic` module and
used uniformly in all the backends.
This turns out to be surprisingly involved!  Every evaluation
helper and primitive that can raise a runtime error requires
knowledge of it's current source location, and we need to
rearrange slightly how variable lookups work so we can track
the source location of the calling context for primitives,
rather than just the location where the primitive was declared.
inputs.  Error messages now properly locate subexpressions
inside batch interaction files, and line numbers count up
on succesive REPL inputs.
the expression concretely with the computed inputs to find
and print the actual concrete error generated by the counterexample.
This allows us to print call stacks in addition to just
the source location on program errors.
source location and call stack tracking.  Computing call stacks,
in particular, can add pretty significant interpreter overheads.
The tuple approach was starting to become unwieldly.
@robdockins robdockins marked this pull request as ready for review December 9, 2020 18:17
else concat <$> (forM xs $ \x ->
then rPutStrLn "There are no properties in scope."
else forM_ xs $ \x ->
-- TOOD, this is pretty bogus. Should find a way to do
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note to self: should open a ticket about this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually, I think #639 is caused by this. We just take the name of the property and parse it in the current scope, which might fail.

@robdockins robdockins merged commit 49d60aa into master Dec 9, 2020
brianhuffman pushed a commit to GaloisInc/saw-core that referenced this pull request Jan 28, 2021
brianhuffman pushed a commit to GaloisInc/saw-script that referenced this pull request Jan 28, 2021
brianhuffman pushed a commit to GaloisInc/saw-script that referenced this pull request Jan 28, 2021
brianhuffman pushed a commit to GaloisInc/saw-script that referenced this pull request Jan 28, 2021
@RyanGlScott RyanGlScott deleted the call-stack branch March 22, 2024 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant