When the debugger is on, this predicate causes the current innermost box to be exited. This should be a box created previously by the trace_call_port/3 builtin, otherwise the debugger's box nesting will get out of sync.
search(Vars) :-
trace_call_port(search_enter, _Invoc, search(Vars)),
labeling(Vars),
trace_exit_port.
?- length(L, 3), L :: 1..4, search(L).
(1) 1 CALL length(L, 3) %> zap to port: [~ call] search_enter
(6) 2 SEARCH_ENTER search([_501{[... .. ...]}, _514{[...]}, _527{...}]) %> skip
(6) 2 *EXIT search([1, 1, 1]) %> skip