ghc-debug-stub-0.6.0.0: Functions for instrumenting your application so the heap can be analysed with ghc-debug-common.
Safe HaskellSafe-Inferred
LanguageHaskell2010

GHC.Debug.Stub

Description

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

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

Instances details
Show SocketAddr Source # 
Instance details

Defined in GHC.Debug.Stub

Eq SocketAddr Source # 
Instance details

Defined in GHC.Debug.Stub

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).

data Box Source #

Constructors

forall a. Box a 

resume :: IO () Source #

Resume program execution for debugging.