diff options
Diffstat (limited to 'ghc')
-rw-r--r-- | ghc/Main.hs | 18 | ||||
-rw-r--r-- | ghc/ghc-bin.cabal.in | 9 |
2 files changed, 25 insertions, 2 deletions
diff --git a/ghc/Main.hs b/ghc/Main.hs index ae862a7014..5f854b6565 100644 --- a/ghc/Main.hs +++ b/ghc/Main.hs @@ -32,6 +32,7 @@ import GHC.Driver.Backpack ( doBackpack ) import GHC.Driver.Plugins import GHC.Driver.Config.Logger (initLogFlags) import GHC.Driver.Config.Diagnostic +import GHC.Driver.Monad import GHC.Platform import GHC.Platform.Ways @@ -99,6 +100,10 @@ import Data.Bifunctor import GHC.Data.Graph.Directed import qualified Data.List.NonEmpty as NE +#if defined(GHC_DEBUG) +import GHC.Debug.Stub +#endif + ----------------------------------------------------------------------------- -- ToDo: @@ -111,6 +116,13 @@ import qualified Data.List.NonEmpty as NE ----------------------------------------------------------------------------- -- GHC's command-line interface +debugWrapper :: IO a -> IO a +#if defined(GHC_DEBUG) +debugWrapper = withGhcDebug +#else +debugWrapper = id +#endif + main :: IO () main = do hSetBuffering stdout LineBuffering @@ -159,8 +171,10 @@ main = do ShowGhcUsage -> showGhcUsage dflags ShowGhciUsage -> showGhciUsage dflags PrintWithDynFlags f -> putStrLn (f dflags) - Right postLoadMode -> - main' postLoadMode units dflags argv3 flagWarnings + Right postLoadMode -> do + reifyGhc $ \session -> debugWrapper $ + reflectGhc (main' postLoadMode units dflags argv3 flagWarnings) session + main' :: PostLoadMode -> [String] -> DynFlags -> [Located String] -> [Warn] -> Ghc () diff --git a/ghc/ghc-bin.cabal.in b/ghc/ghc-bin.cabal.in index 88e559048c..5cde07bc6a 100644 --- a/ghc/ghc-bin.cabal.in +++ b/ghc/ghc-bin.cabal.in @@ -22,6 +22,11 @@ Flag internal-interpreter Default: False Manual: True +Flag ghc-debug + Description: Build with support for ghc-debug. + Default: False + Manual: True + Flag threaded Description: Link the ghc executable against the threaded RTS Default: True @@ -42,6 +47,10 @@ Executable ghc ghc-boot == @ProjectVersionMunged@, ghc == @ProjectVersionMunged@ + if flag(ghc-debug) + build-depends: ghc-debug-stub + CPP-OPTIONS: -DGHC_DEBUG + if os(windows) Build-Depends: Win32 >= 2.3 && < 2.14 else |