Debugging Foreign Code Routines

In order to debug foreign code in conjunction with Prolog code, it is necessary to statically link your program together with the Development Kernel as discussed in sap-srs. The resulting executable can then be debugged using any standard debugger, such as gdb(1).

Note that it is often useful for debugging purposes to build an application that is linked with QUI, since then both the Prolog and the non-Prolog parts of the application can be debugged simultaneously, using the QUI debugger and the standard debugger respectively. See sap-srs-qui for how to do this. If you do this, you may find that the standard debugger gets affected by the way that QUI uses the SIGIO signal. Most standard debuggers provide a way of ignoring specified signals, which is what is needed here. For example, under gdb(1) the command handle SIGIO noprint nostop pass should be issued before starting up the QUI with the run command.

WARNING: Under source-level debuggers such as gdb(1), single stepping out of a function that was called from Prolog does not work properly. You should always continue in such a situation.