haskell-debugger
Safe HaskellNone
LanguageGHC2021

GHC.Debugger.Runtime.Eval.RemoteExpr

Description

A DSL for evaluating remote expressions on the (possibly) remote debuggee process

Meant to be imported qualified as Remote for use with QualifiedDo.

import GHC.Debugger.Runtime.Eval.RemoteExpr (RemoteExpr)
import qualified GHC.Debugger.Runtime.Eval.RemoteExpr as Remote
Synopsis

Building remote expressions

data RemoteExpr (t :: TYPE ('BoxedRep l)) Source #

A remote expression to be evaluated on the debuggee process. Note: the remote expression must have a boxed representation type.

Instances

Instances details
Show (RemoteExpr a) Source # 
Instance details

Defined in GHC.Debugger.Runtime.Eval.RemoteExpr

var :: ModuleName -> String -> [String] -> RemoteExpr a Source #

Apply a remote function to a remote argument to get a remote result

ref :: ForeignRef a -> RemoteExpr a Source #

A reference to a value in the debuggee heap

untypedRef :: forall {l :: Levity} (a :: TYPE ('BoxedRep l)). ForeignHValue -> RemoteExpr a Source #

A reference to a value in the debuggee heap

lit :: Int -> RemoteExpr Int Source #

A literal unboxed int

raw :: String -> RemoteExpr a Source #

A raw expression string to be parsed, compiled, and loaded onto the remote process

app :: forall {l :: Levity} (a :: TYPE ('BoxedRep l)) b. RemoteExpr (a -> b) -> RemoteExpr a -> RemoteExpr b Source #

Apply a remote function to a remote argument to get a remote result

appRef :: RemoteExpr (a -> b) -> ForeignRef a -> RemoteExpr b Source #

Apply a remote function to a remote ForeignRef to get a remote result

withUnboxed :: RemoteExpr Int -> RemoteExpr (Int# -> b) -> RemoteExpr b Source #

Apply a remote function after unboxing a remote int argument (We need to unbox the Int on the debuggee side)

fmap :: (RemoteExpr a -> RemoteExpr b) -> RemoteExpr (IO a) -> RemoteExpr (IO b) Source #

IO fmap on the remote process

(<$>) :: (RemoteExpr a -> RemoteExpr b) -> RemoteExpr (IO a) -> RemoteExpr (IO b) Source #

IO fmap on the remote process

pure :: RemoteExpr a -> RemoteExpr (IO a) Source #

IO pure on the remote process

return :: RemoteExpr a -> RemoteExpr (IO a) Source #

IO return on the remote process

(>>=) :: RemoteExpr (IO a) -> (RemoteExpr a -> RemoteExpr (IO b)) -> RemoteExpr (IO b) Source #

IO monadic bind on the remote process

(>>) :: RemoteExpr (IO a) -> RemoteExpr (IO b) -> RemoteExpr (IO b) Source #

IO monadic bind on the remote process

Evaluating remote expressions

eval :: RemoteExpr a -> Debugger (Either BadEvalStatus (ForeignRef a)) Source #

Evaluate a a expression on the remote process and return the foreign reference to the result.

evalIO :: RemoteExpr (IO a) -> Debugger (Either BadEvalStatus (ForeignRef a)) Source #

Run an IO a computation in the remote process and return the foreign reference to the returned a

evalString :: RemoteExpr String -> Debugger (Either BadEvalStatus String) Source #

Evaluate a string expression on the remote process and return the string to the debugger

evalIOList :: RemoteExpr (IO [a]) -> Debugger (Either BadEvalStatus [ForeignRef a]) Source #

Evaluate a RemoteExpr for a remote IO [a] and return a list of ForeignHValue with one element per returned a.

Example

Expand
Remote.evalIOList $ Remote.do
  clonedStack <- Remote.cloneThreadStack appRef threadIdRef
  frames      <- Remote.decodeStack      app    clonedStack
  return (Remote.ssc_stack app frames)

evalIOString :: RemoteExpr (IO String) -> Debugger (Either BadEvalStatus String) Source #

Execute an IO String on the remote process and serialize the string back to the debugger.