[top] [up] [next]

Breakpoints


With the execution trace the behavior of the program can be examined on a low level. Because an execution trace can become very large it is often easier to set a breakpoint and have the program stop at that point. After hitting a breakpoint it is possible to step through a Prolog program and inspect values of variables.

Functor breakpoints

There are two types of breakpoints in Trinc-Prolog, it is possible to set a breakpoint on a line in a Prolog program or on a functor of a goal. A functor breakpoint can be created by opening the breakpoint view and press the button New. The following dialog window then appears.

pl_img23.gif (4979 bytes)

With the settings from the example above the Prolog program stops if it encounters the goal member/2; a goal with the name 'member' and two arguments, in any of the 10 possible states. If the execution of member/2 must only stop on failing of member/2 then only the checkbox 'Fail' must be checked.

Line breakpoints

With the text editor it is possible to set breakpoints on a line in the source of a Prolog program. Whenever a line breakpoint is encountered the execution of the Prolog program is stopped, it doesn't matter in which state Trinc-Prolog is.

To add a line breakpoint press the left mouse button in the gutter of the line (the gray area to the left of the line) or press the F5 key. To remove the breakpoint click with the mouse on the red dot in the gutter area (or press the F5 key).

    pl_img80.gif (2512 bytes)

To remove the breakpoint click with the left mouse button on the red dot in the gutter area.

    pl_img81.gif (3042 bytes)

A breakpoint can also be added and removed with the popup menu of the text editor or with the Breakpoints window.

Run to cursor

Choose Run to cursor to run a Prolog program at full speed and have it stop at the current line of the current file in the text editor. After a program has stopped it is possible to start tracing the program and inspect variable values. Press the F4 key or use the popup menu of the text editor to use 'Run to cursor'.

[top] [up] [next]

 

info@trinc-prolog.com