summaryrefslogtreecommitdiff
path: root/ghc
diff options
context:
space:
mode:
authorSimon Marlow <simonmar@microsoft.com>2009-05-06 19:48:02 +0000
committerSimon Marlow <simonmar@microsoft.com>2009-05-06 19:48:02 +0000
commit342b18fc5abca755d55a07449ea7183222782865 (patch)
tree6869578786e6b6b88cf5e44885803f29df0c8142 /ghc
parent058b5c20ba7bb3adc4f130ff24893c13941eca4d (diff)
downloadhaskell-342b18fc5abca755d55a07449ea7183222782865.tar.gz
#2197: try to detect when GHCi is compiled with -prof and emit an error message
Diffstat (limited to 'ghc')
-rw-r--r--ghc/InteractiveUI.hs8
1 files changed, 8 insertions, 0 deletions
diff --git a/ghc/InteractiveUI.hs b/ghc/InteractiveUI.hs
index 4aa441eb36..323dc259c7 100644
--- a/ghc/InteractiveUI.hs
+++ b/ghc/InteractiveUI.hs
@@ -38,6 +38,7 @@ import Outputable hiding (printForUser, printForUserPartWay)
import Module -- for ModuleEnv
import Name
import SrcLoc
+import ObjLink
-- Other random utilities
import CmdLineParser
@@ -285,6 +286,13 @@ findEditor = do
interactiveUI :: [(FilePath, Maybe Phase)] -> Maybe [String]
-> Ghc ()
interactiveUI srcs maybe_exprs = do
+ -- although GHCi compiles with -prof, it is not usable: the byte-code
+ -- compiler and interpreter don't work with profiling. So we check for
+ -- this up front and emit a helpful error message (#2197)
+ m <- liftIO $ lookupSymbol "PushCostCentre"
+ when (isJust m) $
+ ghcError (InstallationError "GHCi cannot be used when compiled with -prof")
+
-- HACK! If we happen to get into an infinite loop (eg the user
-- types 'let x=x in x' at the prompt), then the thread will block
-- on a blackhole, and become unreachable during GC. The GC will