Mark some predicates as "never trace"?

I’m using: SWI-Prolog version 8.0.2 on Ubuntu Linux 18.04 LTS (fully patched).

Is there a way to mark some predicates that you never want traced? In my case, I’d like it so the following predicates are never traced:

consult
debug
trace

The problem is that once I enter trace mode, the debugger pops up whenever I execute the above commands, including whatever command I enter into the console window to try and exit trace mode. Normally I wouldn’t care but on my Linux box, the debugger takes about 15 seconds to become active. The window shows up instantly, but for some reason, it does not repaint its client area or accept input for 15 seconds. This means every time I want to exit trace mode I have a 15 second wait. When I’m in a tight code iteration loop that involves jumping in and out of trace mode, the delay becomes something I’d really like to avoid.

This delay has been discussed here before :frowning: Note that if you are impatient you can move the window a little to wake it up. Funny thing is that on the machine I use now (also running Ubuntu 18.04), the problem only very rarely shows up with Prolog IDE windows, but does show up with git gui. Here it helps to press an arbitrary key. Didn’t test that with Prolog’s windows.

There is an old predicate '$hide'(:PI) (e.g., '$hide'(debug/0)), but it doesn’t seem to work anymore.

I think the behaviour of trace/0 to trace the next toplevel goal is a bit old fashioned. I always use

?- gtrace, my_goal(...).

And in 99% of the case this ends with either an ‘a’ (abort) when I’ve seen enough and there is no point continuing or ‘n’ (nodebug) in case I’ve seen enough and run the rest. In both cases, the trace mode is disabled again.

In even more cases I use ?- gsy(suspect_pred), go. or set a break-point from the editor and run the program.

I would be in favor of disabling the trace mode after every toplevel goal, so you need to use the conjunction. Only, zillions of text books and course texts tell you to run trace/0 and next your query on the next prompt. Changing this will result in a lot of complains :frowning: Possible a Prolog flag using the old behaviour as default will do?

1 Like