Running ghc-debug on ghc
matthewtpickering at gmail.com
Tue Mar 9 15:22:41 UTC 2021
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
* The result is a ghc-debug enabled compiler
# Building a debugger
* Use the compiler you just built to build ghc-debug
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
* 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 -
These instructions are also in the instructions.md file in the commit.
More information about the ghc-devs