{-# LANGUAGE CPP, NamedFieldPuns, TupleSections, LambdaCase, DuplicateRecordFields, RecordWildCards, TupleSections, ViewPatterns, TypeApplications, ScopedTypeVariables, BangPatterns #-} module GHC.Debugger.Utils ( module GHC.Debugger.Utils , module GHC.Utils.Outputable , module GHC.Utils.Trace ) where import GHC import GHC.Data.FastString import GHC.Driver.DynFlags import GHC.Driver.Ppr import GHC.Utils.Outputable import GHC.Utils.Trace import GHC.Debugger.Monad import GHC.Debugger.Interface.Messages -------------------------------------------------------------------------------- -- * GHC Utilities -------------------------------------------------------------------------------- -- | Convert a GHC's src span into an interface one realSrcSpanToSourceSpan :: RealSrcSpan -> SourceSpan realSrcSpanToSourceSpan ss = SourceSpan { file = unpackFS $ srcSpanFile ss , startLine = srcSpanStartLine ss , startCol = srcSpanStartCol ss , endLine = srcSpanEndLine ss , endCol = srcSpanEndCol ss } -- | Display an Outputable value as a String display :: Outputable a => a -> Debugger String display x = do dflags <- getDynFlags return $ showSDoc dflags (ppr x) {-# INLINE display #-}