summaryrefslogtreecommitdiff
path: root/compiler/ghci/DebuggerUtils.hs
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2012-07-24 20:26:52 +0100
committerIan Lynagh <igloo@earth.li>2012-07-24 20:41:06 +0100
commit229e9fc585b3003f2c26cbcf39f71a87514cd43d (patch)
tree8214619d18d6d4024dee307435ff9e46d4ee5dbb /compiler/ghci/DebuggerUtils.hs
parent4b18cc53a81634951cc72aa5c3e2123688b6f512 (diff)
downloadhaskell-229e9fc585b3003f2c26cbcf39f71a87514cd43d.tar.gz
Make -fscc-profiling a dynamic flag
All the flags that 'ways' imply are now dynamic
Diffstat (limited to 'compiler/ghci/DebuggerUtils.hs')
-rw-r--r--compiler/ghci/DebuggerUtils.hs13
1 files changed, 6 insertions, 7 deletions
diff --git a/compiler/ghci/DebuggerUtils.hs b/compiler/ghci/DebuggerUtils.hs
index 331c294973..19a3cbb721 100644
--- a/compiler/ghci/DebuggerUtils.hs
+++ b/compiler/ghci/DebuggerUtils.hs
@@ -36,9 +36,10 @@ import Data.List
--
dataConInfoPtrToName :: Ptr () -> TcM (Either String Name)
dataConInfoPtrToName x = do
+ dflags <- getDynFlags
theString <- liftIO $ do
let ptr = castPtr x :: Ptr StgInfoTable
- conDescAddress <- getConDescAddress ptr
+ conDescAddress <- getConDescAddress dflags ptr
peekArray0 0 conDescAddress
let (pkg, mod, occ) = parse theString
pkgFS = mkFastStringByteList pkg
@@ -46,7 +47,6 @@ dataConInfoPtrToName x = do
occFS = mkFastStringByteList occ
occName = mkOccNameFS OccName.dataName occFS
modName = mkModule (fsToPackageId pkgFS) (mkModuleNameFS modFS)
- dflags <- getDynFlags
return (Left $ showSDoc dflags $ ppr modName <> dot <> ppr occName)
`recoverM` (Right `fmap` lookupOrig modName occName)
@@ -92,14 +92,13 @@ dataConInfoPtrToName x = do
in the memory location: info_table_ptr + info_table_size
-}
- getConDescAddress :: Ptr StgInfoTable -> IO (Ptr Word8)
- getConDescAddress ptr
+ getConDescAddress :: DynFlags -> Ptr StgInfoTable -> IO (Ptr Word8)
+ getConDescAddress dflags ptr
| ghciTablesNextToCode = do
offsetToString <- peek $ ptr `plusPtr` (- wORD_SIZE)
- return $ (ptr `plusPtr` stdInfoTableSizeB) `plusPtr` (fromIntegral (offsetToString :: StgWord))
+ return $ (ptr `plusPtr` stdInfoTableSizeB dflags) `plusPtr` (fromIntegral (offsetToString :: StgWord))
| otherwise =
- peek $ intPtrToPtr $ (ptrToIntPtr ptr) + fromIntegral stdInfoTableSizeB
-
+ peek $ intPtrToPtr $ ptrToIntPtr ptr + fromIntegral (stdInfoTableSizeB dflags)
-- parsing names is a little bit fiddly because we have a string in the form:
-- pkg:A.B.C.foo, and we want to split it into three parts: ("pkg", "A.B.C", "foo").
-- Thus we split at the leftmost colon and the rightmost occurrence of the dot.