eventlog2html and ghc-debug

On 1 December 2022, members of Well-Typed provided a video guide to profiling memory usage of Haskell applications with tools eventlog2html and ghc-debug. I wondered if they would work on Windows 11.

Building eventlog2html

I could build the executable provided by package eventlog2html-0.11.0 with a project level configuration file:

Update: Package eventlog2html-0.11.1, released 17 August 2024, is even simpler as the issue is fixed:

Applying eventlog2html

The Stack executable is built with GHC option -rtsopts, which is equivalent to -rtsopts=all. So, using Stack to build stack, after stack purge, with stack build +RTS -s -l -hT yields:

and eventlog2html stack.eventlog and start stack.eventlog.html yields a visualization of the heap by type of closure like:

Building ghc-debug-brick

I could build the executable provided by package ghc-debug-brick-0.6.0.0 with a project level configuration file:

stack install built the executable ghc-debug-brick and put it on the PATH.

An example debugee

The application to be debugged is known as a debugee. It has to depend on package ghc-debug-stub and that package, and one of its dependencies, is not included in Stackage snapshots. So, I added to package.yaml as a dependency and used the following project-level configuration:

However, the building of package ghc-debug-stub-0.6.0.0 failed with:

A StackOverflow question and answer implied that this could be problematic on Windows. Perhaps this was a dead end.

I identified that MSYS2 package msys2-runtime-devel (MSYS2 header and libraries) provided /usr/include/sys/socket.h, so I tried stack exec -- pacman -S msys2-runtime-devel.

Now the failure is (extracts):