I’m trying to print a full prolog stack trace via the foreign language interface.
All that’s returned is:
[0] system:$c_call_prolog/0 <no clause>
… when calling from Python as:
bttext = PL_backtrace_string(20, 1)
if bttext is not None:
msg =to_string(bttext)
PL_free(bttext)
In my test I add:
test_backtrace2(X) :- missing(X), f(X).
test_backtrace1(X) :- test_backtrace2(X), f(X).
test_backtrace(X) :- test_backtrace1(X), f(X).
and querying
test_backtrace(X).
The rest of the exception message confirms that execution gets to test_backtrace2(X) :- missing(X)
But I don’t see test_backtrace, test_backtrace1, test_backtrace2 in the sack.
Is there a debug flag I need to set to collect stack traces? The docs mention, ‘debug topics’, but there’s not much detail swipl/pl-debug.h at 6429a9cbdbca9cb807acc3c4fa40e7a67c08e4de · SWI-Prolog/swipl · GitHub
PL_initialize was called with “-q” and “–nosignals”.