As an example for multi-process source level debugging we have included a little parallel
demonstration program called 'pingpong'.
You can compile this with the BAP
compiler
(refer to
the Compiler Reference Manual for details) or use the compiled version
("pingpong.lkd
") included on the distribution media.
From the PROLOG shell prompt, load the executable (with '
load
(pingpong)
')
and execute the main predicate 'pingpong()':
> load (pingpong) > pingpong
This will start two processes that will immediately run into a ' trace(on) ' predicate. A Trace List dialog opens up. Now you can open a debug window by selecting one of the processes and clicking on the 'Debug' button. If you open one debug window for each of the processes, you can simultaneously debug both.
Now use the 'Step' button in a debug window to trace through the processes. Watch the concurrent execution by switching one of the processes into 'Auto' mode. Take a look at the 'Messagebase' just before executing the ' rec_msg ' predicate.
You can stop the processes by sending a quit message to one of them: Type
> send_msg (msg(1,14),quit)
at the shell prompt (replace the 1,14 with your process's Tid and Pid).