从跟踪隐藏谓词

lo *_*cre 5 trace prolog swi-prolog

有没有办法从跟踪中隐藏单个谓词?在这样的规则中:

p(<Stuff>) :-
    q(),
    p(<ModifiedStuff>);
    s(),
    p(<ModifiedStuff>);
    p(<ModifiedStuff>).
Run Code Online (Sandbox Code Playgroud)

例如,我想隐藏q()和隐藏s()踪迹,因为我仅对的调用感兴趣p()q()并且s()可能会调用许多其他谓词,这完全阻塞了跟踪,并使其很难在其中找到相关的调用。

编辑1

现在,我尝试从命令行而不是从解释器内部执行,并将跟踪管道传递给grep以对包含p...的行进行grepping ,但令我失望的是,从命令行运行时,它仍然打开了一个prolog shell,因此,对输出进行管道传输根本不起作用。只有print将实际发送到运行Prolog进程的Shell。

编辑2(使用trace(p,all)时输出)

?- trace(shift_reduce, all).
%         shift_reduce/2: [call,redo,exit,fail]
true.

[debug]  ?- shift_reduce([?,x,x], T).
 T Call: (8) shift_reduce([?, x, x], _7344)
 T Exit: (8) shift_reduce([?, x, x], [e, [?], [v, [x]], [e, [v, [...]]]])
T = [e, [?], [v, [x]], [e, [v, [x]]]] ;
 T Exit: (8) shift_reduce([?, x, x], [e, [?], [v, [x]], [e, [v, [...]]]])
T = [e, [?], [v, [x]], [e, [v, [x]]]] ;
 T Fail: (8) shift_reduce([?, x, x], _7344)
false.

[debug]  ?-
Run Code Online (Sandbox Code Playgroud)