{-# LANGUAGE GADTs, DeriveGeneric, StandaloneDeriving, ScopedTypeVariables,
GeneralizedNewtypeDeriving, ExistentialQuantification, RecordWildCards,
CPP #-}
{-# OPTIONS_GHC -fno-warn-name-shadowing -fno-warn-orphans #-}
module GHCi.Message
( Message(..), Msg(..)
, THMessage(..), THMsg(..)
, QResult(..)
, EvalStatus_(..), EvalStatus, EvalResult(..), EvalOpts(..), EvalExpr(..)
, SerializableException(..)
, toSerializableException, fromSerializableException
, THResult(..), THResultType(..)
, ResumeContext(..)
, QState(..)
, getMessage, putMessage, getTHMessage, putTHMessage
, Pipe(..), remoteCall, remoteTHCall, readPipe, writePipe
) where
import Prelude
import GHCi.RemoteTypes
import GHCi.FFI
import GHCi.TH.Binary ()
import GHCi.BreakArray
import GHC.LanguageExtensions
import qualified GHC.Exts.Heap as Heap
import GHC.ForeignSrcLang
import GHC.Fingerprint
import Control.Concurrent
import Control.Exception
import Data.Binary
import Data.Binary.Get
import Data.Binary.Put
import Data.ByteString (ByteString)
import qualified Data.ByteString as B
import qualified Data.ByteString.Lazy as LB
import Data.Dynamic
import Data.Typeable (TypeRep)
import Data.IORef
import Data.Map (Map)
import Foreign
import GHC.Generics
import GHC.Stack.CCS
import qualified Language.Haskell.TH as TH
import qualified Language.Haskell.TH.Syntax as TH
import System.Exit
import System.IO
import System.IO.Error
data Message a where
Shutdown :: Message ()
RtsRevertCAFs :: Message ()
InitLinker :: Message ()
LookupSymbol :: String -> Message (Maybe (RemotePtr ()))
LookupClosure :: String -> Message (Maybe HValueRef)
LoadDLL :: String -> Message (Maybe String)
LoadArchive :: String -> Message ()
LoadObj :: String -> Message ()
UnloadObj :: String -> Message ()
AddLibrarySearchPath :: String -> Message (RemotePtr ())
RemoveLibrarySearchPath :: RemotePtr () -> Message Bool
ResolveObjs :: Message Bool
FindSystemLibrary :: String -> Message (Maybe String)
CreateBCOs :: [LB.ByteString] -> Message [HValueRef]
FreeHValueRefs :: [HValueRef] -> Message ()
AddSptEntry :: Fingerprint -> HValueRef -> Message ()
MallocData :: ByteString -> Message (RemotePtr ())
MallocStrings :: [ByteString] -> Message [RemotePtr ()]
PrepFFI :: FFIConv -> [FFIType] -> FFIType -> Message (RemotePtr C_ffi_cif)
FreeFFI :: RemotePtr C_ffi_cif -> Message ()
MkConInfoTable
:: Bool
-> Int
-> Int
-> Int
-> Int
-> ByteString
-> Message (RemotePtr Heap.StgInfoTable)
EvalStmt
:: EvalOpts
-> EvalExpr HValueRef
-> Message (EvalStatus [HValueRef])
ResumeStmt
:: EvalOpts
-> RemoteRef (ResumeContext [HValueRef])
-> Message (EvalStatus [HValueRef])
AbandonStmt
:: RemoteRef (ResumeContext [HValueRef])
-> Message ()
EvalString
:: HValueRef
-> Message (EvalResult String)
EvalStringToString
:: HValueRef
-> String
-> Message (EvalResult String)
EvalIO
:: HValueRef
-> Message (EvalResult ())
MkCostCentres
:: String
-> [(String,String)]
-> Message [RemotePtr CostCentre]
CostCentreStackInfo
:: RemotePtr CostCentreStack
-> Message [String]
NewBreakArray
:: Int
-> Message (RemoteRef BreakArray)
SetupBreakpoint
:: RemoteRef BreakArray
-> Int
-> Int
-> Message ()
BreakpointStatus
:: RemoteRef BreakArray
-> Int
-> Message Bool
GetBreakpointVar
:: HValueRef
-> Int
-> Message (Maybe HValueRef)
StartTH :: Message (RemoteRef (IORef QState))
RunTH
:: RemoteRef (IORef QState)
-> HValueRef
-> THResultType
-> Maybe TH.Loc
-> Message (QResult ByteString)
RunModFinalizers :: RemoteRef (IORef QState)
-> [RemoteRef (TH.Q ())]
-> Message (QResult ())
GetClosure
:: HValueRef
-> Message (Heap.GenClosure HValueRef)
Seq
:: HValueRef
-> Message (EvalStatus ())
ResumeSeq
:: RemoteRef (ResumeContext ())
-> Message (EvalStatus ())
deriving instance Show (Message a)
data QResult a
= QDone a
| QException String
| QFail String
deriving (forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall a x. Rep (QResult a) x -> QResult a
forall a x. QResult a -> Rep (QResult a) x
$cto :: forall a x. Rep (QResult a) x -> QResult a
$cfrom :: forall a x. QResult a -> Rep (QResult a) x
Generic, Int -> QResult a -> ShowS
forall a. Show a => Int -> QResult a -> ShowS
forall a. Show a => [QResult a] -> ShowS
forall a. Show a => QResult a -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [QResult a] -> ShowS
$cshowList :: forall a. Show a => [QResult a] -> ShowS
show :: QResult a -> String
$cshow :: forall a. Show a => QResult a -> String
showsPrec :: Int -> QResult a -> ShowS
$cshowsPrec :: forall a. Show a => Int -> QResult a -> ShowS
Show)
instance Binary a => Binary (QResult a)
data THMessage a where
NewName :: String -> THMessage (THResult TH.Name)
Report :: Bool -> String -> THMessage (THResult ())
LookupName :: Bool -> String -> THMessage (THResult (Maybe TH.Name))
Reify :: TH.Name -> THMessage (THResult TH.Info)
ReifyFixity :: TH.Name -> THMessage (THResult (Maybe TH.Fixity))
ReifyType :: TH.Name -> THMessage (THResult TH.Type)
ReifyInstances :: TH.Name -> [TH.Type] -> THMessage (THResult [TH.Dec])
ReifyRoles :: TH.Name -> THMessage (THResult [TH.Role])
ReifyAnnotations :: TH.AnnLookup -> TypeRep
-> THMessage (THResult [ByteString])
ReifyModule :: TH.Module -> THMessage (THResult TH.ModuleInfo)
ReifyConStrictness :: TH.Name -> THMessage (THResult [TH.DecidedStrictness])
GetPackageRoot :: THMessage (THResult FilePath)
AddDependentFile :: FilePath -> THMessage (THResult ())
AddTempFile :: String -> THMessage (THResult FilePath)
AddModFinalizer :: RemoteRef (TH.Q ()) -> THMessage (THResult ())
AddCorePlugin :: String -> THMessage (THResult ())
AddTopDecls :: [TH.Dec] -> THMessage (THResult ())
AddForeignFilePath :: ForeignSrcLang -> FilePath -> THMessage (THResult ())
IsExtEnabled :: Extension -> THMessage (THResult Bool)
ExtsEnabled :: THMessage (THResult [Extension])
PutDoc :: TH.DocLoc -> String -> THMessage (THResult ())
GetDoc :: TH.DocLoc -> THMessage (THResult (Maybe String))
StartRecover :: THMessage ()
EndRecover :: Bool -> THMessage ()
FailIfErrs :: THMessage (THResult ())
RunTHDone :: THMessage ()
deriving instance Show (THMessage a)
data THMsg = forall a . (Binary a, Show a) => THMsg (THMessage a)
getTHMessage :: Get THMsg
getTHMessage :: Get THMsg
getTHMessage = do
Word8
b <- Get Word8
getWord8
case Word8
b of
Word8
0 -> forall a. (Binary a, Show a) => THMessage a -> THMsg
THMsg forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> String -> THMessage (THResult Name)
NewName forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall t. Binary t => Get t
get
Word8
1 -> forall a. (Binary a, Show a) => THMessage a -> THMsg
THMsg forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Bool -> String -> THMessage (THResult ())
Report forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall t. Binary t => Get t
get forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall t. Binary t => Get t
get)
Word8
2 -> forall a. (Binary a, Show a) => THMessage a -> THMsg
THMsg forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Bool -> String -> THMessage (THResult (Maybe Name))
LookupName forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall t. Binary t => Get t
get forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall t. Binary t => Get t
get)
Word8
3 -> forall a. (Binary a, Show a) => THMessage a -> THMsg
THMsg forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Name -> THMessage (THResult Info)
Reify forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall t. Binary t => Get t
get
Word8
4 -> forall a. (Binary a, Show a) => THMessage a -> THMsg
THMsg forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Name -> THMessage (THResult (Maybe Fixity))
ReifyFixity forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall t. Binary t => Get t
get
Word8
5 -> forall a. (Binary a, Show a) => THMessage a -> THMsg
THMsg forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Name -> [Type] -> THMessage (THResult [Dec])
ReifyInstances forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall t. Binary t => Get t
get forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall t. Binary t => Get t
get)
Word8
6 -> forall a. (Binary a, Show a) => THMessage a -> THMsg
THMsg forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Name -> THMessage (THResult [Role])
ReifyRoles forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall t. Binary t => Get t
get
Word8
7 -> forall a. (Binary a, Show a) => THMessage a -> THMsg
THMsg forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (AnnLookup -> TypeRep -> THMessage (THResult [ByteString])
ReifyAnnotations forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall t. Binary t => Get t
get forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall t. Binary t => Get t
get)
Word8
8 -> forall a. (Binary a, Show a) => THMessage a -> THMsg
THMsg forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Module -> THMessage (THResult ModuleInfo)
ReifyModule forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall t. Binary t => Get t
get
Word8
9 -> forall a. (Binary a, Show a) => THMessage a -> THMsg
THMsg forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Name -> THMessage (THResult [DecidedStrictness])
ReifyConStrictness forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall t. Binary t => Get t
get
Word8
10 -> forall a. (Binary a, Show a) => THMessage a -> THMsg
THMsg forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> String -> THMessage (THResult ())
AddDependentFile forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall t. Binary t => Get t
get
Word8
11 -> forall a. (Binary a, Show a) => THMessage a -> THMsg
THMsg forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> String -> THMessage (THResult String)
AddTempFile forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall t. Binary t => Get t
get
Word8
12 -> forall a. (Binary a, Show a) => THMessage a -> THMsg
THMsg forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [Dec] -> THMessage (THResult ())
AddTopDecls forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall t. Binary t => Get t
get
Word8
13 -> forall a. (Binary a, Show a) => THMessage a -> THMsg
THMsg forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Extension -> THMessage (THResult Bool)
IsExtEnabled forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall t. Binary t => Get t
get)
Word8
14 -> forall a. (Binary a, Show a) => THMessage a -> THMsg
THMsg forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall (m :: * -> *) a. Monad m => a -> m a
return THMessage (THResult [Extension])
ExtsEnabled
Word8
15 -> forall a. (Binary a, Show a) => THMessage a -> THMsg
THMsg forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall (m :: * -> *) a. Monad m => a -> m a
return THMessage ()
StartRecover
Word8
16 -> forall a. (Binary a, Show a) => THMessage a -> THMsg
THMsg forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Bool -> THMessage ()
EndRecover forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall t. Binary t => Get t
get
Word8
17 -> forall a. (Binary a, Show a) => THMessage a -> THMsg
THMsg forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall (m :: * -> *) a. Monad m => a -> m a
return THMessage (THResult ())
FailIfErrs
Word8
18 -> forall (m :: * -> *) a. Monad m => a -> m a
return (forall a. (Binary a, Show a) => THMessage a -> THMsg
THMsg THMessage ()
RunTHDone)
Word8
19 -> forall a. (Binary a, Show a) => THMessage a -> THMsg
THMsg forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> RemoteRef (Q ()) -> THMessage (THResult ())
AddModFinalizer forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall t. Binary t => Get t
get
Word8
20 -> forall a. (Binary a, Show a) => THMessage a -> THMsg
THMsg forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (ForeignSrcLang -> String -> THMessage (THResult ())
AddForeignFilePath forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall t. Binary t => Get t
get forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall t. Binary t => Get t
get)
Word8
21 -> forall a. (Binary a, Show a) => THMessage a -> THMsg
THMsg forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> String -> THMessage (THResult ())
AddCorePlugin forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall t. Binary t => Get t
get
Word8
22 -> forall a. (Binary a, Show a) => THMessage a -> THMsg
THMsg forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Name -> THMessage (THResult Type)
ReifyType forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall t. Binary t => Get t
get
Word8
23 -> forall a. (Binary a, Show a) => THMessage a -> THMsg
THMsg forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (DocLoc -> String -> THMessage (THResult ())
PutDoc forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall t. Binary t => Get t
get forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall t. Binary t => Get t
get)
Word8
24 -> forall a. (Binary a, Show a) => THMessage a -> THMsg
THMsg forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> DocLoc -> THMessage (THResult (Maybe String))
GetDoc forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall t. Binary t => Get t
get
Word8
25 -> forall a. (Binary a, Show a) => THMessage a -> THMsg
THMsg forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall (m :: * -> *) a. Monad m => a -> m a
return THMessage (THResult String)
GetPackageRoot
Word8
n -> forall a. HasCallStack => String -> a
error (String
"getTHMessage: unknown message " forall a. [a] -> [a] -> [a]
++ forall a. Show a => a -> String
show Word8
n)
putTHMessage :: THMessage a -> Put
putTHMessage :: forall a. THMessage a -> Put
putTHMessage THMessage a
m = case THMessage a
m of
NewName String
a -> Word8 -> Put
putWord8 Word8
0 forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put String
a
Report Bool
a String
b -> Word8 -> Put
putWord8 Word8
1 forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put Bool
a forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put String
b
LookupName Bool
a String
b -> Word8 -> Put
putWord8 Word8
2 forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put Bool
a forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put String
b
Reify Name
a -> Word8 -> Put
putWord8 Word8
3 forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put Name
a
ReifyFixity Name
a -> Word8 -> Put
putWord8 Word8
4 forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put Name
a
ReifyInstances Name
a [Type]
b -> Word8 -> Put
putWord8 Word8
5 forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put Name
a forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put [Type]
b
ReifyRoles Name
a -> Word8 -> Put
putWord8 Word8
6 forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put Name
a
ReifyAnnotations AnnLookup
a TypeRep
b -> Word8 -> Put
putWord8 Word8
7 forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put AnnLookup
a forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put TypeRep
b
ReifyModule Module
a -> Word8 -> Put
putWord8 Word8
8 forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put Module
a
ReifyConStrictness Name
a -> Word8 -> Put
putWord8 Word8
9 forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put Name
a
AddDependentFile String
a -> Word8 -> Put
putWord8 Word8
10 forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put String
a
AddTempFile String
a -> Word8 -> Put
putWord8 Word8
11 forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put String
a
AddTopDecls [Dec]
a -> Word8 -> Put
putWord8 Word8
12 forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put [Dec]
a
IsExtEnabled Extension
a -> Word8 -> Put
putWord8 Word8
13 forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put Extension
a
THMessage a
ExtsEnabled -> Word8 -> Put
putWord8 Word8
14
THMessage a
StartRecover -> Word8 -> Put
putWord8 Word8
15
EndRecover Bool
a -> Word8 -> Put
putWord8 Word8
16 forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put Bool
a
THMessage a
FailIfErrs -> Word8 -> Put
putWord8 Word8
17
THMessage a
RunTHDone -> Word8 -> Put
putWord8 Word8
18
AddModFinalizer RemoteRef (Q ())
a -> Word8 -> Put
putWord8 Word8
19 forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put RemoteRef (Q ())
a
AddForeignFilePath ForeignSrcLang
lang String
a -> Word8 -> Put
putWord8 Word8
20 forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put ForeignSrcLang
lang forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put String
a
AddCorePlugin String
a -> Word8 -> Put
putWord8 Word8
21 forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put String
a
ReifyType Name
a -> Word8 -> Put
putWord8 Word8
22 forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put Name
a
PutDoc DocLoc
l String
s -> Word8 -> Put
putWord8 Word8
23 forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put DocLoc
l forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put String
s
GetDoc DocLoc
l -> Word8 -> Put
putWord8 Word8
24 forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put DocLoc
l
THMessage a
GetPackageRoot -> Word8 -> Put
putWord8 Word8
25
data EvalOpts = EvalOpts
{ EvalOpts -> Bool
useSandboxThread :: Bool
, EvalOpts -> Bool
singleStep :: Bool
, EvalOpts -> Bool
breakOnException :: Bool
, EvalOpts -> Bool
breakOnError :: Bool
}
deriving (forall x. Rep EvalOpts x -> EvalOpts
forall x. EvalOpts -> Rep EvalOpts x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EvalOpts x -> EvalOpts
$cfrom :: forall x. EvalOpts -> Rep EvalOpts x
Generic, Int -> EvalOpts -> ShowS
[EvalOpts] -> ShowS
EvalOpts -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EvalOpts] -> ShowS
$cshowList :: [EvalOpts] -> ShowS
show :: EvalOpts -> String
$cshow :: EvalOpts -> String
showsPrec :: Int -> EvalOpts -> ShowS
$cshowsPrec :: Int -> EvalOpts -> ShowS
Show)
instance Binary EvalOpts
data ResumeContext a = ResumeContext
{ forall a. ResumeContext a -> MVar ()
resumeBreakMVar :: MVar ()
, forall a. ResumeContext a -> MVar (EvalStatus a)
resumeStatusMVar :: MVar (EvalStatus a)
, forall a. ResumeContext a -> ThreadId
resumeThreadId :: ThreadId
}
data EvalExpr a
= EvalThis a
| EvalApp (EvalExpr a) (EvalExpr a)
deriving (forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall a x. Rep (EvalExpr a) x -> EvalExpr a
forall a x. EvalExpr a -> Rep (EvalExpr a) x
$cto :: forall a x. Rep (EvalExpr a) x -> EvalExpr a
$cfrom :: forall a x. EvalExpr a -> Rep (EvalExpr a) x
Generic, Int -> EvalExpr a -> ShowS
forall a. Show a => Int -> EvalExpr a -> ShowS
forall a. Show a => [EvalExpr a] -> ShowS
forall a. Show a => EvalExpr a -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EvalExpr a] -> ShowS
$cshowList :: forall a. Show a => [EvalExpr a] -> ShowS
show :: EvalExpr a -> String
$cshow :: forall a. Show a => EvalExpr a -> String
showsPrec :: Int -> EvalExpr a -> ShowS
$cshowsPrec :: forall a. Show a => Int -> EvalExpr a -> ShowS
Show)
instance Binary a => Binary (EvalExpr a)
type EvalStatus a = EvalStatus_ a a
data EvalStatus_ a b
= EvalComplete Word64 (EvalResult a)
| EvalBreak Bool
HValueRef
Int
Int
(RemoteRef (ResumeContext b))
(RemotePtr CostCentreStack)
deriving (forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall a b x. Rep (EvalStatus_ a b) x -> EvalStatus_ a b
forall a b x. EvalStatus_ a b -> Rep (EvalStatus_ a b) x
$cto :: forall a b x. Rep (EvalStatus_ a b) x -> EvalStatus_ a b
$cfrom :: forall a b x. EvalStatus_ a b -> Rep (EvalStatus_ a b) x
Generic, Int -> EvalStatus_ a b -> ShowS
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall a b. Show a => Int -> EvalStatus_ a b -> ShowS
forall a b. Show a => [EvalStatus_ a b] -> ShowS
forall a b. Show a => EvalStatus_ a b -> String
showList :: [EvalStatus_ a b] -> ShowS
$cshowList :: forall a b. Show a => [EvalStatus_ a b] -> ShowS
show :: EvalStatus_ a b -> String
$cshow :: forall a b. Show a => EvalStatus_ a b -> String
showsPrec :: Int -> EvalStatus_ a b -> ShowS
$cshowsPrec :: forall a b. Show a => Int -> EvalStatus_ a b -> ShowS
Show)
instance Binary a => Binary (EvalStatus_ a b)
data EvalResult a
= EvalException SerializableException
| EvalSuccess a
deriving (forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall a x. Rep (EvalResult a) x -> EvalResult a
forall a x. EvalResult a -> Rep (EvalResult a) x
$cto :: forall a x. Rep (EvalResult a) x -> EvalResult a
$cfrom :: forall a x. EvalResult a -> Rep (EvalResult a) x
Generic, Int -> EvalResult a -> ShowS
forall a. Show a => Int -> EvalResult a -> ShowS
forall a. Show a => [EvalResult a] -> ShowS
forall a. Show a => EvalResult a -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EvalResult a] -> ShowS
$cshowList :: forall a. Show a => [EvalResult a] -> ShowS
show :: EvalResult a -> String
$cshow :: forall a. Show a => EvalResult a -> String
showsPrec :: Int -> EvalResult a -> ShowS
$cshowsPrec :: forall a. Show a => Int -> EvalResult a -> ShowS
Show)
instance Binary a => Binary (EvalResult a)
data SerializableException
= EUserInterrupt
| EExitCode ExitCode
| EOtherException String
deriving (forall x. Rep SerializableException x -> SerializableException
forall x. SerializableException -> Rep SerializableException x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SerializableException x -> SerializableException
$cfrom :: forall x. SerializableException -> Rep SerializableException x
Generic, Int -> SerializableException -> ShowS
[SerializableException] -> ShowS
SerializableException -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SerializableException] -> ShowS
$cshowList :: [SerializableException] -> ShowS
show :: SerializableException -> String
$cshow :: SerializableException -> String
showsPrec :: Int -> SerializableException -> ShowS
$cshowsPrec :: Int -> SerializableException -> ShowS
Show)
toSerializableException :: SomeException -> SerializableException
toSerializableException :: SomeException -> SerializableException
toSerializableException SomeException
ex
| Just AsyncException
UserInterrupt <- forall e. Exception e => SomeException -> Maybe e
fromException SomeException
ex = SerializableException
EUserInterrupt
| Just (ExitCode
ec::ExitCode) <- forall e. Exception e => SomeException -> Maybe e
fromException SomeException
ex = (ExitCode -> SerializableException
EExitCode ExitCode
ec)
| Bool
otherwise = String -> SerializableException
EOtherException (forall a. Show a => a -> String
show (SomeException
ex :: SomeException))
fromSerializableException :: SerializableException -> SomeException
fromSerializableException :: SerializableException -> SomeException
fromSerializableException SerializableException
EUserInterrupt = forall e. Exception e => e -> SomeException
toException AsyncException
UserInterrupt
fromSerializableException (EExitCode ExitCode
c) = forall e. Exception e => e -> SomeException
toException ExitCode
c
fromSerializableException (EOtherException String
str) = forall e. Exception e => e -> SomeException
toException (String -> ErrorCall
ErrorCall String
str)
instance Binary ExitCode
instance Binary SerializableException
data THResult a
= THException String
| THComplete a
deriving (forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall a x. Rep (THResult a) x -> THResult a
forall a x. THResult a -> Rep (THResult a) x
$cto :: forall a x. Rep (THResult a) x -> THResult a
$cfrom :: forall a x. THResult a -> Rep (THResult a) x
Generic, Int -> THResult a -> ShowS
forall a. Show a => Int -> THResult a -> ShowS
forall a. Show a => [THResult a] -> ShowS
forall a. Show a => THResult a -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [THResult a] -> ShowS
$cshowList :: forall a. Show a => [THResult a] -> ShowS
show :: THResult a -> String
$cshow :: forall a. Show a => THResult a -> String
showsPrec :: Int -> THResult a -> ShowS
$cshowsPrec :: forall a. Show a => Int -> THResult a -> ShowS
Show)
instance Binary a => Binary (THResult a)
data THResultType = THExp | THPat | THType | THDec | THAnnWrapper
deriving (Int -> THResultType
THResultType -> Int
THResultType -> [THResultType]
THResultType -> THResultType
THResultType -> THResultType -> [THResultType]
THResultType -> THResultType -> THResultType -> [THResultType]
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
enumFromThenTo :: THResultType -> THResultType -> THResultType -> [THResultType]
$cenumFromThenTo :: THResultType -> THResultType -> THResultType -> [THResultType]
enumFromTo :: THResultType -> THResultType -> [THResultType]
$cenumFromTo :: THResultType -> THResultType -> [THResultType]
enumFromThen :: THResultType -> THResultType -> [THResultType]
$cenumFromThen :: THResultType -> THResultType -> [THResultType]
enumFrom :: THResultType -> [THResultType]
$cenumFrom :: THResultType -> [THResultType]
fromEnum :: THResultType -> Int
$cfromEnum :: THResultType -> Int
toEnum :: Int -> THResultType
$ctoEnum :: Int -> THResultType
pred :: THResultType -> THResultType
$cpred :: THResultType -> THResultType
succ :: THResultType -> THResultType
$csucc :: THResultType -> THResultType
Enum, Int -> THResultType -> ShowS
[THResultType] -> ShowS
THResultType -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [THResultType] -> ShowS
$cshowList :: [THResultType] -> ShowS
show :: THResultType -> String
$cshow :: THResultType -> String
showsPrec :: Int -> THResultType -> ShowS
$cshowsPrec :: Int -> THResultType -> ShowS
Show, forall x. Rep THResultType x -> THResultType
forall x. THResultType -> Rep THResultType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep THResultType x -> THResultType
$cfrom :: forall x. THResultType -> Rep THResultType x
Generic)
instance Binary THResultType
data QState = QState
{ QState -> Map TypeRep Dynamic
qsMap :: Map TypeRep Dynamic
, QState -> Maybe Loc
qsLocation :: Maybe TH.Loc
, QState -> Pipe
qsPipe :: Pipe
}
instance Show QState where show :: QState -> String
show QState
_ = String
"<QState>"
instance Binary (Ptr a) where
put :: Ptr a -> Put
put Ptr a
p = forall t. Binary t => t -> Put
put (forall a b. (Integral a, Num b) => a -> b
fromIntegral (forall a. Ptr a -> WordPtr
ptrToWordPtr Ptr a
p) :: Word64)
get :: Get (Ptr a)
get = (forall a. WordPtr -> Ptr a
wordPtrToPtr forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (Integral a, Num b) => a -> b
fromIntegral) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (forall t. Binary t => Get t
get :: Get Word64)
instance Binary (FunPtr a) where
put :: FunPtr a -> Put
put = forall t. Binary t => t -> Put
put forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. FunPtr a -> Ptr b
castFunPtrToPtr
get :: Get (FunPtr a)
get = forall a b. Ptr a -> FunPtr b
castPtrToFunPtr forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall t. Binary t => Get t
get
#ifndef MIN_VERSION_ghc_heap
#define MIN_VERSION_ghc_heap(major1,major2,minor) (\
(major1) < 9 || \
(major1) == 9 && (major2) < 5 || \
(major1) == 9 && (major2) == 5 && (minor) <= 20221001)
#endif /* MIN_VERSION_ghc_heap */
#if MIN_VERSION_ghc_heap(8,11,0)
instance Binary Heap.StgTSOProfInfo
instance Binary Heap.CostCentreStack
instance Binary Heap.CostCentre
instance Binary Heap.IndexTable
instance Binary Heap.WhatNext
instance Binary Heap.WhyBlocked
instance Binary Heap.TsoFlags
#endif
instance Binary Heap.StgInfoTable
instance Binary Heap.ClosureType
instance Binary Heap.PrimType
instance Binary a => Binary (Heap.GenClosure a)
data Msg = forall a . (Binary a, Show a) => Msg (Message a)
getMessage :: Get Msg
getMessage :: Get Msg
getMessage = do
Word8
b <- Get Word8
getWord8
case Word8
b of
Word8
0 -> forall a. (Binary a, Show a) => Message a -> Msg
Msg forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall (m :: * -> *) a. Monad m => a -> m a
return Message ()
Shutdown
Word8
1 -> forall a. (Binary a, Show a) => Message a -> Msg
Msg forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall (m :: * -> *) a. Monad m => a -> m a
return Message ()
InitLinker
Word8
2 -> forall a. (Binary a, Show a) => Message a -> Msg
Msg forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> String -> Message (Maybe (RemotePtr ()))
LookupSymbol forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall t. Binary t => Get t
get
Word8
3 -> forall a. (Binary a, Show a) => Message a -> Msg
Msg forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> String -> Message (Maybe HValueRef)
LookupClosure forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall t. Binary t => Get t
get
Word8
4 -> forall a. (Binary a, Show a) => Message a -> Msg
Msg forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> String -> Message (Maybe String)
LoadDLL forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall t. Binary t => Get t
get
Word8
5 -> forall a. (Binary a, Show a) => Message a -> Msg
Msg forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> String -> Message ()
LoadArchive forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall t. Binary t => Get t
get
Word8
6 -> forall a. (Binary a, Show a) => Message a -> Msg
Msg forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> String -> Message ()
LoadObj forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall t. Binary t => Get t
get
Word8
7 -> forall a. (Binary a, Show a) => Message a -> Msg
Msg forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> String -> Message ()
UnloadObj forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall t. Binary t => Get t
get
Word8
8 -> forall a. (Binary a, Show a) => Message a -> Msg
Msg forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> String -> Message (RemotePtr ())
AddLibrarySearchPath forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall t. Binary t => Get t
get
Word8
9 -> forall a. (Binary a, Show a) => Message a -> Msg
Msg forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> RemotePtr () -> Message Bool
RemoveLibrarySearchPath forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall t. Binary t => Get t
get
Word8
10 -> forall a. (Binary a, Show a) => Message a -> Msg
Msg forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall (m :: * -> *) a. Monad m => a -> m a
return Message Bool
ResolveObjs
Word8
11 -> forall a. (Binary a, Show a) => Message a -> Msg
Msg forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> String -> Message (Maybe String)
FindSystemLibrary forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall t. Binary t => Get t
get
Word8
12 -> forall a. (Binary a, Show a) => Message a -> Msg
Msg forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [ByteString] -> Message [HValueRef]
CreateBCOs forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall t. Binary t => Get t
get
Word8
13 -> forall a. (Binary a, Show a) => Message a -> Msg
Msg forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [HValueRef] -> Message ()
FreeHValueRefs forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall t. Binary t => Get t
get
Word8
14 -> forall a. (Binary a, Show a) => Message a -> Msg
Msg forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ByteString -> Message (RemotePtr ())
MallocData forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall t. Binary t => Get t
get
Word8
15 -> forall a. (Binary a, Show a) => Message a -> Msg
Msg forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [ByteString] -> Message [RemotePtr ()]
MallocStrings forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall t. Binary t => Get t
get
Word8
16 -> forall a. (Binary a, Show a) => Message a -> Msg
Msg forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (FFIConv -> [FFIType] -> FFIType -> Message (RemotePtr C_ffi_cif)
PrepFFI forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall t. Binary t => Get t
get forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall t. Binary t => Get t
get forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall t. Binary t => Get t
get)
Word8
17 -> forall a. (Binary a, Show a) => Message a -> Msg
Msg forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> RemotePtr C_ffi_cif -> Message ()
FreeFFI forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall t. Binary t => Get t
get
Word8
18 -> forall a. (Binary a, Show a) => Message a -> Msg
Msg forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Bool
-> Int
-> Int
-> Int
-> Int
-> ByteString
-> Message (RemotePtr StgInfoTable)
MkConInfoTable forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall t. Binary t => Get t
get forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall t. Binary t => Get t
get forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall t. Binary t => Get t
get forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall t. Binary t => Get t
get forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall t. Binary t => Get t
get forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall t. Binary t => Get t
get)
Word8
19 -> forall a. (Binary a, Show a) => Message a -> Msg
Msg forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (EvalOpts
-> EvalExpr HValueRef
-> Message (EvalStatus_ [HValueRef] [HValueRef])
EvalStmt forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall t. Binary t => Get t
get forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall t. Binary t => Get t
get)
Word8
20 -> forall a. (Binary a, Show a) => Message a -> Msg
Msg forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (EvalOpts
-> RemoteRef (ResumeContext [HValueRef])
-> Message (EvalStatus_ [HValueRef] [HValueRef])
ResumeStmt forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall t. Binary t => Get t
get forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall t. Binary t => Get t
get)
Word8
21 -> forall a. (Binary a, Show a) => Message a -> Msg
Msg forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (RemoteRef (ResumeContext [HValueRef]) -> Message ()
AbandonStmt forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall t. Binary t => Get t
get)
Word8
22 -> forall a. (Binary a, Show a) => Message a -> Msg
Msg forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (HValueRef -> Message (EvalResult String)
EvalString forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall t. Binary t => Get t
get)
Word8
23 -> forall a. (Binary a, Show a) => Message a -> Msg
Msg forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (HValueRef -> String -> Message (EvalResult String)
EvalStringToString forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall t. Binary t => Get t
get forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall t. Binary t => Get t
get)
Word8
24 -> forall a. (Binary a, Show a) => Message a -> Msg
Msg forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (HValueRef -> Message (EvalResult ())
EvalIO forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall t. Binary t => Get t
get)
Word8
25 -> forall a. (Binary a, Show a) => Message a -> Msg
Msg forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (String -> [(String, String)] -> Message [RemotePtr CostCentre]
MkCostCentres forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall t. Binary t => Get t
get forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall t. Binary t => Get t
get)
Word8
26 -> forall a. (Binary a, Show a) => Message a -> Msg
Msg forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (RemotePtr CostCentreStack -> Message [String]
CostCentreStackInfo forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall t. Binary t => Get t
get)
Word8
27 -> forall a. (Binary a, Show a) => Message a -> Msg
Msg forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Int -> Message (RemoteRef BreakArray)
NewBreakArray forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall t. Binary t => Get t
get)
Word8
28 -> forall a. (Binary a, Show a) => Message a -> Msg
Msg forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (RemoteRef BreakArray -> Int -> Int -> Message ()
SetupBreakpoint forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall t. Binary t => Get t
get forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall t. Binary t => Get t
get forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall t. Binary t => Get t
get)
Word8
29 -> forall a. (Binary a, Show a) => Message a -> Msg
Msg forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (RemoteRef BreakArray -> Int -> Message Bool
BreakpointStatus forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall t. Binary t => Get t
get forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall t. Binary t => Get t
get)
Word8
30 -> forall a. (Binary a, Show a) => Message a -> Msg
Msg forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (HValueRef -> Int -> Message (Maybe HValueRef)
GetBreakpointVar forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall t. Binary t => Get t
get forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall t. Binary t => Get t
get)
Word8
31 -> forall a. (Binary a, Show a) => Message a -> Msg
Msg forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall (m :: * -> *) a. Monad m => a -> m a
return Message (RemoteRef (IORef QState))
StartTH
Word8
32 -> forall a. (Binary a, Show a) => Message a -> Msg
Msg forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (RemoteRef (IORef QState)
-> [RemoteRef (Q ())] -> Message (QResult ())
RunModFinalizers forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall t. Binary t => Get t
get forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall t. Binary t => Get t
get)
Word8
33 -> forall a. (Binary a, Show a) => Message a -> Msg
Msg forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Fingerprint -> HValueRef -> Message ()
AddSptEntry forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall t. Binary t => Get t
get forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall t. Binary t => Get t
get)
Word8
34 -> forall a. (Binary a, Show a) => Message a -> Msg
Msg forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (RemoteRef (IORef QState)
-> HValueRef
-> THResultType
-> Maybe Loc
-> Message (QResult ByteString)
RunTH forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall t. Binary t => Get t
get forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall t. Binary t => Get t
get forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall t. Binary t => Get t
get forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall t. Binary t => Get t
get)
Word8
35 -> forall a. (Binary a, Show a) => Message a -> Msg
Msg forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (HValueRef -> Message (GenClosure HValueRef)
GetClosure forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall t. Binary t => Get t
get)
Word8
36 -> forall a. (Binary a, Show a) => Message a -> Msg
Msg forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (HValueRef -> Message (EvalStatus_ () ())
Seq forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall t. Binary t => Get t
get)
Word8
37 -> forall a. (Binary a, Show a) => Message a -> Msg
Msg forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall (m :: * -> *) a. Monad m => a -> m a
return Message ()
RtsRevertCAFs
Word8
38 -> forall a. (Binary a, Show a) => Message a -> Msg
Msg forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (RemoteRef (ResumeContext ()) -> Message (EvalStatus_ () ())
ResumeSeq forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall t. Binary t => Get t
get)
Word8
_ -> forall a. HasCallStack => String -> a
error forall a b. (a -> b) -> a -> b
$ String
"Unknown Message code " forall a. [a] -> [a] -> [a]
++ (forall a. Show a => a -> String
show Word8
b)
putMessage :: Message a -> Put
putMessage :: forall a. Message a -> Put
putMessage Message a
m = case Message a
m of
Message a
Shutdown -> Word8 -> Put
putWord8 Word8
0
Message a
InitLinker -> Word8 -> Put
putWord8 Word8
1
LookupSymbol String
str -> Word8 -> Put
putWord8 Word8
2 forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put String
str
LookupClosure String
str -> Word8 -> Put
putWord8 Word8
3 forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put String
str
LoadDLL String
str -> Word8 -> Put
putWord8 Word8
4 forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put String
str
LoadArchive String
str -> Word8 -> Put
putWord8 Word8
5 forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put String
str
LoadObj String
str -> Word8 -> Put
putWord8 Word8
6 forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put String
str
UnloadObj String
str -> Word8 -> Put
putWord8 Word8
7 forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put String
str
AddLibrarySearchPath String
str -> Word8 -> Put
putWord8 Word8
8 forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put String
str
RemoveLibrarySearchPath RemotePtr ()
ptr -> Word8 -> Put
putWord8 Word8
9 forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put RemotePtr ()
ptr
Message a
ResolveObjs -> Word8 -> Put
putWord8 Word8
10
FindSystemLibrary String
str -> Word8 -> Put
putWord8 Word8
11 forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put String
str
CreateBCOs [ByteString]
bco -> Word8 -> Put
putWord8 Word8
12 forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put [ByteString]
bco
FreeHValueRefs [HValueRef]
val -> Word8 -> Put
putWord8 Word8
13 forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put [HValueRef]
val
MallocData ByteString
bs -> Word8 -> Put
putWord8 Word8
14 forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put ByteString
bs
MallocStrings [ByteString]
bss -> Word8 -> Put
putWord8 Word8
15 forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put [ByteString]
bss
PrepFFI FFIConv
conv [FFIType]
args FFIType
res -> Word8 -> Put
putWord8 Word8
16 forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put FFIConv
conv forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put [FFIType]
args forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put FFIType
res
FreeFFI RemotePtr C_ffi_cif
p -> Word8 -> Put
putWord8 Word8
17 forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put RemotePtr C_ffi_cif
p
MkConInfoTable Bool
tc Int
p Int
n Int
t Int
pt ByteString
d -> Word8 -> Put
putWord8 Word8
18 forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put Bool
tc forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put Int
p forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put Int
n forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put Int
t forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put Int
pt forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put ByteString
d
EvalStmt EvalOpts
opts EvalExpr HValueRef
val -> Word8 -> Put
putWord8 Word8
19 forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put EvalOpts
opts forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put EvalExpr HValueRef
val
ResumeStmt EvalOpts
opts RemoteRef (ResumeContext [HValueRef])
val -> Word8 -> Put
putWord8 Word8
20 forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put EvalOpts
opts forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put RemoteRef (ResumeContext [HValueRef])
val
AbandonStmt RemoteRef (ResumeContext [HValueRef])
val -> Word8 -> Put
putWord8 Word8
21 forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put RemoteRef (ResumeContext [HValueRef])
val
EvalString HValueRef
val -> Word8 -> Put
putWord8 Word8
22 forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put HValueRef
val
EvalStringToString HValueRef
str String
val -> Word8 -> Put
putWord8 Word8
23 forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put HValueRef
str forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put String
val
EvalIO HValueRef
val -> Word8 -> Put
putWord8 Word8
24 forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put HValueRef
val
MkCostCentres String
mod [(String, String)]
ccs -> Word8 -> Put
putWord8 Word8
25 forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put String
mod forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put [(String, String)]
ccs
CostCentreStackInfo RemotePtr CostCentreStack
ptr -> Word8 -> Put
putWord8 Word8
26 forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put RemotePtr CostCentreStack
ptr
NewBreakArray Int
sz -> Word8 -> Put
putWord8 Word8
27 forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put Int
sz
SetupBreakpoint RemoteRef BreakArray
arr Int
ix Int
cnt -> Word8 -> Put
putWord8 Word8
28 forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put RemoteRef BreakArray
arr forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put Int
ix forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put Int
cnt
BreakpointStatus RemoteRef BreakArray
arr Int
ix -> Word8 -> Put
putWord8 Word8
29 forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put RemoteRef BreakArray
arr forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put Int
ix
GetBreakpointVar HValueRef
a Int
b -> Word8 -> Put
putWord8 Word8
30 forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put HValueRef
a forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put Int
b
Message a
StartTH -> Word8 -> Put
putWord8 Word8
31
RunModFinalizers RemoteRef (IORef QState)
a [RemoteRef (Q ())]
b -> Word8 -> Put
putWord8 Word8
32 forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put RemoteRef (IORef QState)
a forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put [RemoteRef (Q ())]
b
AddSptEntry Fingerprint
a HValueRef
b -> Word8 -> Put
putWord8 Word8
33 forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put Fingerprint
a forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put HValueRef
b
RunTH RemoteRef (IORef QState)
st HValueRef
q THResultType
loc Maybe Loc
ty -> Word8 -> Put
putWord8 Word8
34 forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put RemoteRef (IORef QState)
st forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put HValueRef
q forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put THResultType
loc forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put Maybe Loc
ty
GetClosure HValueRef
a -> Word8 -> Put
putWord8 Word8
35 forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put HValueRef
a
Seq HValueRef
a -> Word8 -> Put
putWord8 Word8
36 forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put HValueRef
a
Message a
RtsRevertCAFs -> Word8 -> Put
putWord8 Word8
37
ResumeSeq RemoteRef (ResumeContext ())
a -> Word8 -> Put
putWord8 Word8
38 forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put RemoteRef (ResumeContext ())
a
data Pipe = Pipe
{ Pipe -> Handle
pipeRead :: Handle
, Pipe -> Handle
pipeWrite :: Handle
, Pipe -> IORef (Maybe ByteString)
pipeLeftovers :: IORef (Maybe ByteString)
}
remoteCall :: Binary a => Pipe -> Message a -> IO a
remoteCall :: forall a. Binary a => Pipe -> Message a -> IO a
remoteCall Pipe
pipe Message a
msg = do
Pipe -> Put -> IO ()
writePipe Pipe
pipe (forall a. Message a -> Put
putMessage Message a
msg)
forall a. Pipe -> Get a -> IO a
readPipe Pipe
pipe forall t. Binary t => Get t
get
remoteTHCall :: Binary a => Pipe -> THMessage a -> IO a
remoteTHCall :: forall a. Binary a => Pipe -> THMessage a -> IO a
remoteTHCall Pipe
pipe THMessage a
msg = do
Pipe -> Put -> IO ()
writePipe Pipe
pipe (forall a. THMessage a -> Put
putTHMessage THMessage a
msg)
forall a. Pipe -> Get a -> IO a
readPipe Pipe
pipe forall t. Binary t => Get t
get
writePipe :: Pipe -> Put -> IO ()
writePipe :: Pipe -> Put -> IO ()
writePipe Pipe{Handle
IORef (Maybe ByteString)
pipeLeftovers :: IORef (Maybe ByteString)
pipeWrite :: Handle
pipeRead :: Handle
pipeLeftovers :: Pipe -> IORef (Maybe ByteString)
pipeWrite :: Pipe -> Handle
pipeRead :: Pipe -> Handle
..} Put
put
| ByteString -> Bool
LB.null ByteString
bs = forall (m :: * -> *) a. Monad m => a -> m a
return ()
| Bool
otherwise = do
Handle -> ByteString -> IO ()
LB.hPut Handle
pipeWrite ByteString
bs
Handle -> IO ()
hFlush Handle
pipeWrite
where
bs :: ByteString
bs = Put -> ByteString
runPut Put
put
readPipe :: Pipe -> Get a -> IO a
readPipe :: forall a. Pipe -> Get a -> IO a
readPipe Pipe{Handle
IORef (Maybe ByteString)
pipeLeftovers :: IORef (Maybe ByteString)
pipeWrite :: Handle
pipeRead :: Handle
pipeLeftovers :: Pipe -> IORef (Maybe ByteString)
pipeWrite :: Pipe -> Handle
pipeRead :: Pipe -> Handle
..} Get a
get = do
Maybe ByteString
leftovers <- forall a. IORef a -> IO a
readIORef IORef (Maybe ByteString)
pipeLeftovers
Maybe (a, Maybe ByteString)
m <- forall a.
Handle
-> Get a -> Maybe ByteString -> IO (Maybe (a, Maybe ByteString))
getBin Handle
pipeRead Get a
get Maybe ByteString
leftovers
case Maybe (a, Maybe ByteString)
m of
Maybe (a, Maybe ByteString)
Nothing -> forall a e. Exception e => e -> a
throw forall a b. (a -> b) -> a -> b
$
IOErrorType -> String -> Maybe Handle -> Maybe String -> IOError
mkIOError IOErrorType
eofErrorType String
"GHCi.Message.remoteCall" (forall a. a -> Maybe a
Just Handle
pipeRead) forall a. Maybe a
Nothing
Just (a
result, Maybe ByteString
new_leftovers) -> do
forall a. IORef a -> a -> IO ()
writeIORef IORef (Maybe ByteString)
pipeLeftovers Maybe ByteString
new_leftovers
forall (m :: * -> *) a. Monad m => a -> m a
return a
result
getBin
:: Handle -> Get a -> Maybe ByteString
-> IO (Maybe (a, Maybe ByteString))
getBin :: forall a.
Handle
-> Get a -> Maybe ByteString -> IO (Maybe (a, Maybe ByteString))
getBin Handle
h Get a
get Maybe ByteString
leftover = Maybe ByteString -> Decoder a -> IO (Maybe (a, Maybe ByteString))
go Maybe ByteString
leftover (forall a. Get a -> Decoder a
runGetIncremental Get a
get)
where
go :: Maybe ByteString -> Decoder a -> IO (Maybe (a, Maybe ByteString))
go Maybe ByteString
Nothing (Done ByteString
leftover Int64
_ a
msg) =
forall (m :: * -> *) a. Monad m => a -> m a
return (forall a. a -> Maybe a
Just (a
msg, if ByteString -> Bool
B.null ByteString
leftover then forall a. Maybe a
Nothing else forall a. a -> Maybe a
Just ByteString
leftover))
go Maybe ByteString
_ Done{} = forall e a. Exception e => e -> IO a
throwIO (String -> ErrorCall
ErrorCall String
"getBin: Done with leftovers")
go (Just ByteString
leftover) (Partial Maybe ByteString -> Decoder a
fun) = do
Maybe ByteString -> Decoder a -> IO (Maybe (a, Maybe ByteString))
go forall a. Maybe a
Nothing (Maybe ByteString -> Decoder a
fun (forall a. a -> Maybe a
Just ByteString
leftover))
go Maybe ByteString
Nothing (Partial Maybe ByteString -> Decoder a
fun) = do
ByteString
b <- Handle -> Int -> IO ByteString
B.hGetSome Handle
h (Int
32forall a. Num a => a -> a -> a
*Int
1024)
if ByteString -> Bool
B.null ByteString
b
then forall (m :: * -> *) a. Monad m => a -> m a
return forall a. Maybe a
Nothing
else Maybe ByteString -> Decoder a -> IO (Maybe (a, Maybe ByteString))
go forall a. Maybe a
Nothing (Maybe ByteString -> Decoder a
fun (forall a. a -> Maybe a
Just ByteString
b))
go Maybe ByteString
_lft (Fail ByteString
_rest Int64
_off String
str) =
forall e a. Exception e => e -> IO a
throwIO (String -> ErrorCall
ErrorCall (String
"getBin: " forall a. [a] -> [a] -> [a]
++ String
str))