-
Notifications
You must be signed in to change notification settings - Fork 123
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
Call stacks #995
Conversation
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.
primitives. We rely on the tracked call stack information instead.
counterexamples/models are not avalaible.
0bca85e
to
bdfefd5
Compare
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.
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 |
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.
Note to self: should open a ticket about this
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.
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.
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.