-
Notifications
You must be signed in to change notification settings - Fork 62
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
saw-remote-api: No explanation printed when allocating insufficient memory #1127
Comments
I believe the culprit is the use of saw-script/src/SAWScript/Crucible/LLVM/Builtins.hs Lines 608 to 618 in 0e93b7a
When run with One heavy-handed way to rectify this would be to stuff all of this information into an exception. I hacked together a quick proof of concept: diff --git a/src/SAWScript/Crucible/LLVM/Builtins.hs b/src/SAWScript/Crucible/LLVM/Builtins.hs
index 551efc2d..8b080c40 100644
--- a/src/SAWScript/Crucible/LLVM/Builtins.hs
+++ b/src/SAWScript/Crucible/LLVM/Builtins.hs
@@ -605,17 +605,24 @@ verifyObligations cc mspec tactic assumes asserts =
case r of
Unsat stats -> return stats
SatMulti stats vals ->
- do printOutLnTop Info $ unwords ["Subgoal failed:", nm, msg]
- printOutLnTop Info (show stats)
- printOutLnTop OnlyCounterExamples "----------Counterexample----------"
- opts <- sawPPOpts <$> rwPPOpts <$> getTopLevelRW
- if null vals then
- printOutLnTop OnlyCounterExamples "<<All settings of the symbolic variables constitute a counterexample>>"
- else
- let showAssignment (name, val) = " " ++ name ++ ": " ++ show (ppFirstOrderValue opts val) in
- mapM_ (printOutLnTop OnlyCounterExamples . showAssignment) vals
- printOutLnTop OnlyCounterExamples "----------------------------------"
- throwTopLevel "Proof failed." -- Mirroring behavior of llvm_verify
+ do opts <- sawPPOpts <$> rwPPOpts <$> getTopLevelRW
+ verb <- verbLevel <$> getOptions
+ let errLines = [ (Info, unwords ["Subgoal failed:", nm, msg])
+ , (Info, show stats)
+ , (OnlyCounterExamples, "----------Counterexample----------") ]
+ ++
+ if null vals then
+ [ (OnlyCounterExamples, "<<All settings of the symbolic variables constitute a counterexample>>") ]
+ else
+ let showAssignment (name, val) = " " ++ name ++ ": " ++ show (ppFirstOrderValue opts val) in
+ map (\val -> (OnlyCounterExamples, showAssignment val)) vals
+ ++
+ [ (OnlyCounterExamples, "----------------------------------") ]
+ throwTopLevel $ unlines
+ $ mapMaybe (\(lvl, errLine) ->
+ if verb >= lvl then Just errLine else Nothing)
+ errLines
+ ++ [ "Proof failed." ] -- Mirroring behavior of llvm_verify
printOutLnTop Info $ unwords ["Proof succeeded!", nm]
return (mconcat stats) Here is what the outputs of the Python bindings and
This comes at the downside of losing the timestamp information in front of each of the lines previously passed to |
Please ignore #1127 (comment), as I overlooked the fact that -view(LogResults())
+view(LogResults(verbose_failure=True)) With that, the output becomes quite reasonable:
I suppose there's a debate to be had about what the default settings should be here, but at the very least, this isn't a bug. |
I recently made a mistake when coming up with a specification using the Python bindings to SAW:
The mistake is that I wrote
return spec.alloc(buffer_type(16), alignment = 16, read_only = True)
instead of the commented-out line below it (return spec.alloc(buffer_type(length), alignment = 16, read_only = True)
). However, the error message that was produced did not make this at all obvious:Compare this to an equivalent SAWScript program:
This will actually give somewhat of an explanation as to why it failed:
The text was updated successfully, but these errors were encountered: