X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Fmain%2FGHC.hs;h=4c14ff6338093305224eea31f5f5d1a2b8692bc4;hb=24ee75415832b05f53726f2bbdf52972b1cfb613;hp=a918d60bdb4504c07ba4e0d9a5a5e97f38a35ea3;hpb=78f4da288f8a189c739766a3107fa80073800ba7;p=ghc-hetmet.git diff --git a/compiler/main/GHC.hs b/compiler/main/GHC.hs index a918d60..4c14ff6 100644 --- a/compiler/main/GHC.hs +++ b/compiler/main/GHC.hs @@ -84,7 +84,9 @@ module GHC ( resume, Resume(resumeStmt, resumeThreadId, resumeBreakInfo, resumeSpan, resumeHistory, resumeHistoryIx), - History(historyBreakInfo), getHistorySpan, + History(historyBreakInfo, historyEnclosingDecl), + GHC.getHistorySpan, getHistoryModule, getHistoryTick, + GHC.findEnclosingDeclSpanByTick, getResumeContext, abandon, abandonAll, InteractiveEval.back, @@ -538,9 +540,16 @@ load s@(Session ref) how_much -- graph is still retained in the Session. We can tell which modules -- were successfully loaded by inspecting the Session's HPT. mb_graph <- depanal s [] False - case mb_graph of - Just mod_graph -> load2 s how_much mod_graph + case mb_graph of + Just mod_graph -> catchingFailure $ load2 s how_much mod_graph Nothing -> return Failed + where catchingFailure f = f `Exception.catch` \e -> do + hsc_env <- readIORef ref + -- trac #1565 / test ghci021: + -- let bindings may explode if we try to use them after + -- failing to reload + writeIORef ref $! hsc_env{ hsc_IC = emptyInteractiveContext } + throw e load2 s@(Session ref) how_much mod_graph = do guessOutputFile s @@ -1974,3 +1983,13 @@ findModule' hsc_env mod_name maybe_pkg = text "is not loaded")) err -> let msg = cannotFindModule dflags mod_name err in throwDyn (CmdLineError (showSDoc msg)) + +#ifdef GHCI +getHistorySpan :: Session -> History -> IO SrcSpan +getHistorySpan sess h = withSession sess $ \hsc_env -> + return$ InteractiveEval.getHistorySpan hsc_env h + +findEnclosingDeclSpanByTick :: Session -> Module -> BreakIndex -> IO SrcSpan +findEnclosingDeclSpanByTick sess m t = withSession sess $ \ hsc_env -> + return$ InteractiveEval.findEnclosingDeclSpanByTick hsc_env m t +#endif