Default Prompt

Without debugging the interpreter will only interact with the end-user when input/output pred-icates for the console are encountered, or when a solution has been obtained. Otherwise during normal query execution the interpreter remains silent. The example predicate is taken from the naïve reverse Prolog text found in our benchmark suite:

?- concatenate(X, Y, [1,2,3]).
X = []
Y = [1, 2, 3] ;
X = [1]
Y = [2, 3]

Different debugging modes are available. Depending on the debugging mode the interpreter will run until a certain condition is met. When such a condition is met the debugger will show the met condition, the invocation depth, the current port and the current goal. Here is an exam-ple of trace mode with full leashing:

?- trace.
Yes
?- concatenate(X, Y, [1,2,3]).
   0 Call concatenate(X, Y, [1, 2, 3]) ?
   0 Exit concatenate([], [1, 2, 3], [1, 2, 3]) ?
X = []
Y = [1, 2, 3] ;
   0 Redo concatenate([], [1, 2, 3], [1, 2, 3]) ?
   1 Call concatenate(_G, Y, [2, 3]) ?
   1 Exit concatenate([], [2, 3], [2, 3]) ?
   0 Exit concatenate([1], [2, 3], [1, 2, 3]) ?
X = [1]
Y = [2, 3]

The available debugging and leashing modes are found in the documentation of the modules "default" and "attach". The predicates to add and remove spy points respectively break points are documented as well there. The end-user can interact with the debugger when the prompt (?) is shown. The end-user can then choose upon the following options.

EOF     = Exit the current session.
= Continue running the program in the actual mode.
?     = Display this help text.\n\
<Goal>. = Execute the <Goal> and prompt command again.

If the end-user chooses a goal, this goal will be executed and the end-user will be prompted again. The side effect of the goal can control the debugger state or the goal can be used to query the interpreter state. Besides that the end-user can also use session predicates such as abort/0, break/0, etc.. or even predicates he has defined on his own.

The debugger can be also controlled by the end-user through the menu, button and tool bar actions of the graphic environment. These actions will prepare a debugger directive and send it to the Prolog interpreter. The debugger directives will be visible in the console. The actions are documented in the Swing respectively Android documentation.

Comments