Show breakpoint locations of breakpoints which were ignored during :force (#2950)
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:
- Store the needed information in the
iserv
process. - 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 theiserv
process. - If processing of the
Seq
message hits a breakpoint, theiserv
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 theiserv
process, to continue forcing.