trace.pl --
Allow tracing pengine execution under SWISH.
- add_context(+Port, +Frame, +Prompt0, -Prompt) is det[private]
- Add additional information about the context to the debug prompt.
- $swish wrapper(:Goal, -Residuals)
- Wrap a SWISH goal in '$swish wrapper'. This has two advantages: we can detect that the tracer is operating on a SWISH goal by inspecting the stack and we can save/restore the debug state to deal with debugging next solutions.
- residuals(+PengineModule, -Goals:list(callable)) is det[private]
- Find residual goals that are not bound to the projection
variables. We must do so while we are in the Pengine as the
goals typically live in global variables that are not visible
when formulating the answer from the projection variables as
done in library(pengines_io).
This relies on the SWI-Prolog 7.3.14 residual goal extension.
- source_location(+Frame, +Port, -Location) is semidet[private]
- Determine the appropriate location to show for Frame at Port.
- If we have a PC (integer), we have a concrete clause-location, so use it if it is in the current file.
- If we have a port, but the parent is not associated with our file, use it. This ensures that the initial query is shown in the source window.
- parent_frame(+FrameIn, +PCOrPortIn, -Steps, -FrameOut, -PCOrPortOut) is nondet[private]
- True when FrameOut/PCOrPortOut is a parent environment of FrameIn/PCOrPortIn. Backtracking yields higher frames.
- frame_file(+Frame, -File) is semidet[private]
- True when Frame is associated with a predicate that is defined in File.
- pengine_file(+File) is semidet[private]
- True if File is a Pengine controlled file. This is currently the main file (pengine://) and (swish://) for included files.
- clause_position(+PC) is semidet[private]
- True if the position can be related to a clause.
- subgoal_position(+Clause, +PortOrPC, -File, -CharA, -CharZ) is semidet[private]
- Character range CharA..CharZ in File is the location to highlight for the given clause at the given location.
- source_position(Frame, PCOrPort, -Position)[private]
- Get the source location for Frame at PCOrPort. Position is a dict.
- pengines:prepare_goal(+GoalIn, -GoalOut, +Options) is semidet[multifile]
- Handle the
breakpoints(List)
option to set breakpoints prior to execution of the query. If breakpoints are present and enabled, the goal is executed in debug mode. List is a list, holding a dict for each source that has breakpoints. The dict contains these keys:file
is the source file. For the current Pengine source this ispengine://<pengine>/src
.breakpoints
is a list of lines (integers) where to put break points.
- update_breakpoints(+Breakpoints)[private]
- Update the active breakpoint by comparing with the set of currently active breakpoints.
- current_pengine_source_breakpoints(+PengineFile, -Pairs) is det[private]
- Find the currently set breakpoints for the Pengine with the given source file PengineFile. Pairs is a list File-BreakPoints, where BreakPoints is a list of breakpoint-ID - Line pairs.
- prolog_clause:open_source(+File, -Stream) is semidet[multifile]
- Open SWISH non-file sources.
- install_exception_hook[private]
- Make sure our handler is the first of the hook predicate.