-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Connect to a socket created by ghc-debug-stub and analyse -- the heap of the debuggee program. -- -- Connect to a socket created by ghc-debug-stub and analyse the heap of -- the debuggee program. @package ghc-debug-common @version 0.2.0.0 -- | Data types for representing different pointers and raw information All -- pointers are stored in little-endian to make arithmetic easier. -- -- We have to send and recieve the pointers in big endian though. This -- conversion is dealt with in the Binary instance for ClosurePtr and -- then the other pointers are derived from this instance using -- DerivingVia module GHC.Debug.Types.Ptr newtype InfoTablePtr InfoTablePtr :: Word64 -> InfoTablePtr newtype RawInfoTable RawInfoTable :: ByteString -> RawInfoTable newtype ClosurePtr UntaggedClosurePtr :: Word64 -> ClosurePtr pattern ClosurePtr :: Word64 -> ClosurePtr mkClosurePtr :: Word64 -> ClosurePtr newtype RawClosure RawClosure :: ByteString -> RawClosure rawClosureSize :: RawClosure -> Int getInfoTblPtr :: HasCallStack => RawClosure -> InfoTablePtr applyBlockMask :: ClosurePtr -> BlockPtr applyMBlockMask :: ClosurePtr -> BlockPtr subtractBlockPtr :: ClosurePtr -> BlockPtr -> Word64 -- | Check if the ClosurePtr is block allocated or not TODO: MP: These -- numbers are hard-coded from what mblock_address_space.begin and -- mblock_address_space.end were when I inspected them in gdb. I don't -- know if they are always the same of should be queried from the -- debuggee heapAlloced :: ClosurePtr -> Bool getBlockOffset :: ClosurePtr -> Word64 newtype BlockPtr BlockPtr :: Word64 -> BlockPtr data RawBlock RawBlock :: BlockPtr -> Word16 -> ByteString -> RawBlock isLargeBlock :: RawBlock -> Bool isPinnedBlock :: RawBlock -> Bool rawBlockAddr :: RawBlock -> BlockPtr -- | Invariant: ClosurePtr is within the range of the block The -- RawClosure this returns is actually the tail of the whole -- block, this is fine because the memory for each block is only -- allocated once due to how BS.drop is implemented via pointer -- arithmetic. extractFromBlock :: ClosurePtr -> RawBlock -> RawClosure blockMBlock :: BlockPtr -> Word64 rawBlockSize :: RawBlock -> Int newtype StackPtr StackPtr :: Word64 -> StackPtr newtype RawStack RawStack :: ByteString -> RawStack subtractStackPtr :: StackPtr -> ClosurePtr -> Word64 calculateStackLen :: Word32 -> Word64 -> ClosurePtr -> StackPtr -> Word64 addStackPtr :: StackPtr -> Word64 -> StackPtr rawStackSize :: RawStack -> Int printStack :: RawStack -> String -- | A bitmap that records whether each field of a stack frame is a -- pointer. newtype PtrBitmap PtrBitmap :: Array Int Bool -> PtrBitmap traversePtrBitmap :: Monad m => (Bool -> m a) -> PtrBitmap -> m [a] blockMask :: Word64 mblockMask :: Word64 mblockMaxSize :: Word64 blockMaxSize :: Word64 profiling :: Bool tablesNextToCode :: Bool arrWordsBS :: [Word] -> ByteString prettyPrint :: ByteString -> String printBS :: ByteString -> String instance Data.Hashable.Class.Hashable GHC.Debug.Types.Ptr.ClosurePtr instance GHC.Classes.Eq GHC.Debug.Types.Ptr.ClosurePtr instance Data.Binary.Class.Binary GHC.Debug.Types.Ptr.InfoTablePtr instance GHC.Show.Show GHC.Debug.Types.Ptr.InfoTablePtr instance Data.Hashable.Class.Hashable GHC.Debug.Types.Ptr.InfoTablePtr instance GHC.Classes.Ord GHC.Debug.Types.Ptr.InfoTablePtr instance GHC.Classes.Eq GHC.Debug.Types.Ptr.InfoTablePtr instance Data.Binary.Class.Binary GHC.Debug.Types.Ptr.StackPtr instance GHC.Show.Show GHC.Debug.Types.Ptr.StackPtr instance Data.Hashable.Class.Hashable GHC.Debug.Types.Ptr.StackPtr instance GHC.Classes.Ord GHC.Debug.Types.Ptr.StackPtr instance GHC.Classes.Eq GHC.Debug.Types.Ptr.StackPtr instance GHC.Show.Show GHC.Debug.Types.Ptr.StringPtr instance Data.Binary.Class.Binary GHC.Debug.Types.Ptr.RawInfoTable instance GHC.Show.Show GHC.Debug.Types.Ptr.RawInfoTable instance GHC.Classes.Ord GHC.Debug.Types.Ptr.RawInfoTable instance GHC.Classes.Eq GHC.Debug.Types.Ptr.RawInfoTable instance GHC.Show.Show GHC.Debug.Types.Ptr.RawClosure instance GHC.Classes.Ord GHC.Debug.Types.Ptr.RawClosure instance GHC.Classes.Eq GHC.Debug.Types.Ptr.RawClosure instance GHC.Show.Show GHC.Debug.Types.Ptr.RawStack instance GHC.Classes.Ord GHC.Debug.Types.Ptr.RawStack instance GHC.Classes.Eq GHC.Debug.Types.Ptr.RawStack instance GHC.Show.Show GHC.Debug.Types.Ptr.RawPayload instance GHC.Classes.Ord GHC.Debug.Types.Ptr.RawPayload instance GHC.Classes.Eq GHC.Debug.Types.Ptr.RawPayload instance GHC.Show.Show GHC.Debug.Types.Ptr.BlockPtr instance Data.Binary.Class.Binary GHC.Debug.Types.Ptr.BlockPtr instance Data.Hashable.Class.Hashable GHC.Debug.Types.Ptr.BlockPtr instance GHC.Classes.Ord GHC.Debug.Types.Ptr.BlockPtr instance GHC.Classes.Eq GHC.Debug.Types.Ptr.BlockPtr instance GHC.Show.Show GHC.Debug.Types.Ptr.RawBlock instance GHC.Show.Show GHC.Debug.Types.Ptr.PtrBitmap instance Data.Binary.Class.Binary GHC.Debug.Types.Ptr.PtrBitmap instance Data.Binary.Class.Binary GHC.Debug.Types.Ptr.RawBlock instance Data.Binary.Class.Binary GHC.Debug.Types.Ptr.RawClosure instance Data.Binary.Class.Binary GHC.Debug.Types.Ptr.ClosurePtr instance GHC.Classes.Ord GHC.Debug.Types.Ptr.ClosurePtr instance GHC.Show.Show GHC.Debug.Types.Ptr.ClosurePtr -- | The Haskell representation of a heap closure, the DebugClosure -- type - is quite similar to the one found in the ghc-heap -- package but with some - more type parameters and other changes.. module GHC.Debug.Types.Closures type Closure = DebugClosure PayloadCont ConstrDescCont StackCont ClosurePtr type SizedClosure = DebugClosureWithSize PayloadCont ConstrDescCont StackCont ClosurePtr type SizedClosureC = DebugClosureWithSize PayloadCont ConstrDesc StackCont ClosurePtr -- | This is the representation of a Haskell value on the heap. It reflects -- https://gitlab.haskell.org/ghc/ghc/blob/master/includes/rts/storage/Closures.h -- -- The data type is parametrized by 4 type parameters which correspond to -- different pointer types. -- -- All Heap objects have the same basic layout. A header containing a -- pointer to the info table and a payload with various fields. The -- info field below always refers to the info table pointed to -- by the header. The remaining fields are the payload. -- -- See -- https://gitlab.haskell.org/ghc/ghc/wikis/commentary/rts/storage/heap-objects -- for more information. data DebugClosure pap string s b -- | A data constructor ConstrClosure :: !StgInfoTableWithPtr -> ![b] -> ![Word] -> !string -> DebugClosure pap string s b [info] :: DebugClosure pap string s b -> !StgInfoTableWithPtr -- | Pointer arguments [ptrArgs] :: DebugClosure pap string s b -> ![b] -- | Non-pointer arguments [dataArgs] :: DebugClosure pap string s b -> ![Word] [constrDesc] :: DebugClosure pap string s b -> !string -- | A function FunClosure :: !StgInfoTableWithPtr -> ![b] -> ![Word] -> DebugClosure pap string s b [info] :: DebugClosure pap string s b -> !StgInfoTableWithPtr -- | Pointer arguments [ptrArgs] :: DebugClosure pap string s b -> ![b] -- | Non-pointer arguments [dataArgs] :: DebugClosure pap string s b -> ![Word] -- | A thunk, an expression not obviously in head normal form ThunkClosure :: !StgInfoTableWithPtr -> ![b] -> ![Word] -> DebugClosure pap string s b [info] :: DebugClosure pap string s b -> !StgInfoTableWithPtr -- | Pointer arguments [ptrArgs] :: DebugClosure pap string s b -> ![b] -- | Non-pointer arguments [dataArgs] :: DebugClosure pap string s b -> ![Word] -- | A thunk which performs a simple selection operation SelectorClosure :: !StgInfoTableWithPtr -> !b -> DebugClosure pap string s b [info] :: DebugClosure pap string s b -> !StgInfoTableWithPtr -- | Pointer to the object being selected from [selectee] :: DebugClosure pap string s b -> !b -- | An unsaturated function application PAPClosure :: !StgInfoTableWithPtr -> !HalfWord -> !HalfWord -> !b -> !pap -> DebugClosure pap string s b [info] :: DebugClosure pap string s b -> !StgInfoTableWithPtr -- | Arity of the partial application [arity] :: DebugClosure pap string s b -> !HalfWord -- | Size of the payload in words [n_args] :: DebugClosure pap string s b -> !HalfWord -- | Pointer to a FunClosure [fun] :: DebugClosure pap string s b -> !b -- | Sequence of already applied arguments [pap_payload] :: DebugClosure pap string s b -> !pap -- | A function application APClosure :: !StgInfoTableWithPtr -> !HalfWord -> !HalfWord -> !b -> !pap -> DebugClosure pap string s b [info] :: DebugClosure pap string s b -> !StgInfoTableWithPtr -- | Arity of the partial application [arity] :: DebugClosure pap string s b -> !HalfWord -- | Size of the payload in words [n_args] :: DebugClosure pap string s b -> !HalfWord -- | Pointer to a FunClosure [fun] :: DebugClosure pap string s b -> !b -- | Sequence of already applied arguments [ap_payload] :: DebugClosure pap string s b -> !pap -- | A suspended thunk evaluation APStackClosure :: !StgInfoTableWithPtr -> !Word -> !b -> !s -> DebugClosure pap string s b [info] :: DebugClosure pap string s b -> !StgInfoTableWithPtr [ap_st_size] :: DebugClosure pap string s b -> !Word -- | Pointer to a FunClosure [fun] :: DebugClosure pap string s b -> !b -- | Stack right before suspension [payload] :: DebugClosure pap string s b -> !s -- | A pointer to another closure, introduced when a thunk is updated to -- point at its value IndClosure :: !StgInfoTableWithPtr -> !b -> DebugClosure pap string s b [info] :: DebugClosure pap string s b -> !StgInfoTableWithPtr -- | Target closure [indirectee] :: DebugClosure pap string s b -> !b -- | A byte-code object (BCO) which can be interpreted by GHC's byte-code -- interpreter (e.g. as used by GHCi) BCOClosure :: !StgInfoTableWithPtr -> !b -> !b -> !b -> !HalfWord -> !HalfWord -> ![Word] -> DebugClosure pap string s b [info] :: DebugClosure pap string s b -> !StgInfoTableWithPtr -- | A pointer to an ArrWords of instructions [instrs] :: DebugClosure pap string s b -> !b -- | A pointer to an ArrWords of literals [literals] :: DebugClosure pap string s b -> !b -- | A pointer to an ArrWords of byte code objects [bcoptrs] :: DebugClosure pap string s b -> !b -- | Arity of the partial application [arity] :: DebugClosure pap string s b -> !HalfWord -- | The size of this BCO in words [size] :: DebugClosure pap string s b -> !HalfWord -- | An StgLargeBitmap describing the pointerhood of its args/free vars [bitmap] :: DebugClosure pap string s b -> ![Word] -- | A thunk under evaluation by another thread BlackholeClosure :: !StgInfoTableWithPtr -> !b -> DebugClosure pap string s b [info] :: DebugClosure pap string s b -> !StgInfoTableWithPtr -- | Target closure [indirectee] :: DebugClosure pap string s b -> !b -- | A ByteArray# ArrWordsClosure :: !StgInfoTableWithPtr -> !Word -> ![Word] -> DebugClosure pap string s b [info] :: DebugClosure pap string s b -> !StgInfoTableWithPtr -- | Size of array in bytes [bytes] :: DebugClosure pap string s b -> !Word -- | Array payload [arrWords] :: DebugClosure pap string s b -> ![Word] -- | A MutableByteArray# MutArrClosure :: !StgInfoTableWithPtr -> !Word -> !Word -> ![b] -> DebugClosure pap string s b [info] :: DebugClosure pap string s b -> !StgInfoTableWithPtr -- | Number of pointers [mccPtrs] :: DebugClosure pap string s b -> !Word -- | ?? Closures.h vs ClosureMacros.h [mccSize] :: DebugClosure pap string s b -> !Word -- | Array payload Card table ignored [mccPayload] :: DebugClosure pap string s b -> ![b] -- | A SmallMutableArray# SmallMutArrClosure :: !StgInfoTableWithPtr -> !Word -> ![b] -> DebugClosure pap string s b [info] :: DebugClosure pap string s b -> !StgInfoTableWithPtr -- | Number of pointers [mccPtrs] :: DebugClosure pap string s b -> !Word -- | Array payload Card table ignored [mccPayload] :: DebugClosure pap string s b -> ![b] -- | An MVar#, with a queue of thread state objects blocking on -- them MVarClosure :: !StgInfoTableWithPtr -> !b -> !b -> !b -> DebugClosure pap string s b [info] :: DebugClosure pap string s b -> !StgInfoTableWithPtr -- | Pointer to head of queue [queueHead] :: DebugClosure pap string s b -> !b -- | Pointer to tail of queue [queueTail] :: DebugClosure pap string s b -> !b -- | Pointer to closure [value] :: DebugClosure pap string s b -> !b -- | A MutVar# MutVarClosure :: !StgInfoTableWithPtr -> !b -> DebugClosure pap string s b [info] :: DebugClosure pap string s b -> !StgInfoTableWithPtr -- | Pointer to contents [var] :: DebugClosure pap string s b -> !b -- | An STM blocking queue. BlockingQueueClosure :: !StgInfoTableWithPtr -> !b -> !b -> !b -> !b -> DebugClosure pap string s b [info] :: DebugClosure pap string s b -> !StgInfoTableWithPtr -- | ?? Here so it looks like an IND [link] :: DebugClosure pap string s b -> !b -- | The blackhole closure [blackHole] :: DebugClosure pap string s b -> !b -- | The owning thread state object [owner] :: DebugClosure pap string s b -> !b -- | ?? [queue] :: DebugClosure pap string s b -> !b TSOClosure :: !StgInfoTableWithPtr -> !b -> !b -> !b -> !b -> !b -> !b -> WhatNext -> WhyBlocked -> [TsoFlags] -> Word64 -> Word32 -> Word32 -> Int64 -> Word32 -> Maybe StgTSOProfInfo -> DebugClosure pap string s b [info] :: DebugClosure pap string s b -> !StgInfoTableWithPtr [_link] :: DebugClosure pap string s b -> !b [global_link] :: DebugClosure pap string s b -> !b -- | stackobj from StgTSO [tsoStack] :: DebugClosure pap string s b -> !b [trec] :: DebugClosure pap string s b -> !b [blocked_exceptions] :: DebugClosure pap string s b -> !b [bq] :: DebugClosure pap string s b -> !b [what_next] :: DebugClosure pap string s b -> WhatNext [why_blocked] :: DebugClosure pap string s b -> WhyBlocked [flags] :: DebugClosure pap string s b -> [TsoFlags] [threadId] :: DebugClosure pap string s b -> Word64 [saved_errno] :: DebugClosure pap string s b -> Word32 [dirty] :: DebugClosure pap string s b -> Word32 [alloc_limit] :: DebugClosure pap string s b -> Int64 [tot_stack_size] :: DebugClosure pap string s b -> Word32 [prof] :: DebugClosure pap string s b -> Maybe StgTSOProfInfo StackClosure :: !StgInfoTableWithPtr -> !Word32 -> !Word8 -> !Word8 -> s -> DebugClosure pap string s b [info] :: DebugClosure pap string s b -> !StgInfoTableWithPtr -- | stack size in *words* [stack_size] :: DebugClosure pap string s b -> !Word32 -- | non-zero => dirty [stack_dirty] :: DebugClosure pap string s b -> !Word8 [stack_marking] :: DebugClosure pap string s b -> !Word8 [frames] :: DebugClosure pap string s b -> s WeakClosure :: !StgInfoTableWithPtr -> !b -> !b -> !b -> !b -> !Maybe b -> DebugClosure pap string s b [info] :: DebugClosure pap string s b -> !StgInfoTableWithPtr [cfinalizers] :: DebugClosure pap string s b -> !b [key] :: DebugClosure pap string s b -> !b -- | Pointer to closure [value] :: DebugClosure pap string s b -> !b [finalizer] :: DebugClosure pap string s b -> !b -- | next weak pointer for the capability, can be NULL. [mlink] :: DebugClosure pap string s b -> !Maybe b TVarClosure :: !StgInfoTableWithPtr -> !b -> !b -> !Int -> DebugClosure pap string s b [info] :: DebugClosure pap string s b -> !StgInfoTableWithPtr [current_value] :: DebugClosure pap string s b -> !b [tvar_watch_queue] :: DebugClosure pap string s b -> !b [num_updates] :: DebugClosure pap string s b -> !Int TRecChunkClosure :: !StgInfoTableWithPtr -> !b -> !Word -> ![TRecEntry b] -> DebugClosure pap string s b [info] :: DebugClosure pap string s b -> !StgInfoTableWithPtr [prev_chunk] :: DebugClosure pap string s b -> !b [next_idx] :: DebugClosure pap string s b -> !Word [entries] :: DebugClosure pap string s b -> ![TRecEntry b] MutPrimClosure :: !StgInfoTableWithPtr -> ![b] -> ![Word] -> DebugClosure pap string s b [info] :: DebugClosure pap string s b -> !StgInfoTableWithPtr -- | Pointer arguments [ptrArgs] :: DebugClosure pap string s b -> ![b] -- | Non-pointer arguments [dataArgs] :: DebugClosure pap string s b -> ![Word] -- | Another kind of closure OtherClosure :: !StgInfoTableWithPtr -> ![b] -> ![Word] -> DebugClosure pap string s b [info] :: DebugClosure pap string s b -> !StgInfoTableWithPtr [hvalues] :: DebugClosure pap string s b -> ![b] [rawWords] :: DebugClosure pap string s b -> ![Word] UnsupportedClosure :: !StgInfoTableWithPtr -> DebugClosure pap string s b [info] :: DebugClosure pap string s b -> !StgInfoTableWithPtr data TRecEntry b TRecEntry :: !b -> !b -> !b -> Int -> TRecEntry b [tvar] :: TRecEntry b -> !b [expected_value] :: TRecEntry b -> !b [new_value] :: TRecEntry b -> !b [trec_num_updates] :: TRecEntry b -> Int type DebugClosureWithSize = DebugClosureWithExtra Size data DebugClosureWithExtra x pap string s b DCS :: x -> DebugClosure pap string s b -> DebugClosureWithExtra x pap string s b [extraDCS] :: DebugClosureWithExtra x pap string s b -> x [unDCS] :: DebugClosureWithExtra x pap string s b -> DebugClosure pap string s b -- | Exclusive size newtype Size Size :: Int -> Size [getSize] :: Size -> Int newtype InclusiveSize InclusiveSize :: Int -> InclusiveSize [getInclusiveSize] :: InclusiveSize -> Int newtype RetainerSize RetainerSize :: Int -> RetainerSize [getRetainerSize] :: RetainerSize -> Int noSize :: DebugClosureWithSize pap string s b -> DebugClosure pap string s b dcSize :: DebugClosureWithSize pap string s b -> Size allClosures :: DebugClosure (GenPapPayload c) a (GenStackFrames c) c -> [c] -- | This is a somewhat faithful representation of an info table. See -- https://gitlab.haskell.org/ghc/ghc/blob/master/includes/rts/storage/InfoTables.h -- for more details on this data structure. data StgInfoTable StgInfoTable :: Maybe EntryFunPtr -> HalfWord -> HalfWord -> ClosureType -> HalfWord -> Maybe ItblCodes -> StgInfoTable [entry] :: StgInfoTable -> Maybe EntryFunPtr [ptrs] :: StgInfoTable -> HalfWord [nptrs] :: StgInfoTable -> HalfWord [tipe] :: StgInfoTable -> ClosureType [srtlen] :: StgInfoTable -> HalfWord [code] :: StgInfoTable -> Maybe ItblCodes data ClosureType INVALID_OBJECT :: ClosureType CONSTR :: ClosureType CONSTR_1_0 :: ClosureType CONSTR_0_1 :: ClosureType CONSTR_2_0 :: ClosureType CONSTR_1_1 :: ClosureType CONSTR_0_2 :: ClosureType CONSTR_NOCAF :: ClosureType FUN :: ClosureType FUN_1_0 :: ClosureType FUN_0_1 :: ClosureType FUN_2_0 :: ClosureType FUN_1_1 :: ClosureType FUN_0_2 :: ClosureType FUN_STATIC :: ClosureType THUNK :: ClosureType THUNK_1_0 :: ClosureType THUNK_0_1 :: ClosureType THUNK_2_0 :: ClosureType THUNK_1_1 :: ClosureType THUNK_0_2 :: ClosureType THUNK_STATIC :: ClosureType THUNK_SELECTOR :: ClosureType BCO :: ClosureType AP :: ClosureType PAP :: ClosureType AP_STACK :: ClosureType IND :: ClosureType IND_STATIC :: ClosureType RET_BCO :: ClosureType RET_SMALL :: ClosureType RET_BIG :: ClosureType RET_FUN :: ClosureType UPDATE_FRAME :: ClosureType CATCH_FRAME :: ClosureType UNDERFLOW_FRAME :: ClosureType STOP_FRAME :: ClosureType BLOCKING_QUEUE :: ClosureType BLACKHOLE :: ClosureType MVAR_CLEAN :: ClosureType MVAR_DIRTY :: ClosureType TVAR :: ClosureType ARR_WORDS :: ClosureType MUT_ARR_PTRS_CLEAN :: ClosureType MUT_ARR_PTRS_DIRTY :: ClosureType MUT_ARR_PTRS_FROZEN_DIRTY :: ClosureType MUT_ARR_PTRS_FROZEN_CLEAN :: ClosureType MUT_VAR_CLEAN :: ClosureType MUT_VAR_DIRTY :: ClosureType WEAK :: ClosureType PRIM :: ClosureType MUT_PRIM :: ClosureType TSO :: ClosureType STACK :: ClosureType TREC_CHUNK :: ClosureType ATOMICALLY_FRAME :: ClosureType CATCH_RETRY_FRAME :: ClosureType CATCH_STM_FRAME :: ClosureType WHITEHOLE :: ClosureType SMALL_MUT_ARR_PTRS_CLEAN :: ClosureType SMALL_MUT_ARR_PTRS_DIRTY :: ClosureType SMALL_MUT_ARR_PTRS_FROZEN_DIRTY :: ClosureType SMALL_MUT_ARR_PTRS_FROZEN_CLEAN :: ClosureType COMPACT_NFDATA :: ClosureType N_CLOSURE_TYPES :: ClosureType data StgInfoTableWithPtr StgInfoTableWithPtr :: InfoTablePtr -> StgInfoTable -> StgInfoTableWithPtr [tableId] :: StgInfoTableWithPtr -> InfoTablePtr [decodedTable] :: StgInfoTableWithPtr -> StgInfoTable data DebugStackFrame b DebugStackFrame :: !StgInfoTableWithPtr -> [FieldValue b] -> DebugStackFrame b [frame_info] :: DebugStackFrame b -> !StgInfoTableWithPtr [values] :: DebugStackFrame b -> [FieldValue b] data FieldValue b SPtr :: b -> FieldValue b SNonPtr :: !Word64 -> FieldValue b newtype GenStackFrames b GenStackFrames :: [DebugStackFrame b] -> GenStackFrames b [getFrames] :: GenStackFrames b -> [DebugStackFrame b] type StackFrames = GenStackFrames ClosurePtr -- | Information needed to decode a set of stack frames data StackCont StackCont :: StackPtr -> RawStack -> StackCont newtype GenPapPayload b GenPapPayload :: [FieldValue b] -> GenPapPayload b [getValues] :: GenPapPayload b -> [FieldValue b] type PapPayload = GenPapPayload ClosurePtr -- | Information needed to decode a PAP payload data PayloadCont PayloadCont :: ClosurePtr -> [Word64] -> PayloadCont data ConstrDesc ConstrDesc :: !String -> !String -> !String -> ConstrDesc -- | Package name [pkg] :: ConstrDesc -> !String -- | Module name [modl] :: ConstrDesc -> !String -- | Constructor name [name] :: ConstrDesc -> !String -- | Information needed to decode a ConstrDesc type ConstrDescCont = InfoTablePtr parseConstrDesc :: String -> ConstrDesc class Quadtraversable m quadtraverse :: (Quadtraversable m, Applicative f) => (a -> f b) -> (c -> f d) -> (e -> f g) -> (h -> f i) -> m a c e h -> f (m b d g i) quadmap :: forall a b c d e f g h t. Quadtraversable t => (a -> b) -> (c -> d) -> (e -> f) -> (g -> h) -> t a c e g -> t b d f h instance GHC.Show.Show GHC.Debug.Types.Closures.PayloadCont instance GHC.Classes.Eq GHC.Debug.Types.Closures.Size instance GHC.Classes.Ord GHC.Debug.Types.Closures.Size instance GHC.Num.Num GHC.Debug.Types.Closures.Size instance GHC.Base.Monoid GHC.Debug.Types.Closures.Size instance GHC.Base.Semigroup GHC.Debug.Types.Closures.Size instance GHC.Generics.Generic GHC.Debug.Types.Closures.Size instance GHC.Show.Show GHC.Debug.Types.Closures.Size instance GHC.Base.Monoid GHC.Debug.Types.Closures.InclusiveSize instance GHC.Base.Semigroup GHC.Debug.Types.Closures.InclusiveSize instance GHC.Generics.Generic GHC.Debug.Types.Closures.InclusiveSize instance GHC.Show.Show GHC.Debug.Types.Closures.InclusiveSize instance GHC.Base.Monoid GHC.Debug.Types.Closures.RetainerSize instance GHC.Base.Semigroup GHC.Debug.Types.Closures.RetainerSize instance GHC.Classes.Eq GHC.Debug.Types.Closures.RetainerSize instance GHC.Classes.Ord GHC.Debug.Types.Closures.RetainerSize instance GHC.Generics.Generic GHC.Debug.Types.Closures.RetainerSize instance GHC.Show.Show GHC.Debug.Types.Closures.RetainerSize instance GHC.Show.Show GHC.Debug.Types.Closures.StgInfoTableWithPtr instance GHC.Classes.Eq b => GHC.Classes.Eq (GHC.Debug.Types.Closures.TRecEntry b) instance GHC.Classes.Ord b => GHC.Classes.Ord (GHC.Debug.Types.Closures.TRecEntry b) instance Data.Traversable.Traversable GHC.Debug.Types.Closures.TRecEntry instance Data.Foldable.Foldable GHC.Debug.Types.Closures.TRecEntry instance GHC.Base.Functor GHC.Debug.Types.Closures.TRecEntry instance GHC.Generics.Generic (GHC.Debug.Types.Closures.TRecEntry b) instance GHC.Show.Show b => GHC.Show.Show (GHC.Debug.Types.Closures.TRecEntry b) instance (GHC.Classes.Eq b, GHC.Classes.Eq string, GHC.Classes.Eq pap, GHC.Classes.Eq s) => GHC.Classes.Eq (GHC.Debug.Types.Closures.DebugClosure pap string s b) instance (GHC.Classes.Ord b, GHC.Classes.Ord string, GHC.Classes.Ord pap, GHC.Classes.Ord s) => GHC.Classes.Ord (GHC.Debug.Types.Closures.DebugClosure pap string s b) instance Data.Traversable.Traversable (GHC.Debug.Types.Closures.DebugClosure pap string s) instance Data.Foldable.Foldable (GHC.Debug.Types.Closures.DebugClosure pap string s) instance GHC.Base.Functor (GHC.Debug.Types.Closures.DebugClosure pap string s) instance GHC.Generics.Generic (GHC.Debug.Types.Closures.DebugClosure pap string s b) instance (GHC.Show.Show b, GHC.Show.Show string, GHC.Show.Show pap, GHC.Show.Show s) => GHC.Show.Show (GHC.Debug.Types.Closures.DebugClosure pap string s b) instance (GHC.Classes.Eq x, GHC.Classes.Eq b, GHC.Classes.Eq string, GHC.Classes.Eq pap, GHC.Classes.Eq s) => GHC.Classes.Eq (GHC.Debug.Types.Closures.DebugClosureWithExtra x pap string s b) instance (GHC.Classes.Ord x, GHC.Classes.Ord b, GHC.Classes.Ord string, GHC.Classes.Ord pap, GHC.Classes.Ord s) => GHC.Classes.Ord (GHC.Debug.Types.Closures.DebugClosureWithExtra x pap string s b) instance (GHC.Show.Show x, GHC.Show.Show b, GHC.Show.Show string, GHC.Show.Show pap, GHC.Show.Show s) => GHC.Show.Show (GHC.Debug.Types.Closures.DebugClosureWithExtra x pap string s b) instance GHC.Show.Show GHC.Debug.Types.Closures.StackCont instance GHC.Classes.Ord GHC.Debug.Types.Closures.ConstrDesc instance GHC.Classes.Eq GHC.Debug.Types.Closures.ConstrDesc instance GHC.Show.Show GHC.Debug.Types.Closures.ConstrDesc instance GHC.Classes.Eq b => GHC.Classes.Eq (GHC.Debug.Types.Closures.FieldValue b) instance GHC.Classes.Ord b => GHC.Classes.Ord (GHC.Debug.Types.Closures.FieldValue b) instance Data.Foldable.Foldable GHC.Debug.Types.Closures.FieldValue instance GHC.Base.Functor GHC.Debug.Types.Closures.FieldValue instance Data.Traversable.Traversable GHC.Debug.Types.Closures.FieldValue instance GHC.Show.Show b => GHC.Show.Show (GHC.Debug.Types.Closures.FieldValue b) instance GHC.Classes.Eq b => GHC.Classes.Eq (GHC.Debug.Types.Closures.DebugStackFrame b) instance GHC.Classes.Ord b => GHC.Classes.Ord (GHC.Debug.Types.Closures.DebugStackFrame b) instance GHC.Show.Show b => GHC.Show.Show (GHC.Debug.Types.Closures.DebugStackFrame b) instance Data.Foldable.Foldable GHC.Debug.Types.Closures.DebugStackFrame instance GHC.Base.Functor GHC.Debug.Types.Closures.DebugStackFrame instance Data.Traversable.Traversable GHC.Debug.Types.Closures.DebugStackFrame instance GHC.Classes.Eq b => GHC.Classes.Eq (GHC.Debug.Types.Closures.GenStackFrames b) instance GHC.Classes.Ord b => GHC.Classes.Ord (GHC.Debug.Types.Closures.GenStackFrames b) instance GHC.Show.Show b => GHC.Show.Show (GHC.Debug.Types.Closures.GenStackFrames b) instance Data.Traversable.Traversable GHC.Debug.Types.Closures.GenStackFrames instance Data.Foldable.Foldable GHC.Debug.Types.Closures.GenStackFrames instance GHC.Base.Functor GHC.Debug.Types.Closures.GenStackFrames instance GHC.Classes.Eq b => GHC.Classes.Eq (GHC.Debug.Types.Closures.GenPapPayload b) instance GHC.Classes.Ord b => GHC.Classes.Ord (GHC.Debug.Types.Closures.GenPapPayload b) instance GHC.Show.Show b => GHC.Show.Show (GHC.Debug.Types.Closures.GenPapPayload b) instance Data.Traversable.Traversable GHC.Debug.Types.Closures.GenPapPayload instance Data.Foldable.Foldable GHC.Debug.Types.Closures.GenPapPayload instance GHC.Base.Functor GHC.Debug.Types.Closures.GenPapPayload instance GHC.Debug.Types.Closures.Quadtraversable (GHC.Debug.Types.Closures.DebugClosureWithExtra x) instance GHC.Debug.Types.Closures.Quadtraversable GHC.Debug.Types.Closures.DebugClosure instance GHC.Classes.Ord GHC.Debug.Types.Closures.StgInfoTableWithPtr instance GHC.Classes.Eq GHC.Debug.Types.Closures.StgInfoTableWithPtr module GHC.Debug.Types.Graph -- | The whole graph. The suggested interface is to only use -- lookupHeapGraph, as the internal representation may change. -- Nevertheless, we export it here: Sometimes the user knows better what -- he needs than we do. data HeapGraph a HeapGraph :: !NonEmpty ClosurePtr -> !IntMap (HeapGraphEntry a) -> HeapGraph a [roots] :: HeapGraph a -> !NonEmpty ClosurePtr [graph] :: HeapGraph a -> !IntMap (HeapGraphEntry a) -- | For heap graphs, i.e. data structures that also represent sharing and -- cyclic structures, these are the entries. If the referenced value is -- Nothing, then we do not have that value in the map, most -- likely due to exceeding the recursion bound passed to -- buildHeapGraph. -- -- Besides a pointer to the stored value and the closure representation -- we have a slot for arbitrary data, for the user's convenience. data HeapGraphEntry a HeapGraphEntry :: ClosurePtr -> DebugClosure PapHI ConstrDesc StackHI (Maybe HeapGraphIndex) -> a -> HeapGraphEntry a [hgeClosurePtr] :: HeapGraphEntry a -> ClosurePtr [hgeClosure] :: HeapGraphEntry a -> DebugClosure PapHI ConstrDesc StackHI (Maybe HeapGraphIndex) [hgeData] :: HeapGraphEntry a -> a type HeapGraphIndex = ClosurePtr type PapHI = GenPapPayload (Maybe HeapGraphIndex) type StackHI = GenStackFrames (Maybe HeapGraphIndex) type DerefFunction m a = ClosurePtr -> m (DebugClosureWithExtra a PapPayload ConstrDesc StackFrames ClosurePtr) -- | Creates a HeapGraph for the value in the box, but not recursing -- further than the given limit. buildHeapGraph :: MonadFix m => DerefFunction m a -> Maybe Int -> ClosurePtr -> m (HeapGraph a) -- | Creates a HeapGraph for the values in multiple boxes, but not -- recursing further than the given limit. multiBuildHeapGraph :: MonadFix m => DerefFunction m a -> Maybe Int -> NonEmpty ClosurePtr -> m (HeapGraph a) generalBuildHeapGraph :: forall m a. MonadFix m => DerefFunction m a -> Maybe Int -> HeapGraph a -> NonEmpty ClosurePtr -> m (HeapGraph a) -- | Pretty-prints a HeapGraph. The resulting string contains newlines. -- Example for let s = "Ki" in (s, s, cycle "Ho"): -- --
--   let x1 = "Ki"
--       x6 = C# 'H' : C# 'o' : x6
--   in (x1,x1,x6)
--   
ppHeapGraph :: (a -> String) -> HeapGraph a -> String -- | A pretty-printer that tries to generate valid Haskell for evalutated -- data. It assumes that for the included boxes, you already replaced -- them by Strings using map or, if you need to do IO, -- mapM. -- -- The parameter gives the precedendence, to avoid avoidable -- parenthesises. ppClosure :: String -> (Int -> c -> String) -> Int -> DebugClosure p ConstrDesc s c -> String lookupHeapGraph :: HeapGraphIndex -> HeapGraph a -> Maybe (HeapGraphEntry a) traverseHeapGraph :: Applicative m => (HeapGraphEntry a -> m (HeapGraphEntry b)) -> HeapGraph a -> m (HeapGraph b) updateHeapGraph :: (HeapGraphEntry a -> Maybe (HeapGraphEntry a)) -> HeapGraphIndex -> HeapGraph a -> HeapGraph a heapGraphSize :: HeapGraph a -> Int -- | Adds the given annotation to the entry at the given index, using the -- mappend operation of its Monoid instance. annotateHeapGraph :: (a -> a) -> HeapGraphIndex -> HeapGraph a -> HeapGraph a data ReverseGraph mkReverseGraph :: HeapGraph a -> ReverseGraph reverseEdges :: ClosurePtr -> ReverseGraph -> Maybe [ClosurePtr] instance Data.Traversable.Traversable GHC.Debug.Types.Graph.HeapGraphEntry instance Data.Foldable.Foldable GHC.Debug.Types.Graph.HeapGraphEntry instance GHC.Base.Functor GHC.Debug.Types.Graph.HeapGraphEntry instance GHC.Show.Show a => GHC.Show.Show (GHC.Debug.Types.Graph.HeapGraphEntry a) instance GHC.Base.Functor GHC.Debug.Types.Graph.HeapGraph instance Data.Traversable.Traversable GHC.Debug.Types.Graph.HeapGraph instance Data.Foldable.Foldable GHC.Debug.Types.Graph.HeapGraph instance GHC.Show.Show a => GHC.Show.Show (GHC.Debug.Types.Graph.HeapGraph a) module GHC.Debug.Decode.Convert -- | Convert a GenClosure from ghc-heap to a DebugClosure, convertClosure :: (Num a, Eq a, Show a) => StgInfoTableWithPtr -> GenClosure a -> DebugClosure Void InfoTablePtr Void a -- | Low-level functions for decoding a closure representation from the raw -- bytes module GHC.Debug.Decode decodeClosure :: (StgInfoTableWithPtr, RawInfoTable) -> (ClosurePtr, RawClosure) -> SizedClosure decodeInfoTable :: RawInfoTable -> StgInfoTable module GHC.Debug.Types -- | A request sent from the debugger to the debuggee parametrized on the -- result type. data Request a -- | Request protocol version [RequestVersion] :: Request Word32 -- | Pause the debuggee. [RequestPause] :: ForkOrPause -> Request () -- | Resume the debuggee. [RequestResume] :: Request () -- | Request the debuggee's root pointers. [RequestRoots] :: Request [ClosurePtr] -- | Request a closure [RequestClosure] :: ClosurePtr -> Request RawClosure -- | Request an info table [RequestInfoTable] :: InfoTablePtr -> Request (StgInfoTableWithPtr, RawInfoTable) -- | Wait for the debuggee to pause itself and then execute an action. It -- currently impossible to resume after a pause caused by a poll. [RequestPoll] :: Request () -- | A client can save objects by calling a special RTS method This -- function returns the closures it saved. [RequestSavedObjects] :: Request [ClosurePtr] -- | Request the pointer bitmap for a stack frame at a given offset from a -- StackPtr. [RequestStackBitmap] :: StackPtr -> Word32 -> Request PtrBitmap -- | Decode the bitmap contained in a StgFunInfoTable Used by PAP and AP -- closure types. [RequestFunBitmap] :: Word16 -> ClosurePtr -> Request PtrBitmap -- | Request the constructor description for an info table. The info table -- must be from a ConstrClosure [RequestConstrDesc] :: InfoTablePtr -> Request ConstrDesc -- | Lookup source information of an info table [RequestSourceInfo] :: InfoTablePtr -> Request (Maybe SourceInformation) -- | Copy all blocks from the process at once [RequestAllBlocks] :: Request [RawBlock] -- | Request the block which contains a specific pointer [RequestBlock] :: ClosurePtr -> Request RawBlock -- | The decision about whether to fork the running process or pause it -- running whilst we are debugging it. data ForkOrPause Pause :: ForkOrPause Fork :: ForkOrPause requestCommandId :: Request a -> CommandId -- | Perform a request doRequest :: MVar Handle -> Request a -> IO a -- | Whether a request mutates the debuggee state, don't cache these ones isWriteRequest :: Request a -> Bool withWriteRequest :: Request a -> r a -> (a ~ () => Request a -> r a) -> r a -- | Requests which will always answer the same. For example, info tables -- are immutable and so requesting an info table will always result in -- the same value and is safe to cache across pause lines. isImmutableRequest :: Request a -> Bool data AnyReq AnyReq :: !Request req -> AnyReq data AnyResp AnyResp :: !a -> !a -> Put -> AnyResp newtype CommandId CommandId :: Word32 -> CommandId data SourceInformation SourceInformation :: !String -> !ClosureType -> !String -> !String -> !String -> !String -> SourceInformation [infoName] :: SourceInformation -> !String [infoClosureType] :: SourceInformation -> !ClosureType [infoType] :: SourceInformation -> !String [infoLabel] :: SourceInformation -> !String [infoModule] :: SourceInformation -> !String [infoPosition] :: SourceInformation -> !String data ClosureType INVALID_OBJECT :: ClosureType CONSTR :: ClosureType CONSTR_1_0 :: ClosureType CONSTR_0_1 :: ClosureType CONSTR_2_0 :: ClosureType CONSTR_1_1 :: ClosureType CONSTR_0_2 :: ClosureType CONSTR_NOCAF :: ClosureType FUN :: ClosureType FUN_1_0 :: ClosureType FUN_0_1 :: ClosureType FUN_2_0 :: ClosureType FUN_1_1 :: ClosureType FUN_0_2 :: ClosureType FUN_STATIC :: ClosureType THUNK :: ClosureType THUNK_1_0 :: ClosureType THUNK_0_1 :: ClosureType THUNK_2_0 :: ClosureType THUNK_1_1 :: ClosureType THUNK_0_2 :: ClosureType THUNK_STATIC :: ClosureType THUNK_SELECTOR :: ClosureType BCO :: ClosureType AP :: ClosureType PAP :: ClosureType AP_STACK :: ClosureType IND :: ClosureType IND_STATIC :: ClosureType RET_BCO :: ClosureType RET_SMALL :: ClosureType RET_BIG :: ClosureType RET_FUN :: ClosureType UPDATE_FRAME :: ClosureType CATCH_FRAME :: ClosureType UNDERFLOW_FRAME :: ClosureType STOP_FRAME :: ClosureType BLOCKING_QUEUE :: ClosureType BLACKHOLE :: ClosureType MVAR_CLEAN :: ClosureType MVAR_DIRTY :: ClosureType TVAR :: ClosureType ARR_WORDS :: ClosureType MUT_ARR_PTRS_CLEAN :: ClosureType MUT_ARR_PTRS_DIRTY :: ClosureType MUT_ARR_PTRS_FROZEN_DIRTY :: ClosureType MUT_ARR_PTRS_FROZEN_CLEAN :: ClosureType MUT_VAR_CLEAN :: ClosureType MUT_VAR_DIRTY :: ClosureType WEAK :: ClosureType PRIM :: ClosureType MUT_PRIM :: ClosureType TSO :: ClosureType STACK :: ClosureType TREC_CHUNK :: ClosureType ATOMICALLY_FRAME :: ClosureType CATCH_RETRY_FRAME :: ClosureType CATCH_STM_FRAME :: ClosureType WHITEHOLE :: ClosureType SMALL_MUT_ARR_PTRS_CLEAN :: ClosureType SMALL_MUT_ARR_PTRS_DIRTY :: ClosureType SMALL_MUT_ARR_PTRS_FROZEN_DIRTY :: ClosureType SMALL_MUT_ARR_PTRS_FROZEN_CLEAN :: ClosureType COMPACT_NFDATA :: ClosureType N_CLOSURE_TYPES :: ClosureType getIPE :: Get (Maybe SourceInformation) putIPE :: Maybe SourceInformation -> Put getInfoTable :: Get (StgInfoTable, RawInfoTable) putInfoTable :: RawInfoTable -> Put putRequest :: Request a -> Put getRequest :: Get AnyReq instance GHC.Enum.Enum GHC.Debug.Types.ForkOrPause instance GHC.Show.Show GHC.Debug.Types.ForkOrPause instance GHC.Classes.Ord GHC.Debug.Types.ForkOrPause instance GHC.Classes.Eq GHC.Debug.Types.ForkOrPause instance GHC.Classes.Ord GHC.Debug.Types.SourceInformation instance GHC.Classes.Eq GHC.Debug.Types.SourceInformation instance GHC.Show.Show GHC.Debug.Types.SourceInformation instance Data.Hashable.Class.Hashable GHC.Debug.Types.CommandId instance Data.Binary.Class.Binary GHC.Debug.Types.CommandId instance GHC.Show.Show GHC.Debug.Types.CommandId instance GHC.Classes.Ord GHC.Debug.Types.CommandId instance GHC.Classes.Eq GHC.Debug.Types.CommandId instance GHC.Show.Show GHC.Debug.Types.Error instance GHC.Classes.Ord GHC.Debug.Types.Error instance GHC.Classes.Eq GHC.Debug.Types.Error instance GHC.Show.Show GHC.Debug.Types.ResponseCode instance GHC.Classes.Ord GHC.Debug.Types.ResponseCode instance GHC.Classes.Eq GHC.Debug.Types.ResponseCode instance GHC.Show.Show (GHC.Debug.Types.Request a) instance GHC.Classes.Eq (GHC.Debug.Types.Request a) instance GHC.Exception.Type.Exception GHC.Debug.Types.Error instance Data.Hashable.Class.Hashable GHC.Debug.Types.AnyReq instance GHC.Classes.Eq GHC.Debug.Types.AnyReq instance Data.Hashable.Class.Hashable (GHC.Debug.Types.Request a) instance Data.Hashable.Class.Hashable GHC.Debug.Types.ForkOrPause instance Data.Binary.Class.Binary GHC.Debug.Types.ForkOrPause module GHC.Debug.Decode.Stack decodeStack :: Monad m => (RawClosure -> m StgInfoTableWithPtr) -> (Word32 -> m PtrBitmap) -> RawStack -> m StackFrames