From cff49453856d603aca8608f4045d4debd5280376 Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 13 Nov 2024 10:11:59 -0500 Subject: [PATCH] riscv-symbolic: Split 32-bit and 64-bit `dump` CLIs --- .../macaw-riscv-symbolic.cabal | 19 +++++++++++++++++-- .../tools/{Dump.hs => Dump32.hs} | 5 +++-- macaw-riscv-symbolic/tools/Dump64.hs | 19 +++++++++++++++++++ 3 files changed, 39 insertions(+), 4 deletions(-) rename macaw-riscv-symbolic/tools/{Dump.hs => Dump32.hs} (70%) create mode 100644 macaw-riscv-symbolic/tools/Dump64.hs diff --git a/macaw-riscv-symbolic/macaw-riscv-symbolic.cabal b/macaw-riscv-symbolic/macaw-riscv-symbolic.cabal index f11b600c..8c2a149a 100644 --- a/macaw-riscv-symbolic/macaw-riscv-symbolic.cabal +++ b/macaw-riscv-symbolic/macaw-riscv-symbolic.cabal @@ -112,14 +112,29 @@ library Data.Macaw.RISCV.Symbolic.Panic Data.Macaw.RISCV.Symbolic.Repeat -executable macaw-riscv-dump +executable macaw-riscv32-dump hs-source-dirs: tools - main-is: Dump.hs + main-is: Dump32.hs default-language: Haskell2010 ghc-options: -Wall -Wcompat build-depends: base, containers, + grift, + macaw-dump, + macaw-riscv, + macaw-riscv-symbolic, + macaw-symbolic + +executable macaw-riscv64-dump + hs-source-dirs: tools + main-is: Dump64.hs + default-language: Haskell2010 + ghc-options: -Wall -Wcompat + build-depends: + base, + containers, + grift, macaw-dump, macaw-riscv, macaw-riscv-symbolic, diff --git a/macaw-riscv-symbolic/tools/Dump.hs b/macaw-riscv-symbolic/tools/Dump32.hs similarity index 70% rename from macaw-riscv-symbolic/tools/Dump.hs rename to macaw-riscv-symbolic/tools/Dump32.hs index 5987f096..ba25afb6 100644 --- a/macaw-riscv-symbolic/tools/Dump.hs +++ b/macaw-riscv-symbolic/tools/Dump32.hs @@ -8,11 +8,12 @@ import Data.Macaw.RISCV qualified as MR import Data.Macaw.RISCV.Symbolic () import Data.Macaw.Symbolic qualified as MS import Data.Proxy (Proxy(..)) +import GRIFT.Types qualified as G main :: IO () main = do archVals <- - case MS.archVals (Proxy @MR.RISCV) Nothing of + case MS.archVals (Proxy @(MR.RISCV G.RV32GC)) Nothing of Just archVals -> pure archVals Nothing -> error "impossible" - MD.main MR.riscv_info archVals MR.riscvPLTStubInfo + MD.main (MR.riscv_info G.rv32GCRepr) archVals MR.riscvPLTStubInfo diff --git a/macaw-riscv-symbolic/tools/Dump64.hs b/macaw-riscv-symbolic/tools/Dump64.hs new file mode 100644 index 00000000..12c66d3a --- /dev/null +++ b/macaw-riscv-symbolic/tools/Dump64.hs @@ -0,0 +1,19 @@ +{-# LANGUAGE ImportQualifiedPost #-} +{-# LANGUAGE TypeApplications #-} + +module Main (main) where + +import Data.Macaw.Dump qualified as MD +import Data.Macaw.RISCV qualified as MR +import Data.Macaw.RISCV.Symbolic () +import Data.Macaw.Symbolic qualified as MS +import Data.Proxy (Proxy(..)) +import GRIFT.Types qualified as G + +main :: IO () +main = do + archVals <- + case MS.archVals (Proxy @(MR.RISCV G.RV64GC)) Nothing of + Just archVals -> pure archVals + Nothing -> error "impossible" + MD.main (MR.riscv_info G.rv64GCRepr) archVals MR.riscvPLTStubInfo