Commit a0b2691b authored by Ian Lynagh's avatar Ian Lynagh
Browse files

Improve the error when :list can't find any code to show

parent baaed901
......@@ -2139,9 +2139,23 @@ listCmd :: String -> GHCi ()
listCmd "" = do
mb_span <- getCurrentBreakSpan
case mb_span of
Nothing -> printForUser $ text "not stopped at a breakpoint; nothing to list"
Just span | GHC.isGoodSrcSpan span -> io $ listAround span True
| otherwise -> printForUser $ text "unable to list source for" <+> ppr span
Nothing ->
printForUser $ text "Not stopped at a breakpoint; nothing to list"
Just span
| GHC.isGoodSrcSpan span -> io $ listAround span True
| otherwise ->
do s <- getSession
resumes <- io $ GHC.getResumeContext s
case resumes of
[] -> panic "No resumes"
(r:_) ->
do let traceIt = case GHC.resumeHistory r of
[] -> text "rerunning with :trace,"
_ -> empty
doWhat = traceIt <+> text ":back then :list"
printForUser (text "Unable to list source for" <+>
ppr span
$$ text "Try" <+> doWhat)
listCmd str = list2 (words str)
list2 :: [String] -> GHCi ()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment