diff options
author | Roland Senn <rsx@bluewin.ch> | 2019-10-03 16:37:52 +0200 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-10-26 05:20:14 -0400 |
commit | 1be9c35c940e9a1edbb44a0e7dd51b48529ffb9b (patch) | |
tree | b8599dbfc9e5fb57193cd3d46a10908d7543d18d /ghc/GHCi | |
parent | 8916e64e5437c99b82d5610286430328af1d86bc (diff) | |
download | haskell-1be9c35c940e9a1edbb44a0e7dd51b48529ffb9b.tar.gz |
Fix #14690 - :steplocal panics after break-on-error
`:steplocal` enables only breakpoints in the current top-level binding.
When a normal breakpoint is hit, then the module name and the break id from the `BRK_FUN` byte code
allow us to access the corresponding entry in a ModBreak table. From this entry we then get the SrcSpan
(see compiler/main/InteractiveEval.hs:bindLocalsAtBreakpoint).
With this source-span we can then determine the current top-level binding, needed for the steplocal command.
However, if we break at an exception or at an error, we don't have an BRK_FUN byte-code, so we don't have any source information.
The function `bindLocalsAtBreakpoint` creates an `UnhelpfulSpan`, which doesn't allow us to determine the current top-level binding.
To avoid a `panic`, we have to check for `UnhelpfulSpan` in the function `ghc/GHCi/UI.hs:stepLocalCmd`.
Hence a :steplocal command after a break-on-exception or a break-on-error is not possible.
Diffstat (limited to 'ghc/GHCi')
-rw-r--r-- | ghc/GHCi/UI.hs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/ghc/GHCi/UI.hs b/ghc/GHCi/UI.hs index e2f51be65f..34bb627238 100644 --- a/ghc/GHCi/UI.hs +++ b/ghc/GHCi/UI.hs @@ -3460,6 +3460,10 @@ stepLocalCmd arg = withSandboxOnly ":steplocal" $ step arg mb_span <- getCurrentBreakSpan case mb_span of Nothing -> stepCmd [] + Just (UnhelpfulSpan _) -> liftIO $ putStrLn ( -- #14690 + ":steplocal is not possible." ++ + "\nCannot determine current top-level binding after " ++ + "a break on error / exception.\nUse :stepmodule.") Just loc -> do md <- fromMaybe (panic "stepLocalCmd") <$> getCurrentBreakModule current_toplevel_decl <- enclosingTickSpan md loc |