Hello,
I am wondering how to use the trace/1 predicate. I included the three packages mentioned in the doc, but when I then do: ?- trace( --some styff-- ) I just get that trace/1 is undefined... I guess that I am forgetting some basic thing here (something that has to do with modules, etc), but I am not sure. Any ideas?
PS: I am using the ciao shell, not the emacs integration...
-- Roel Wuyts Software Composition Group roel.wuyts(a)iam.unibe.ch University of Bern, Switzerland http://www.iam.unibe.ch/~wuyts/ Board Member of the European Smalltalk User Group: www.esug.org ============================================================================== Message: Address: Action: help majordomo(a)clip.dia.fi.upm.es Info. on useful commands subscribe ciao-users-request(a)clip.dia.fi.upm.es Subscribe to this list unsubscribe ciao-users-request(a)clip.dia.fi.upm.es Unsubscribe from this list <whatever> ciao-users(a)clip.dia.fi.upm.es Send message to list ----------------------------------------------------------------------------- Archived messages: http://www.clip.dia.fi.upm.es/Mail/ciao-users/ -----------------------------------------------------------------------------
Roel Wuyts writes:
I am wondering how to use the trace/1 predicate. I included the three packages mentioned in the doc, but when I then do: ?- trace( --some styff-- ) I just get that trace/1 is undefined...
In general, you need to load the packages also in the toplevel to use them in such a way.
Unfortunately, in this case it won't work. The expansion performed for the trace predicate does not work from the shell prompt. You will have to inline calls to trace in the program code.
Regards,
Francisco Bueno CLIP group - CS Dept. - FIM - UPM Campus de Montegancedo - 28660, Boadilla del Monte - Madrid Tel: +34 1 336 7441 Fax: +34 1 352 4819 Internet: bueno(a)fi.upm.es http://www.clip.dia.fi.upm.es/~bueno/ ============================================================================== Message: Address: Action: help majordomo(a)clip.dia.fi.upm.es Info. on useful commands subscribe ciao-users-request(a)clip.dia.fi.upm.es Subscribe to this list unsubscribe ciao-users-request(a)clip.dia.fi.upm.es Unsubscribe from this list <whatever> ciao-users(a)clip.dia.fi.upm.es Send message to list ----------------------------------------------------------------------------- Archived messages: http://www.clip.dia.fi.upm.es/Mail/ciao-users/ -----------------------------------------------------------------------------
I am wondering how to use the trace/1 predicate. I included the three packages mentioned in the doc, but when I then do: ?- trace( --some styff-- ) I just get that trace/1 is undefined...
In general, you need to load the packages also in the toplevel to use them in such a way.
Unfortunately, in this case it won't work. The expansion performed for the trace predicate does not work from the shell prompt. You will have to inline calls to trace in the program code.
I would advise to use the Emacs interface; debugging becomes much simpler, as the code being executed is highlighted. You can, however, debug by hand in the old style: assume you want to trace predicates in the module 'ua'; then do:
[57]> ciao Ciao-Prolog 1.9 #8: Mon May 27 19:52:33 CEST 2002 ?- debug_module(ua). {No module is selected for debugging} {Modules selected for source debugging: [ua]}
yes ?- use_module(ua).
yes ?- trace. {The debugger will first creep -- showing everything (trace)}
yes {trace} ?- make_array([2,3], A, 0). 1 1 Call: ua:make_array([2,3],_320,0) ? 2 2 Call: ua:make_array_([2,3],_320,0,init) ? 3 3 Call: ua:dope([2,3],_640) ? ....
etc... you can select several modules for source debugging. If you want to debug a file which does not have module declaration, the module to select is 'user'.
The Emacs interface issues a debug_module_source/1 call which provides more information about the file and location where the traced call is performed; this is caught by the Emacs mode and used to place a cursor in the module source (if it is available). It can also be used to trace a standalone executable by starting it from a (unix) shell withing emacs which is has been put before in Ciao listener mode (M-x ciao-inferior-mode).