How to use "gtrace" in VScode?

I have [SWI-Prolog 9.0.4] installed.
When I open swipl in vscode and type “gtrace.” in terminal, it shows:

?- gtrace.
Correct to: "trace"? no
ERROR: Unknown procedure: gtrace/0
ERROR:   However, there are definitions for:
ERROR:         trace/0
ERROR:
ERROR: In:
ERROR:   [10] gtrace
ERROR:    [9] toplevel_call(user:user:gtrace) at f:/swipl/boot/toplevel.pl:1173
   Exception: (10) gtrace ? 

My operating system is Windows10

I do use SWI-Prolog with Windows, VSCode and use gtrace. However I do not use gtrace within VSCode I use gtrace by starting the Prolog code with SWI-Prolog from the command line to open a Prolog top level then use gtrace.

Don’t know if anyone has been able to get gtrace to work with VSCode but it has been discussed before.

You might get away by loading the GUI connector:

 ?- [swi('swipl-win.rc')].

No idea whether it works with VSCode. It used to only work with swipl-win.exe, but these days it works to some extend for swipl.exe as well.

Thanks a lot!
It works after I type [swi(‘swipl-win.rc’)]. in terminal!

On a Mac I get this output:

?- gtrace.
% The graphical front-end will be used for subsequent tracing
true.

[trace]  ?- 

It automatically goes back to trace/0 :thinking:
It’s strange because the graphical editor works fine…any clues? (BTW I like trace/0 so it’s of no importance at all, but just to understand what’s going on…)
Thanks and congrats for the new xmas-bishop owl on the swi-prolog website :joy: :joy:

Not sure it does. It says it loaded the GUI tracer and is now in trace mode. Normally, the next goal should appear in the graphical debugger. I normally use

 ?- gtrace, mygoal(....).
3 Likes

It works in this way :+1:t2: Thanks

BTW using for once the graphical debugger had the positive outcome that I “discovered” the Gertjan van Noord (is it a pen name which stands for you, Jan? Or is this guy a real person?) definition of the member/2 predicate. Youssou would have liked it, I guess, because it’s deterministic when it’s left with a one-element list as input. Thanks

Gertjan is this person: Gertjan van Noord Home Page

1 Like