You can get the information on the (debuggable) goals called by a predicate with the port_calls and port_lines options of get_flag/3 (see the bip documentation for get_flag/3, e.g. with help/1). However, it seems easier to debug by setting breakpoints (and spypoints) and using the tracer (in particular in tkeclipse) -- this is what the port_calls and port_lines are designed to support. Cheers, Kish On 13/02/2013 07:54, Basile Starynkevitch wrote: > Hello All, > > In C or C++ I would routinely have > > #define dbgprintf(Fmt,...) do{if(debugging) printf("%s:%d:" Fmt "\n", __FILE__,__LINE__, ##__VA_ARGS__);}while(0) > > and then I would use at many places things like (in file foo.c line 123) > dbgprintf("here x=%d", x); > with an output like > foo.c:123: Here x=10 > > > Is it possible to get the line number of the invoking super-goal in Eclipse Prolog? > > So far in https://github.com/bstarynk/BOPL-APS > > I'm coding > dbgprintf(Name,Fmt,Args) :- > debugWanted(Name), atom(Name) > -> printf(output, "*| %a ",[Name]), printf(output, Fmt, Args), nl, ! > ; true, ! > . > > then later using > > dbgprintf(parseVarsList," TokensAfterKwVars=%w", [TokensAfterKwVars]), > > assuming that I would assert debugWanted(parseVarsList) somewhere > > but this don't give me the line number. > > Perhaps the attribute feature might help, because I'm guessing > that Compiler/source_processor.ecl is keeping the source location... > > But I am not familiar enough with Eclipse CLP to understand if it is feasible or not. > > Regards >Received on Wed Feb 13 2013 - 18:31:56 CET
This archive was generated by hypermail 2.3.0 : Wed Sep 25 2024 - 15:13:20 CEST