Running ghc-debug on ghc

Carter Schonwald carter.schonwald at gmail.com
Tue Mar 9 15:27:27 UTC 2021


This looks really cool!
So it’s like a debugger that can also do heap introspection profiling as a
consequence of being able to inspect the state as part of debugging?

On Tue, Mar 9, 2021 at 10:23 AM Matthew Pickering <
matthewtpickering at gmail.com> wrote:

> Hi,
>
> I now have some simple instructions for running ghc-debug on GHC.
>
> 1. Cherry-pick 4be70967f1f1ab70cbe31aad8ae69aea87c6f4c4
>
> commit 4be70967f1f1ab70cbe31aad8ae69aea87c6f4c4 (HEAD ->
> wip/ghc-with-debug)
> Author: Matthew Pickering <matthewtpickering at gmail.com>
> Date:   Fri Jan 8 11:26:17 2021 +0000
>
>     Add support for ghc-debug to ghc executable
>
> 2. Build GHC
> * Add the following to _build/hadrian.settings
>
> ```
> stage1.*.ghc.hs.opts += -finfo-table-map -fdistinct-constructor-tables
> ```
>
> * Build GHC as normal
>
> ```
> ./hadrian/build -j8
> ```
>
> * The result is a ghc-debug enabled compiler
>
> # Building a debugger
>
> * Use the compiler you just built to build ghc-debug
>
> ```
> cd ghc-debug
> cabal update
> cabal new-build debugger -w ../_build/stage1/bin/ghc
> ```
>
> # Running the debugger
>
> Modify `test/Test.hs` to implement the debugging thing you want to do.
> Perhaps
> start with `p30`, which is a program to generate a profile.
>
>
> * Start the process you want to debug
> ```
> GHC_DEBUG_SOCKET=/tmp/ghc-debug build-cabal
> ```
>
> * Start the debugger
> ```
> cabal new-run debugger -w ...
> ```
>
> * Open a ticket about the memory issue you find.
>
> There is the start of some more documentation here -
> http://ghc.gitlab.haskell.org/ghc-debug/docs.html
>
> These instructions are also in the instructions.md file in the commit.
>
> Cheers,
>
> Matt
> _______________________________________________
> ghc-devs mailing list
> ghc-devs at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20210309/0dc8f0a6/attachment.html>


More information about the ghc-devs mailing list