Skip to content

Commit

Permalink
Merge pull request #280 from GaloisInc/vr/bump-macaw-and-show-block-o…
Browse files Browse the repository at this point in the history
…rigin

bump macaw and show block origin
  • Loading branch information
Ptival authored Aug 11, 2023
2 parents 51669c4 + 12f722a commit 0b4106d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
15 changes: 13 additions & 2 deletions src/Reopt.hs
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ import Data.Vector qualified as V
import Data.Word (Word16, Word32, Word64)
import Flexdis86 qualified as F
import Numeric (showHex)
import Prettyprinter qualified as PP
import Reopt.ArgResolver (
ArgResolver,
ArgResolverError (UnsupportedArgType, UnsupportedReturnType),
Expand Down Expand Up @@ -632,6 +633,7 @@ checkBlockError b = do

-- | Prepend discovery event to list of reopt log evnts.
logDiscEventAsReoptEvents ::
MemWidth (Macaw.ArchAddrWidth arch) =>
(Events.ReoptLogEvent arch -> IO ()) ->
Macaw.AddrSymMap (Macaw.ArchAddrWidth arch) ->
Macaw.DiscoveryEvent arch ->
Expand All @@ -656,11 +658,20 @@ logDiscEventAsReoptEvents logger symMap evt = do
(Events.ppFnEntry (Map.lookup tgt symMap) tgt)
(Macaw.ppFunReason rsn)
logger $ Events.ReoptFunStepLog Events.Discovery (mkFunId a) msg
Macaw.ReportAnalyzeBlock fa b -> do
let msg = printf "Discovered block %s." (Events.ppSegOff b)
Macaw.ReportAnalyzeBlock fa b mReason -> do
let msg = case mReason of
Nothing -> printf "Examining block %s." (Events.ppSegOff b)
Just (Macaw.SplitAt o _prior) ->
show $
"Re-examining block"
PP.<+> PP.pretty (Events.ppSegOff b)
PP.<+> "after it was split at offset"
PP.<+> PP.pretty o PP.<> "."
Just reason -> printf "Examining block %s (%s)." (Events.ppSegOff b) (show (PP.pretty reason))
logger $ Events.ReoptFunStepLog Events.Discovery (mkFunId fa) msg

reoptRunDiscovery ::
MemWidth (Macaw.ArchAddrWidth arch) =>
Macaw.AddrSymMap (Macaw.ArchAddrWidth arch) ->
IncCompM (Macaw.DiscoveryEvent arch) a a ->
ReoptM arch r a
Expand Down

0 comments on commit 0b4106d

Please sign in to comment.