<div dir="auto">This looks really cool! </div><div dir="auto">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?</div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Mar 9, 2021 at 10:23 AM Matthew Pickering <<a href="mailto:matthewtpickering@gmail.com">matthewtpickering@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
I now have some simple instructions for running ghc-debug on GHC.<br>
<br>
1. Cherry-pick 4be70967f1f1ab70cbe31aad8ae69aea87c6f4c4<br>
<br>
commit 4be70967f1f1ab70cbe31aad8ae69aea87c6f4c4 (HEAD -> wip/ghc-with-debug)<br>
Author: Matthew Pickering <<a href="mailto:matthewtpickering@gmail.com" target="_blank">matthewtpickering@gmail.com</a>><br>
Date:   Fri Jan 8 11:26:17 2021 +0000<br>
<br>
    Add support for ghc-debug to ghc executable<br>
<br>
2. Build GHC<br>
* Add the following to _build/hadrian.settings<br>
<br>
```<br>
stage1.*.ghc.hs.opts += -finfo-table-map -fdistinct-constructor-tables<br>
```<br>
<br>
* Build GHC as normal<br>
<br>
```<br>
./hadrian/build -j8<br>
```<br>
<br>
* The result is a ghc-debug enabled compiler<br>
<br>
# Building a debugger<br>
<br>
* Use the compiler you just built to build ghc-debug<br>
<br>
```<br>
cd ghc-debug<br>
cabal update<br>
cabal new-build debugger -w ../_build/stage1/bin/ghc<br>
```<br>
<br>
# Running the debugger<br>
<br>
Modify `test/Test.hs` to implement the debugging thing you want to do. Perhaps<br>
start with `p30`, which is a program to generate a profile.<br>
<br>
<br>
* Start the process you want to debug<br>
```<br>
GHC_DEBUG_SOCKET=/tmp/ghc-debug build-cabal<br>
```<br>
<br>
* Start the debugger<br>
```<br>
cabal new-run debugger -w ...<br>
```<br>
<br>
* Open a ticket about the memory issue you find.<br>
<br>
There is the start of some more documentation here -<br>
<a href="http://ghc.gitlab.haskell.org/ghc-debug/docs.html" rel="noreferrer" target="_blank">http://ghc.gitlab.haskell.org/ghc-debug/docs.html</a><br>
<br>
These instructions are also in the instructions.md file in the commit.<br>
<br>
Cheers,<br>
<br>
Matt<br>
_______________________________________________<br>
ghc-devs mailing list<br>
<a href="mailto:ghc-devs@haskell.org" target="_blank">ghc-devs@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs</a><br>
</blockquote></div></div>