Running GHC in GHCi

Ben Gamari ben at well-typed.com
Thu Oct 28 00:08:26 UTC 2021


Ben Gamari <ben at well-typed.com> writes:

> Hi all,
>
> Today I verified that with Luite's recent work on the interpreter it is
> now possible to run GHC entirely within GHCi (when bootstrapping from
> GHC 9.2).
> 
> ...
>
I have fixed the break-array issue noted in the above message in !6848.
It is now possible to use `:trace` on GHC itself:


$ hadrian/ghci
GHCi, version 9.2.1: https://www.haskell.org/ghc/  :? for help
.
.
.
λ> import Main
λ> :set args -B/opt/exp/ghc/ghc-landing/_build/stage1/lib Hi.hs -v3 -fforce-recomp
λ> :set -fbreak-on-error
λ> :trace main
Glasgow Haskell Compiler, Version 9.3.20211027, stage 1 booted by GHC version 9.2.1
^CStopped in <exception thrown>, <unknown>
_exception :: e = _
[<unknown>] λ> :hist
-1  : fromException (/opt/exp/ghc/ghc-landing/compiler/GHC/Utils/Panic.hs:114:19-24)
-2  : uniq (/opt/exp/ghc/ghc-landing/compiler/GHC/Data/FastString.hs:205:7-10)
-3  : moduleNameFS (/opt/exp/ghc/ghc-landing/compiler/GHC/Unit/Module/Name.hs:72:33-35)
-4  : stableModuleNameCmp (/opt/exp/ghc/ghc-landing/compiler/GHC/Unit/Module/Name.hs:62:64-78)
-5  : lexicalCompareFS (/opt/exp/ghc/ghc-landing/compiler/GHC/Data/FastString.hs:252:18-25)
-6  : uniq (/opt/exp/ghc/ghc-landing/compiler/GHC/Data/FastString.hs:205:7-10)
-7  : moduleNameFS (/opt/exp/ghc/ghc-landing/compiler/GHC/Unit/Module/Name.hs:72:33-35)
-8  : stableModuleNameCmp (/opt/exp/ghc/ghc-landing/compiler/GHC/Unit/Module/Name.hs:62:29-43)
-9  : lexicalCompareFS (/opt/exp/ghc/ghc-landing/compiler/GHC/Data/FastString.hs:252:6-13)
-10 : lexicalCompareFS (/opt/exp/ghc/ghc-landing/compiler/GHC/Data/FastString.hs:252:6-25)
-11 : lexicalCompareFS (/opt/exp/ghc/ghc-landing/compiler/GHC/Data/FastString.hs:(252,3)-(253,54))
-12 : stableModuleNameCmp (/opt/exp/ghc/ghc-landing/compiler/GHC/Unit/Module/Name.hs:62:29-78)
-13 : compare (/opt/exp/ghc/ghc-landing/compiler/GHC/Unit/Module/Name.hs:42:23-49)
-14 : fs_sbs (/opt/exp/ghc/ghc-landing/compiler/GHC/Data/FastString.hs:207:7-12)
-15 : lexicalCompareFS (/opt/exp/ghc/ghc-landing/compiler/GHC/Data/FastString.hs:253:44-53)
-16 : fs_sbs (/opt/exp/ghc/ghc-landing/compiler/GHC/Data/FastString.hs:207:7-12)
-17 : lexicalCompareFS (/opt/exp/ghc/ghc-landing/compiler/GHC/Data/FastString.hs:253:31-40)
-18 : lexicalCompareFS (/opt/exp/ghc/ghc-landing/compiler/GHC/Data/FastString.hs:253:3-54)
-19 : uniq (/opt/exp/ghc/ghc-landing/compiler/GHC/Data/FastString.hs:205:7-10)
-20 : moduleNameFS (/opt/exp/ghc/ghc-landing/compiler/GHC/Unit/Module/Name.hs:72:33-35)
...
[<unknown>] λ> :back
Logged breakpoint at /opt/exp/ghc/ghc-landing/compiler/GHC/Utils/Panic.hs:114:19-24
_result :: Maybe GHC.Utils.Panic.Plain.PlainGhcException
e :: SomeAsyncException
[-1: /opt/exp/ghc/ghc-landing/compiler/GHC/Utils/Panic.hs:114:19-24] λ> :back
Logged breakpoint at /opt/exp/ghc/ghc-landing/compiler/GHC/Data/FastString.hs:205:7-10
_result :: Int
uniq :: Int
[-2: /opt/exp/ghc/ghc-landing/compiler/GHC/Data/FastString.hs:205:7-10] λ> uniq
603980920
[-2: /opt/exp/ghc/ghc-landing/compiler/GHC/Data/FastString.hs:205:7-10] λ> :back
Logged breakpoint at /opt/exp/ghc/ghc-landing/compiler/GHC/Unit/Module/Name.hs:72:33-35
_result :: ModuleName
mod :: ModuleName
[-3: /opt/exp/ghc/ghc-landing/compiler/GHC/Unit/Module/Name.hs:72:33-35] λ> mod
ModuleName "GHC.Tc.Solver.Canonical"

et cetera
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 905 bytes
Desc: not available
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20211027/44d44c68/attachment.sig>


More information about the ghc-devs mailing list