summaryrefslogtreecommitdiff
path: root/libraries/ghc-heap/GHC/Exts/Heap/Closures.hs
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2018-07-16 19:58:31 -0400
committerBen Gamari <ben@smart-cactus.org>2018-07-16 19:59:08 -0400
commit3bdf0d01ff47977830ada30ce85f174098486e23 (patch)
treea7bcd3a6842b1cc793ce990e924d157a408f93f0 /libraries/ghc-heap/GHC/Exts/Heap/Closures.hs
parentc4b8e719effe9b420b1c5cec0194134a44b26823 (diff)
downloadhaskell-3bdf0d01ff47977830ada30ce85f174098486e23.tar.gz
Support the GHCi debugger with -fexternal-interpreter
* All the tests in tests/ghci.debugger now pass with -fexternal-interpreter. These tests are now run with the ghci-ext way in addition to the normal way so we won't break it in the future. * I removed all the unsafeCoerce# calls from RtClosureInspect. Yay! The main changes are: * New messages: GetClosure and Seq. GetClosure is a remote interface to GHC.Exts.Heap.getClosureData, which required Binary instances for various datatypes. Fortunately this wasn't too painful thanks to DeriveGeneric. * No cheating by unsafeCoercing values when printing them. Now we have to turn the Closure representation back into the native representation when printing Int, Float, Double, Integer and Char. Of these, Integer was the most painful - we now have a dependency on integer-gmp due to needing access to the representation. * Fixed a bug in rts/Heap.c - it was bogusly returning stack content as pointers for an AP_STACK closure. Test Plan: * `cd testsuite/tests/ghci.debugger && make` * validate Reviewers: bgamari, patrickdoc, nomeata, angerman, hvr, erikd, goldfire Subscribers: alpmestan, snowleopard, rwbarton, thomie, carter GHC Trac Issues: #13184 Differential Revision: https://phabricator.haskell.org/D4955
Diffstat (limited to 'libraries/ghc-heap/GHC/Exts/Heap/Closures.hs')
-rw-r--r--libraries/ghc-heap/GHC/Exts/Heap/Closures.hs9
1 files changed, 6 insertions, 3 deletions
diff --git a/libraries/ghc-heap/GHC/Exts/Heap/Closures.hs b/libraries/ghc-heap/GHC/Exts/Heap/Closures.hs
index 09a94a0f3f..bdfac8bf8b 100644
--- a/libraries/ghc-heap/GHC/Exts/Heap/Closures.hs
+++ b/libraries/ghc-heap/GHC/Exts/Heap/Closures.hs
@@ -4,6 +4,8 @@
{-# LANGUAGE MagicHash #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE UnliftedFFITypes #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DeriveTraversable #-}
module GHC.Exts.Heap.Closures (
-- * Closures
@@ -35,6 +37,7 @@ import Data.Bits
import Data.Int
import Data.Word
import GHC.Exts
+import GHC.Generics
import Numeric
------------------------------------------------------------------------
@@ -222,7 +225,7 @@ data GenClosure b
-- | A @MutVar#@
| MutVarClosure
{ info :: !StgInfoTable
- , var :: !b -- ^ Pointer to closure
+ , var :: !b -- ^ Pointer to contents
}
-- | An STM blocking queue.
@@ -285,7 +288,7 @@ data GenClosure b
| UnsupportedClosure
{ info :: !StgInfoTable
}
- deriving (Show)
+ deriving (Show, Generic, Functor, Foldable, Traversable)
data PrimType
@@ -296,7 +299,7 @@ data PrimType
| PAddr
| PFloat
| PDouble
- deriving (Eq, Show)
+ deriving (Eq, Show, Generic)
-- | For generic code, this function returns all referenced closures.
allClosures :: GenClosure b -> [b]