summaryrefslogtreecommitdiff
path: root/libraries/ghc-heap/tests/TestUtils.hs
diff options
context:
space:
mode:
authorDavid Eichmann <EichmannD@gmail.com>2020-10-13 15:07:15 +0100
committerDavid Eichmann <EichmannD@gmail.com>2020-10-16 16:43:12 +0100
commit9966df61712b6488d13b366265186a7659dd8237 (patch)
tree7188f484a354edaef36a190895d9dd3f855a1672 /libraries/ghc-heap/tests/TestUtils.hs
parentefdb4afa78843a888d6b680ce8e7ac654481186c (diff)
downloadhaskell-wip/ghc-debug.tar.gz
ghc-heap: expose decoding from heap representation and support partial TSO/STACK decodingwip/ghc-debug
Co-authored-by: Sven Tennie <sven.tennie@gmail.com> Co-authored-by: Matthew Pickering <matthewtpickering@gmail.com> Co-authored-by: Ben Gamari <bgamari.foss@gmail.com>
Diffstat (limited to 'libraries/ghc-heap/tests/TestUtils.hs')
-rw-r--r--libraries/ghc-heap/tests/TestUtils.hs14
1 files changed, 14 insertions, 0 deletions
diff --git a/libraries/ghc-heap/tests/TestUtils.hs b/libraries/ghc-heap/tests/TestUtils.hs
new file mode 100644
index 0000000000..702532f645
--- /dev/null
+++ b/libraries/ghc-heap/tests/TestUtils.hs
@@ -0,0 +1,14 @@
+{-# LANGUAGE MagicHash #-}
+module TestUtils where
+
+import Foreign (Ptr)
+import GHC.Exts (Addr#)
+import GHC.Ptr (Ptr(Ptr))
+
+assertEqual :: (Show a, Eq a) => a -> a -> IO ()
+assertEqual a b
+ | a /= b = error (show a ++ " /= " ++ show b)
+ | otherwise = return ()
+
+unpackAddr# :: Ptr () -> Addr#
+unpackAddr# (Ptr addr) = addr