module GHC.Debug.Client
(
Debuggee
, DebugM
, debuggeeRun
, debuggeeConnect
, debuggeeClose
, withDebuggeeRun
, withDebuggeeConnect
, socketDirectory
, snapshotRun
, run
, runTrace
, runAnalysis
, pause
, fork
, pauseThen
, resume
, pausePoll
, withPause
, version
, gcRoots
, allBlocks
, getSourceInfo
, savedObjects
, precacheBlocks
, dereferenceClosure
, dereferenceToClosurePtr
, addConstrDesc
, dereferenceClosures
, dereferenceStack
, dereferencePapPayload
, dereferenceConDesc
, dereferenceInfoTable
, dereferenceSRT
, Quintraversable(..)
, buildHeapGraph
, multiBuildHeapGraph
, HG.HeapGraph(..)
, HG.HeapGraphEntry(..)
, HG.ppHeapGraph
, traceWrite
, traceMsg
, saveCache
, loadCache
, module GHC.Debug.Types.Closures
, SourceInformation(..)
, RawBlock(..)
, BlockPtr
, StackPtr
, ClosurePtr
, InfoTablePtr
, HG.StackHI
, HG.PapHI
, HG.HeapGraphIndex
) where
import GHC.Debug.Types
import GHC.Debug.Types.Closures
import GHC.Debug.Convention (socketDirectory)
import GHC.Debug.Client.Monad
import GHC.Debug.Client.Query
import qualified GHC.Debug.Types.Graph as HG
import Data.List.NonEmpty (NonEmpty)
import Data.Bitraversable
import Control.Monad
derefFuncM :: HG.DerefFunction DebugM Size
derefFuncM :: DerefFunction DebugM Size
derefFuncM ClosurePtr
c = do
SizedClosure
c' <- ClosurePtr -> DebugM SizedClosure
dereferenceClosure ClosurePtr
c
forall (m :: * -> * -> * -> * -> * -> *) (f :: * -> *) a b c d e g
h i j k.
(Quintraversable m, Applicative f) =>
(a -> f b)
-> (c -> f d)
-> (e -> f g)
-> (h -> f i)
-> (j -> f k)
-> m a c e h j
-> f (m b d g i k)
quintraverse InfoTablePtr -> DebugM SrtPayload
dereferenceSRT PayloadCont -> DebugM PapPayload
dereferencePapPayload InfoTablePtr -> DebugM ConstrDesc
dereferenceConDesc (forall (t :: * -> * -> *) (f :: * -> *) a c b d.
(Bitraversable t, Applicative f) =>
(a -> f c) -> (b -> f d) -> t a b -> f (t c d)
bitraverse InfoTablePtr -> DebugM SrtPayload
dereferenceSRT forall (f :: * -> *) a. Applicative f => a -> f a
pure forall (m :: * -> *) b c a.
Monad m =>
(b -> m c) -> (a -> m b) -> a -> m c
<=< StackCont -> DebugM StackFrames
dereferenceStack) forall (f :: * -> *) a. Applicative f => a -> f a
pure SizedClosure
c'
buildHeapGraph :: Maybe Int -> ClosurePtr -> DebugM (HG.HeapGraph Size)
buildHeapGraph :: Maybe Int -> ClosurePtr -> DebugM (HeapGraph Size)
buildHeapGraph = forall (m :: * -> *) a.
MonadFix m =>
DerefFunction m a -> Maybe Int -> ClosurePtr -> m (HeapGraph a)
HG.buildHeapGraph DerefFunction DebugM Size
derefFuncM
multiBuildHeapGraph :: Maybe Int -> NonEmpty ClosurePtr -> DebugM (HG.HeapGraph Size)
multiBuildHeapGraph :: Maybe Int -> NonEmpty ClosurePtr -> DebugM (HeapGraph Size)
multiBuildHeapGraph = forall (m :: * -> *) a.
MonadFix m =>
DerefFunction m a
-> Maybe Int -> NonEmpty ClosurePtr -> m (HeapGraph a)
HG.multiBuildHeapGraph DerefFunction DebugM Size
derefFuncM
runAnalysis :: DebugM a -> (a -> IO r) -> Debuggee -> IO r
runAnalysis :: forall a r. DebugM a -> (a -> IO r) -> Debuggee -> IO r
runAnalysis DebugM a
a a -> IO r
k Debuggee
e = do
Debuggee -> IO ()
pause Debuggee
e
a
r <- forall a. Debuggee -> DebugM a -> IO a
run Debuggee
e DebugM a
a
Debuggee -> IO ()
resume Debuggee
e
a -> IO r
k a
r