Download SICStus Prolog User`s Manual
Transcript
Chapter 7: Debugging 73 move back to the code which called this predicate and keep moving backwards up the code looking for choice points. Exception This arrow represents an exception which was raised in the initial goal, either by a call to raise_exception/1 or by an error in a built-in predicate. See Section 8.5 [Exception], page 136. Control now passes out of the Exception port of the descendant box and the system continues to pass the exception to outer levels. Textually we move back to the code which called this predicate and keep moving backwards up the code looking for a call to on_exception/3. In terms of this model, the information we get about the procedure box is only the control flow through these five ports. This means that at this level we are not concerned with which clause matches, and how any subgoals are satisfied, but rather we only wish to know the initial goal and the final outcome. However, it can be seen that whenever we are trying to satisfy subgoals, what we are actually doing is passing through the ports of their respective boxes. If we were to follow this, then we would have complete information about the control flow inside the procedure box. Note that the box we have drawn round the predicate should really be seen as an invocation box. That is, there will be a different box for each different invocation of the predicate. Obviously, with something like a recursive predicate, there will be many different Calls and Exits in the control flow, but these will be for different invocations. Since this might get confusing each invocation box is given a unique integer identifier. In addition to the five basic ports discussed above, there are two more ports for invocations involving a blocked goal: Block This port is passed through when a goal is blocked. Unblock This port is passed through when a previously blocked goal is unblocked. 7.2 Basic Debugging Predicates Development systems provide a range of built-in predicates for control of the debugging facilities. The most basic predicates are as follows: debug Switches the debugger on, and ensures that the next time control reaches a spypoint, it will be activated. In basic usage this means that a message will be produced and you will be prompted for a command. In order for the full range of control flow information to be available it is necessary to have the debugger on from the start. When it is off the system does not remember invocations that are being executed. (This is because it is expensive and not required for normal running of programs.) You can switch Debug Mode on in the middle of execution, either from within your program or after a ^C (see trace/0 below), but information prior to this will just be unavailable. zip
Related documents
SICStus Prolog User`s Manual
SICStus Prolog User`s Manual
SICStus Prolog User's Manual
SICStus Prolog User`s Manual
Planning using Situation Calculus, Prolog and a - CEUR
Ciao Manual - The Ciao System
SICStus Prolog Release Notes
Sec - SICStus Prolog 3
PR Pilot 575 User Manual
Design and Applied Technology (Secondary 4 – 6)
AX50 Color Screen Digital Mobile Phone User Manual