Debugging with large terms

Help requests on developing Logtalk applications

Moderator: Paulo Moura

Post Reply
rbt
Posts: 17
Joined: Tue Feb 09, 2010 10:21 am

Debugging with large terms

Post by rbt » Fri Apr 08, 2011 11:39 am

Hi Logtalk friends!

Debugging methods that deal with large terms may be cumbersome due to an information overload. Is there any way to control how terms are printed in the debugging mode?

Kind Regards,

rbt

Paulo Moura
Logtalk developer
Posts: 475
Joined: Sat May 05, 2007 8:35 am
Location: Portugal
Contact:

Re: Debugging with large terms

Post by Paulo Moura » Fri Apr 08, 2011 2:10 pm

rbt wrote: Debugging methods that deal with large terms may be cumbersome due to an information overload. Is there any way to control how terms are printed in the debugging mode?
Assuming that you're talking about term printing depth, there is no standard solution. What Prolog compiler are you using and what kind of control do you have in mind?

Cheers,

Paulo
Paulo Moura
Logtalk developer

rbt
Posts: 17
Joined: Tue Feb 09, 2010 10:21 am

Re: Debugging with large terms

Post by rbt » Sun Apr 10, 2011 6:18 pm

Paulo Moura wrote:
rbt wrote: Debugging methods that deal with large terms may be cumbersome due to an information overload. Is there any way to control how terms are printed in the debugging mode?
Assuming that you're talking about term printing depth, there is no standard solution. What Prolog compiler are you using and what kind of control do you have in mind?
Paulo
I'm using swi-prolog as the back-end compiler. I think it would be nice if one could define problem specific rules which determine how terms are printed. I don't know how the debugger internally works. But wouldn't it be promising to replace the current debugger by a more flexible framework. For example, one could define a protocol (e.g., debug_printerp) that encapsulates objects which are responsible for the printing of debug ''messages''. The debugger sends the ''raw'' terms to the interface and the how the terms are printed is determined by the corresponding implementation. This would make it possible for me to write my own "debugprinter". Maybe one could print the "raw" term on demand (e.g., by pressing a corresponding button).

Kind regards,

rbt

Paulo Moura
Logtalk developer
Posts: 475
Joined: Sat May 05, 2007 8:35 am
Location: Portugal
Contact:

Re: Debugging with large terms

Post by Paulo Moura » Sun Apr 10, 2011 6:50 pm

rbt wrote: I'm using swi-prolog as the back-end compiler.
Logtalk 2.42.3 added a debugger command "p" to the Logtalk built-in debugger. This command prints the current goal using the print/1 predicate when available, which is the case with SWI-Prolog. Thus, you can define clauses for the portray/1 hook predicate to print in a suitable way your large terms. See the SWI-Prolog documentation for details.
rbt wrote: I think it would be nice if one could define problem specific rules which determine how terms are printed. I don't know how the debugger internally works. But wouldn't it be promising to replace the current debugger by a more flexible framework. For example, one could define a protocol (e.g., debug_printerp) that encapsulates objects which are responsible for the printing of debug ''messages''. The debugger sends the ''raw'' terms to the interface and the how the terms are printed is determined by the corresponding implementation. This would make it possible for me to write my own "debugprinter". Maybe one could print the "raw" term on demand (e.g., by pressing a corresponding button).
Sounds like a good, feasible idea. But may take awhile until I look into it. Right now I'm working on adding support for the SWI-Prolog graphical debugger. Something that, I suspect, will be most welcome by most Logtalk users ;-)

Cheers,

Paulo
Paulo Moura
Logtalk developer

rbt
Posts: 17
Joined: Tue Feb 09, 2010 10:21 am

Re: Debugging with large terms

Post by rbt » Tue Apr 12, 2011 9:28 am

Paulo Moura wrote:
rbt wrote: I'm using swi-prolog as the back-end compiler.
Logtalk 2.42.3 added a debugger command "p" to the Logtalk built-in debugger. This command prints the current goal using the print/1 predicate when available, which is the case with SWI-Prolog. Thus, you can define clauses for the portray/1 hook predicate to print in a suitable way your large terms. See the SWI-Prolog documentation for details.
Ah cool. That might be very helpful.
Paulo Moura wrote:
rbt wrote: I think it would be nice if one could define problem specific rules which determine how terms are printed. I don't know how the debugger internally works. But wouldn't it be promising to replace the current debugger by a more flexible framework. For example, one could define a protocol (e.g., debug_printerp) that encapsulates objects which are responsible for the printing of debug ''messages''. The debugger sends the ''raw'' terms to the interface and the how the terms are printed is determined by the corresponding implementation. This would make it possible for me to write my own "debugprinter". Maybe one could print the "raw" term on demand (e.g., by pressing a corresponding button).
Sounds like a good, feasible idea. But may take awhile until I look into it. Right now I'm working on adding support for the SWI-Prolog graphical debugger. Something that, I suspect, will be most welcome by most Logtalk users ;-)
Yes, support for SWI-Prolog graphical Debugger would be great.

Paulo Moura
Logtalk developer
Posts: 475
Joined: Sat May 05, 2007 8:35 am
Location: Portugal
Contact:

Re: Debugging with large terms

Post by Paulo Moura » Thu May 19, 2011 9:30 am

rbt wrote: Yes, support for SWI-Prolog graphical Debugger would be great.
See viewtopic.php?f=2&t=158. Feedback appreciated.

Cheers,

Paulo
Paulo Moura
Logtalk developer

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest