diff options
author | Simon Marlow <marlowsd@gmail.com> | 2015-10-31 17:38:34 +0000 |
---|---|---|
committer | Simon Marlow <marlowsd@gmail.com> | 2015-12-21 18:51:26 +0000 |
commit | c8c44fd91b509b9eb644c826497ed5268e89363a (patch) | |
tree | 90bc2f24a7886afb8f0036b322f839168c880057 /compiler/ghci/Linker.hs | |
parent | ee6fba89b066fdf8408e6a18db343a4177e613f6 (diff) | |
download | haskell-c8c44fd91b509b9eb644c826497ed5268e89363a.tar.gz |
Maintain cost-centre stacks in the interpreter
Summary:
Breakpoints become SCCs, so we have detailed call-stack info for
interpreted code. Currently this only works when GHC is compiled with
-prof, but D1562 (Remote GHCi) removes this constraint so that in the
future call stacks will be available without building your own GHCi.
How can you get a stack trace?
* programmatically: GHC.Stack.currentCallStack
* I've added an experimental :where command that shows the stack when
stopped at a breakpoint
* `error` attaches a call stack automatically, although since calls to
`error` are often lifted out to the top level, this is less useful
than it might be (ImplicitParams still works though).
* Later we might attach call stacks to all exceptions
Other related changes in this diff:
* I reduced the number of places that get ticks attached for
breakpoints. In particular there was a breakpoint around the whole
declaration, which was often redundant because it bound no variables.
This reduces clutter in the stack traces and speeds up compilation.
* I tidied up some RealSrcSpan stuff in InteractiveUI, and made a few
other small cleanups
Test Plan: validate
Reviewers: ezyang, bgamari, austin, hvr
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1595
GHC Trac Issues: #11047
Diffstat (limited to 'compiler/ghci/Linker.hs')
-rw-r--r-- | compiler/ghci/Linker.hs | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/compiler/ghci/Linker.hs b/compiler/ghci/Linker.hs index 11936c7c75..a95120d906 100644 --- a/compiler/ghci/Linker.hs +++ b/compiler/ghci/Linker.hs @@ -820,7 +820,7 @@ dynLinkObjs hsc_env pls objs = do unlinkeds = concatMap linkableUnlinked new_objs wanted_objs = map nameOfObject unlinkeds - if loadingDynamicHSLibs (hsc_dflags hsc_env) + if interpreterDynamic (hsc_dflags hsc_env) then do pls2 <- dynLoadObjs hsc_env pls1 wanted_objs return (pls2, Succeeded) else do mapM_ (loadObj hsc_env) wanted_objs @@ -1248,16 +1248,6 @@ loadFrameworks hsc_env platform pkg Just err -> throwGhcExceptionIO (CmdLineError ("can't load framework: " ++ fw ++ " (" ++ err ++ ")" )) -loadingDynamicHSLibs :: DynFlags -> Bool -loadingDynamicHSLibs dflags - | gopt Opt_ExternalInterpreter dflags = WayDyn `elem` ways dflags - | otherwise = dynamicGhc - -loadingProfiledHSLibs :: DynFlags -> Bool -loadingProfiledHSLibs dflags - | gopt Opt_ExternalInterpreter dflags = gopt Opt_SccProfilingOn dflags - | otherwise = rtsIsProfiled - -- Try to find an object file for a given library in the given paths. -- If it isn't present, we assume that addDLL in the RTS can find it, -- which generally means that it should be a dynamic library in the @@ -1306,8 +1296,8 @@ locateLib hsc_env is_hs dirs lib arch_file = "lib" ++ lib ++ lib_tag <.> "a" lib_tag = if is_hs && loading_profiled_hs_libs then "_p" else "" - loading_profiled_hs_libs = loadingProfiledHSLibs dflags - loading_dynamic_hs_libs = loadingDynamicHSLibs dflags + loading_profiled_hs_libs = interpreterProfiled dflags + loading_dynamic_hs_libs = interpreterDynamic dflags hs_dyn_lib_name = lib ++ '-':programName dflags ++ projectVersion dflags hs_dyn_lib_file = mkHsSOName platform hs_dyn_lib_name |