summaryrefslogtreecommitdiff
path: root/ghc
diff options
context:
space:
mode:
authorRoland Senn <rsx@bluewin.ch>2019-05-15 20:55:16 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2019-06-19 22:15:04 -0400
commit39c758e1426c9e5b00de2207ad53bb4377c1e6a6 (patch)
tree90dc87fe483ba729632a824efccd1d5fae33c363 /ghc
parent9d58554f7b19c52896796e8c3b6de20c154a67b2 (diff)
downloadhaskell-39c758e1426c9e5b00de2207ad53bb4377c1e6a6.tar.gz
Fix #1620: ModBreaks.modBreaks_array not initialised
After a :cd command and after setting some package flags, GHCi unloads all loaded modules by resetting the list of targets. This patch deletes eventually defined debugger breakpoints, before GHCi resets the target list. The common code is factored out into the new function clearAllTargets.
Diffstat (limited to 'ghc')
-rw-r--r--ghc/GHCi/UI.hs18
1 files changed, 11 insertions, 7 deletions
diff --git a/ghc/GHCi/UI.hs b/ghc/GHCi/UI.hs
index ab3992ccd0..31c6db055d 100644
--- a/ghc/GHCi/UI.hs
+++ b/ghc/GHCi/UI.hs
@@ -1543,8 +1543,8 @@ changeDirectory dir = do
graph <- GHC.getModuleGraph
when (not (null $ GHC.mgModSummaries graph)) $
liftIO $ putStrLn "Warning: changing directory causes all loaded modules to be unloaded,\nbecause the search path has changed."
- GHC.setTargets []
- _ <- GHC.load LoadAllTargets
+ -- delete targets and all eventually defined breakpoints (#1620)
+ clearAllTargets
setContextAfterLoad False []
GHC.workingDirectoryChanged
dir' <- expandPath dir
@@ -1852,9 +1852,7 @@ loadModule' files = do
-- unload first
_ <- GHC.abandonAll
- discardActiveBreakPoints
- GHC.setTargets []
- _ <- GHC.load LoadAllTargets
+ clearAllTargets
GHC.setTargets targets
success <- doLoadAndCollectInfo False LoadAllTargets
@@ -2916,8 +2914,8 @@ newDynFlags interactive_only minus_opts = do
when (verbosity dflags2 > 0) $
liftIO . putStrLn $
"package flags have changed, resetting and loading new packages..."
- GHC.setTargets []
- _ <- GHC.load LoadAllTargets
+ -- delete targets and all eventually defined breakpoints. (#1620)
+ clearAllTargets
liftIO $ linkPackages hsc_env new_pkgs
-- package flags changed, we can't re-use any of the old context
setContextAfterLoad False []
@@ -4128,3 +4126,9 @@ wantNameFromInterpretedModule noCanDo str and_then =
then noCanDo n $ text "module " <> ppr modl <>
text " is not interpreted"
else and_then n
+
+clearAllTargets :: GhciMonad m => m ()
+clearAllTargets = discardActiveBreakPoints
+ >> GHC.setTargets []
+ >> GHC.load LoadAllTargets
+ >> pure ()