diff options
author | Alp Mestanogullari <alpmestan@gmail.com> | 2019-04-12 19:47:12 +0200 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-04-18 08:18:18 -0400 |
commit | 4c8a67a4b025774993b80442fb3654c8868c1d24 (patch) | |
tree | 42c776d4db782b9e13f68d751e9000c15af9b159 /hadrian | |
parent | e28706ea0d7b8115716926d0016cd070ab5ab326 (diff) | |
download | haskell-4c8a67a4b025774993b80442fb3654c8868c1d24.tar.gz |
Hadrian: fix ghcDebugged and document it
Diffstat (limited to 'hadrian')
-rw-r--r-- | hadrian/doc/user-settings.md | 15 | ||||
-rw-r--r-- | hadrian/src/Expression.hs | 5 | ||||
-rw-r--r-- | hadrian/src/Packages.hs | 10 | ||||
-rw-r--r-- | hadrian/src/Settings/Builders/Ghc.hs | 5 |
4 files changed, 30 insertions, 5 deletions
diff --git a/hadrian/doc/user-settings.md b/hadrian/doc/user-settings.md index b6b44521cc..6b1849f479 100644 --- a/hadrian/doc/user-settings.md +++ b/hadrian/doc/user-settings.md @@ -114,6 +114,21 @@ devel2WerrorFlavour :: Flavour devel2WerrorFlavour = werror (developmentFlavour Stage2) ``` +### Linking GHC against the debugged RTS + +What was previously achieved by having `GhcDebugged=YES` in `mk/build.mk` can +be done by defining a custom flavour in the user settings file, one that +sets the `ghcDebugged` field of `Flavour` to `True`, e.g: + +``` haskell +quickDebug :: Flavour +quickDebug = quickFlavour { name = "dbg", ghcDebugged = True } +``` + +Running `build --flavour=dbg` will build a `quick`-flavoured GHC and link +GHC, iserv, iserv-proxy and remote-iserv against the debugged RTS, by passing +`-debug` to the commands that link those executables. + ## Packages Users can add and remove packages from particular build stages. As an example, diff --git a/hadrian/src/Expression.hs b/hadrian/src/Expression.hs index a520c0ba5d..197827a5f0 100644 --- a/hadrian/src/Expression.hs +++ b/hadrian/src/Expression.hs @@ -7,7 +7,7 @@ module Expression ( -- ** Predicates (?), stage, stage0, stage1, stage2, notStage0, package, notPackage, - libraryPackage, builder, way, input, inputs, output, outputs, + packageOneOf, libraryPackage, builder, way, input, inputs, output, outputs, -- ** Evaluation interpret, interpretInContext, @@ -44,6 +44,9 @@ stage s = (s ==) <$> getStage package :: Package -> Predicate package p = (p ==) <$> getPackage +packageOneOf :: [Package] -> Predicate +packageOneOf ps = (`elem` ps) <$> getPackage + -- | This type class allows the user to construct both precise builder -- predicates, such as @builder (Ghc CompileHs Stage1)@, as well as predicates -- covering a set of similar builders. For example, @builder (Ghc CompileHs)@ diff --git a/hadrian/src/Packages.hs b/hadrian/src/Packages.hs index 2738c6952d..f5e3a64df5 100644 --- a/hadrian/src/Packages.hs +++ b/hadrian/src/Packages.hs @@ -5,10 +5,10 @@ module Packages ( compareSizes, compiler, containers, deepseq, deriveConstants, directory, filepath, genapply, genprimopcode, ghc, ghcBoot, ghcBootTh, ghcCompact, ghcHeap, ghci, ghcPkg, ghcPrim, haddock, haskeline, - hsc2hs, hp2ps, hpc, hpcBin, integerGmp, integerSimple, iserv, libffi, - libiserv, mtl, parsec, pretty, primitive, process, rts, runGhc, - stm, templateHaskell, terminfo, text, time, timeout, touchy, transformers, - unlit, unix, win32, xhtml, ghcPackages, isGhcPackage, + hsc2hs, hp2ps, hpc, hpcBin, integerGmp, integerSimple, iserv, iservProxy, + libffi, libiserv, mtl, parsec, pretty, primitive, process, remoteIserv, rts, + runGhc, stm, templateHaskell, terminfo, text, time, timeout, touchy, + transformers, unlit, unix, win32, xhtml, ghcPackages, isGhcPackage, -- * Package information programName, nonHsMainPackage, autogenPath, programPath, timeoutPath, @@ -78,6 +78,7 @@ hpcBin = util "hpc-bin" `setPath` "utils/hpc" integerGmp = lib "integer-gmp" integerSimple = lib "integer-simple" iserv = util "iserv" +iservProxy = util "iserv-proxy" libffi = top "libffi" libiserv = lib "libiserv" mtl = lib "mtl" @@ -85,6 +86,7 @@ parsec = lib "parsec" pretty = lib "pretty" primitive = lib "primitive" process = lib "process" +remoteIserv = util "remote-iserv" rts = top "rts" runGhc = util "runghc" stm = lib "stm" diff --git a/hadrian/src/Settings/Builders/Ghc.hs b/hadrian/src/Settings/Builders/Ghc.hs index 7b0011c490..81fc9d183a 100644 --- a/hadrian/src/Settings/Builders/Ghc.hs +++ b/hadrian/src/Settings/Builders/Ghc.hs @@ -3,6 +3,7 @@ module Settings.Builders.Ghc (ghcBuilderArgs, haddockGhcArgs) where import Hadrian.Haskell.Cabal import Hadrian.Haskell.Cabal.Type +import Flavour import Packages import Settings.Builders.Common import Settings.Warnings @@ -69,6 +70,7 @@ ghcLinkArgs = builder (Ghc LinkHs) ? do useSystemFfi <- expr (flag UseSystemFfi) buildPath <- getBuildPath libffiName' <- libffiName + debugged <- ghcDebugged <$> expr flavour let dynamic = Dynamic `wayUnit` way @@ -110,6 +112,9 @@ ghcLinkArgs = builder (Ghc LinkHs) ? do , pure [ "-L" ++ libDir | libDir <- libDirs ] , rtsFfiArg , darwin ? pure (concat [ ["-framework", fmwk] | fmwk <- fmwks ]) + , debugged ? packageOneOf [ghc, iservProxy, iserv, remoteIserv] ? + arg "-debug" + ] findHsDependencies :: Args |