All predicatesShow sourcetrace.pl --

Allow tracing pengine execution under SWISH.

Source add_context(+Port, +Frame, +Prompt0, -Prompt) is det[private]
Add additional information about the context to the debug prompt.
Source $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.
Source 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 source_location(+Frame, +Port, -Location) is semidet[private]
Determine the appropriate location to show for Frame at Port.
  1. If we have a PC (integer), we have a concrete clause-location, so use it if it is in the current file.
  2. 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.
Source 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.
Source frame_file(+Frame, -File) is semidet[private]
True when Frame is associated with a predicate that is defined in File.
Source 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.
Source clause_position(+PC) is semidet[private]
True if the position can be related to a clause.
Source 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 source_position(Frame, PCOrPort, -Position)[private]
Get the source location for Frame at PCOrPort. Position is a dict.
Source 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 is pengine://<pengine>/src.
  • breakpoints is a list of lines (integers) where to put break points.
Source update_breakpoints(+Breakpoints)[private]
Update the active breakpoint by comparing with the set of currently active breakpoints.
Source 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.
Source prolog_clause:open_source(+File, -Stream) is semidet[multifile]
Open SWISH non-file sources.
Source install_exception_hook[private]
Make sure our handler is the first of the hook predicate.