diff -rN -u old-ghc/compiler/ghci/InteractiveUI.hs new-ghc/compiler/ghci/InteractiveUI.hs
|
old
|
new
|
|
| 730 | 730 | GHC.RunOk names -> do |
| 731 | 731 | show_types <- isOptionSet ShowType |
| 732 | 732 | when show_types $ printTypeOfNames names |
| 733 | | GHC.RunBreak _ names mb_info |
| 734 | | | isNothing mb_info || |
| | 733 | GHC.RunBreak _ names mb_info |
| | 734 | | isNothing mb_info || |
| 735 | 735 | step_here (GHC.resumeSpan $ head resumes) -> do |
| 736 | | printForUser $ ptext (sLit "Stopped at") <+> |
| 737 | | ppr (GHC.resumeSpan $ head resumes) |
| 738 | | -- printTypeOfNames session names |
| 739 | | let namesSorted = sortBy compareNames names |
| 740 | | tythings <- catMaybes `liftM` |
| 741 | | mapM GHC.lookupName namesSorted |
| 742 | | docs <- pprTypeAndContents [id | AnId id <- tythings] |
| 743 | | printForUserPartWay docs |
| 744 | | maybe (return ()) runBreakCmd mb_info |
| | 736 | mb_id_loc <- toBreakIdAndLocation mb_info |
| | 737 | let breakCmd = maybe "" ( \(_,l) -> onBreakCmd l ) mb_id_loc |
| | 738 | if (null breakCmd) |
| | 739 | then printStoppedAtBreakInfo (head resumes) names |
| | 740 | else enqueueCommands [breakCmd] |
| 745 | 741 | -- run the command set with ":set stop <cmd>" |
| 746 | 742 | st <- getGHCiState |
| 747 | 743 | enqueueCommands [stop st] |
| … |
… |
|
| 757 | 753 | |
| 758 | 754 | return (case run_result of GHC.RunOk _ -> True; _ -> False) |
| 759 | 755 | |
| 760 | | runBreakCmd :: GHC.BreakInfo -> GHCi () |
| 761 | | runBreakCmd info = do |
| | 756 | toBreakIdAndLocation :: |
| | 757 | Maybe GHC.BreakInfo -> GHCi (Maybe (Int, BreakLocation)) |
| | 758 | toBreakIdAndLocation Nothing = return Nothing |
| | 759 | toBreakIdAndLocation (Just info) = do |
| 762 | 760 | let mod = GHC.breakInfo_module info |
| 763 | 761 | nm = GHC.breakInfo_number info |
| 764 | 762 | st <- getGHCiState |
| 765 | | case [ loc | (_,loc) <- breaks st, |
| 766 | | breakModule loc == mod, breakTick loc == nm ] of |
| 767 | | [] -> return () |
| 768 | | loc:_ | null cmd -> return () |
| 769 | | | otherwise -> do enqueueCommands [cmd]; return () |
| 770 | | where cmd = onBreakCmd loc |
| | 763 | return $ listToMaybe [ id_loc | id_loc@(_,loc) <- breaks st, |
| | 764 | breakModule loc == mod, |
| | 765 | breakTick loc == nm ] |
| | 766 | |
| | 767 | printStoppedAtBreakInfo :: Resume -> [Name] -> GHCi () |
| | 768 | printStoppedAtBreakInfo resume names = do |
| | 769 | printForUser $ ptext (sLit "Stopped at") <+> |
| | 770 | ppr (GHC.resumeSpan resume) |
| | 771 | -- printTypeOfNames session names |
| | 772 | let namesSorted = sortBy compareNames names |
| | 773 | tythings <- catMaybes `liftM` mapM GHC.lookupName namesSorted |
| | 774 | docs <- pprTypeAndContents [id | AnId id <- tythings] |
| | 775 | printForUserPartWay docs |
| 771 | 776 | |
| 772 | 777 | printTypeOfNames :: [Name] -> GHCi () |
| 773 | 778 | printTypeOfNames names |