Is there a way to make the stacktrace print terms in full?

call0(In,Out) :- 
   call1(f(In),Out).
   
call1(In,Out) :- 
   call2(g(In),Out).
   
call2(In,Out) :- 
   Out = h(In,In),
   throw(error("when I say the word, you will forget everything",_)).

Then:

?- set_prolog_flag(debugger_write_options,[max_depth(100)]).  % this has no effect
?- debug

[debug]  ?- call0(a,Out).
ERROR: Unknown error term: "when I say the word, you will forget everything"
ERROR: In:
ERROR:   [13] throw(error("when I say the word, you will forget everything",_22758))
ERROR:   [12] call2(g(f(a)),h(g(...),g(...))) at user://1:14
ERROR:   [11] call1(f(a),h(g(...),g(...))) at user://1:11
ERROR:   [10] call0(a,h(g(...),g(...))) at user://1:8
ERROR:    [9] <user>
   Exception: (13) throw(error("when I say the word, you will forget everything", _22180)) ?

Sadly, the terms are shortened. Apparently, setting debugger_write_options changes nothing. But maybe there is another way?

The stack traces are controlled by 4 Prolog flags defined in library(prolog_stack):

:- create_prolog_flag(backtrace,            true, [type(boolean), keep(true)]).
:- create_prolog_flag(backtrace_depth,      20,   [type(integer), keep(true)]).
:- create_prolog_flag(backtrace_goal_depth, 3,    [type(integer), keep(true)]).
:- create_prolog_flag(backtrace_show_lines, true, [type(boolean), keep(true)]).
1 Like