Running GHC in GHCi
Matthew Pickering
matthewtpickering at gmail.com
Thu Oct 28 07:52:18 UTC 2021
Looks good Ben.
Would it be good to add a target to hadrian which builds just the
right dependencies for this to work? and then deals with setting
options such as -B as well.
Matt
On Thu, Oct 28, 2021 at 5:26 AM Bryan Richter <b at chreekat.net> wrote:
>
> That's very exciting!
>
> On Thu, 28 Oct 2021, 3.08 Ben Gamari, <ben at well-typed.com> wrote:
>>
>> 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
>> _______________________________________________
>> ghc-devs mailing list
>> ghc-devs at haskell.org
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
>
> _______________________________________________
> ghc-devs mailing list
> ghc-devs at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
More information about the ghc-devs
mailing list