-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #939 from langston-barrett/lb/malformed-llvm-module
uc-crux-llvm: Improve error handling in cases of a malformed LLVM module
- Loading branch information
Showing
10 changed files
with
159 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
uc-crux-llvm/src/UCCrux/LLVM/Errors/MalformedLLVMModule.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
{- | ||
Module : UCCrux.LLVM.Errors.MalformedLLVMModule | ||
Description : Problems with the (our assumptions about) the input program(s) | ||
Copyright : (c) Galois, Inc 2021 | ||
License : BSD3 | ||
Maintainer : Langston Barrett <[email protected]> | ||
Stability : provisional | ||
-} | ||
|
||
module UCCrux.LLVM.Errors.MalformedLLVMModule | ||
( malformedLLVMModule, | ||
) | ||
where | ||
|
||
{- ORMOLU_DISABLE -} | ||
import Data.Void (Void) | ||
import GHC.Stack (HasCallStack, prettyCallStack, callStack) | ||
|
||
import Prettyprinter (Doc, pretty) | ||
|
||
import qualified Lang.Crucible.LLVM.MalformedLLVMModule as M | ||
{- ORMOLU_ENABLE -} | ||
|
||
-- | Throw a 'Lang.Crucible.LLVM.MalformedLLVMModule.MalformedLLVMModule' | ||
-- exception. | ||
malformedLLVMModule :: | ||
HasCallStack => | ||
-- | Short explanation | ||
Doc Void -> | ||
-- | Details | ||
[Doc Void] -> | ||
a | ||
malformedLLVMModule short details = | ||
M.malformedLLVMModule short $ | ||
concat | ||
[ [ pretty "Call stack:" | ||
, pretty (prettyCallStack callStack) | ||
] | ||
, details | ||
, map | ||
pretty | ||
[ "This is either a bug in the compiler that produced the LLVM module", | ||
"or in UC-Crux's assumptions about the form of valid LLVM modules.", | ||
"Try running `opt -disable-output -verify < your-module.bc`.", | ||
"If opt reports no problems, please report this error here:", | ||
"https://github.com/GaloisInc/crucible/issues" | ||
] | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.