Swipl-win behaviour

Doing a lot of Prolog development work that requires a lot of debugging, I’m trying to improve the swipl-win console. The git version already fixes a couple of memory management issues in xpce’s class terminal and fixes to the ANSI escape handling to make commandline editing work better (there still seem to be some flaws, probably related to history and paste :frowning: , but so far I fail to get reproducible cases).

I have added a Debug menu to provide menu and keyboard shortcut for some common actions I tend to use while debugging. The idea is that this both makes (new) users aware of these features and make debugging more efficient for experienced users. Please check out this version (build from git source or for Windows users try the latest daily build).

The console is in inspired by the Linux terminator console, providing similar splitting behaviour. Terminator however uses Ctrl-click to open a link. At the moment SWI-Prolog allows for simple (left) click. I find myself quite often unexpectedly opening links. Should we also move to Ctrl-click?

Comments on the current behaviour is welcome. What is missing? What is unclear?

If you experience crashes and use Linux or MacOS, please build using AddressSanitizer as follows (assuming source, from the top directory)

mkdir build.asan
cd build.asan
../script/configure
(agree)
ninja

Now you can run src/swipl-win (without installing) from any directory you like. This version is a lot slower, but gives detailed analysis from most memory management issues. While SWI-Prolog itself is pretty clean, xpce is much less …

P.s. I tend to split the console while debugging, running queries in one half and using the other to manage spy points, edit locations, find things, etc.

3 Likes

Hi Jan

Running the latest daily build (version 9.3.32-15-g72cb050c7) on Win11.

When I ‘touch’ the Debug menu, the system freezes, so I cannot comment about this new feature.

But seems I found the cause of some issues, that randomly blocked my system:
I detached the second monitor, and then all started to work better.

Allegated a screenshot that - I hope - will provide an insight about the issue.

The behaviour wasn’t always the same… sometime it freezed or died without messages immediately, sometimes after a debugging session started, sometimes switching between 2 windows… kind of really random.

[edit]

I reattached the second monitor after a successful start of swipl-win, and I got the message

?- SDL_GetDisplayUsableBounds(): Invalid display

Hmmm :frowning: I may have found the issue behind the assertion error. The Debug menu issue reproduces here. Rather odd; one would assume this all to be platform independent :frowning:

Yes, the latest daily build works with the second monitor attached. Many thanks for the quick fix.

could be you mean: the issue not reproduces here ? My system still freezes touching the menu.

I mean I could reproduce it, but it was too complicated to fix quickly. I just pushed some patches that fixes this, so it should work in tomorrow’s daily build.

The issue was that thread_signal/2 signals were not processed while the thread is reading from the Epilog window. That is now fixed (with help from ChatGPT :slight_smile: ). This makes signal handling consistent between Windows and non-Windows systems :slight_smile: .