Skip to content
  • Roland Senn's avatar
    Fix #14690 - :steplocal panics after break-on-error · 1be9c35c
    Roland Senn authored and Marge Bot's avatar Marge Bot committed
    `: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.
    1be9c35c