ghc-debug-stub-0.3.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 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.

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.