Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
This module provides the functions you need to use to instrument your application
so it can be debugged using ghc-debug. Usually all you need to do is to
wrap the main function with the withGhcDebug
wrapper.
main = withGhcDebug $ do ...
Then when you application starts, a socket will be created which the debugger
can be attached to. The location of the socket is controlled by the GHC_DEBUG_SOCKET
environment variable.
Synopsis
- withGhcDebug :: IO a -> IO a
- withGhcDebugUnix :: String -> IO a -> IO a
- withGhcDebugTCP :: String -> Word16 -> IO a -> IO a
- data SocketAddr
- withGhcDebugX :: SocketAddr -> IO a -> IO a
- saveClosures :: [Box] -> IO ()
- data Box = forall a. Box a
- pause :: IO ()
- resume :: IO ()
Documentation
withGhcDebug :: IO a -> IO a Source #
Start listening on a unix domain for remote debugging. You should wrap your main thread in this as it performs some cleanup on exit. If not used on the Main thread, user interupt (Ctrl-C) may skip the cleanup step.
By default the socket is created by referring to socketDirectory
which is
in your XDG data directory.
The socket created can also be controlled using the GHC_DEBUG_SOCKET
environment variable.
withGhcDebugUnix :: String -> IO a -> IO a Source #
Similar to withGhcDebug
, but with an explicit socket path
The file directory will be created automatically if it does not exist.
main = withGhcDebugUnix "/tmp/ghc-debug" $ do ...
withGhcDebugTCP :: String -> Word16 -> IO a -> IO a Source #
Start listening on a tcp for remote debugging.
main = withGhcDebugTCP "127.0.0.1" 1235 $ do ...
data SocketAddr Source #
Instances
Show SocketAddr Source # | |
Defined in GHC.Debug.Stub showsPrec :: Int -> SocketAddr -> ShowS # show :: SocketAddr -> String # showList :: [SocketAddr] -> ShowS # | |
Eq SocketAddr Source # | |
Defined in GHC.Debug.Stub (==) :: SocketAddr -> SocketAddr -> Bool # (/=) :: SocketAddr -> SocketAddr -> Bool # |
withGhcDebugX :: SocketAddr -> IO a -> IO a Source #
saveClosures :: [Box] -> IO () Source #
Mark a set of closures to be saved, they can then be retrieved from
the debugger using the RequestSavedClosures
requests. This can be
useful to transmit specific closures you care about (such as a cache or
large map).