Skip to content

Uninitialised modBreaks_array

Loading GHC master into GHC 9.2.1's ghci and attempting to run :trace main results in an uninitialized modBreaks_array exception:

First apply this patch

diff --git a/hadrian/ghci-cabal.in b/hadrian/ghci-cabal.in
index 2a97b371802..f96919d91e1 100755
--- a/hadrian/ghci-cabal.in
+++ b/hadrian/ghci-cabal.in
@@ -6,4 +6,4 @@ set -e
 
 # Replace newlines with spaces, as these otherwise break the ghci invocation on windows.
 GHC_FLAGS="$GHC_FLAGS $(TERM=dumb CABFLAGS=-v0 "hadrian/build-cabal" tool:ghc/Main.hs -q --build-root=.hadrian_ghci --flavour=ghc-in-ghci $HADRIAN_ARGS | tr '\n\r' ' ')"
-@WithGhc@ --interactive $GHC_FLAGS $@ -fno-code -fwrite-interface -hidir=.hadrian_ghci/interface -O0 +RTS -A128m
+@WithGhc@ --interactive $GHC_FLAGS $@ -fwrite-interface -hidir=.hadrian_ghci/interface -O0 +RTS -A128m

Then

$ ./boot
$ ./configure GHC=ghc-9.2
$ hadrian/ghci
GHCi, version 9.2.1: https://www.haskell.org/ghc/  :? for help

[  1 of 668] Compiling GHC.Iface.Type[boot] ( /opt/exp/ghc/ghc-landing/compiler/GHC/Iface/Type.hs-boot, interpreted )
[  2 of 668] Compiling GHC.Platform.Constants ( /opt/exp/ghc/ghc-landing/.hadrian_ghci/stage0/compiler/build/GHC/Platform/Constants.hs, interpreted )
.
.
.
[668 of 668] Compiling Main             ( ghc/Main.hs, interpreted )
Ok, 668 modules loaded.
λ> import Main
λ> :set args -B/opt/exp/ghc/ghc-landing/_build/stage1/lib --version
λ> :trace main
The Glorious Glasgow Haskell Compilation System, version 9.3.20211027
λ> :set args -B/opt/exp/ghc/ghc-landing/_build/stage1/lib HelloWorld.hs
λ> main
[1 of 1] Compiling Main             ( HelloWorld.hs, HelloWorld.o )
Linking HelloWorld ...
λ> :! ./HelloWorld
"Hello World!"
λ> -- Sadly :trace doesn't quite work yet on main
λ> :trace main
*** Exception: ModBreaks.modBreaks_array not initialised
CallStack (from HasCallStack):
  error, called at compiler/GHC/ByteCode/Types.hs:231:24 in ghc:GHC.ByteCode.Types
Edited by Ben Gamari
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information