Skip to content
  • Roland Senn's avatar
    Show breakpoint locations of breakpoints which were ignored during :force (#2950) · 3979485b
    Roland Senn authored
    GHCi is split up into 2 major parts: The user-interface (UI)
    and the byte-code interpreter. With `-fexternal-interpreter`
    they even run in different processes. Communication between
    the UI and the Interpreter (called `iserv`) is done using
    messages over a pipe. This is called `Remote GHCI` and
    explained in the Note [Remote GHCi] in `compiler/ghci/GHCi.hs`.
    
    To process a `:force` command the UI sends a `Seq` message
    to the `iserv` process. Then `iserv` does the effective
    evaluation of the value. When during this process a breakpoint
    is hit, the `iserv` process has no additional information to
    enhance the `Ignoring breakpoint` output with the breakpoint
    location.
    
    To be able to print additional breakpoint information,
    there are 2 possible implementation choices:
    1. Store the needed information in the `iserv` process.
    2. Print the `Ignoring breakpoint` from the UI process.
    
    For option 1 we need to store the breakpoint info redundantely
    in 2 places and this is bad. Therfore option 2 was implemented
    in this MR:
    - The user enters a `force` command
    - The UI sends  a `Seq` message to the `iserv` process.
    - If processing of the `Seq` message hits a breakpoint,
      the `iserv` process returns control to the UI process.
    - The UI looks up the source location of the breakpoint,
      and prints the enhanced `Ignoring breakpoint` output.
    - The UI sends a `ResumeSeq` message to the `iserv` process,
      to continue forcing.
    3979485b