Am 11.06.2010 15:21, schrieb Christian Wirth: > Hi, > > i would like to debug dynamic predicates by tracing them. They are > created at runtime by parsing a file. > Is this possible ? > Yes, you can either use spy/1 to set spypoints on the dynamic predicates, or place the call to the dynamic predicates in a trace/1 goal. Suppose you want to debug dynamic predicate q/0, which is called inside a dynamic predicate p/0. The first way would look like this: test :- compile_term(q :- writeln("!")), compile_term(p :- q), spy(q), p. Here's a trace: [eclipse 2]: trace. Debugger switched on - creep mode [eclipse 3]: test. (1) 1 CALL test %> leap spypoint added to q/0. +(6) 3 CALL q %> creep (7) 4 CALL writeln_body("!", eclipse) %> skip ! (7) 4 EXIT writeln_body("!", eclipse) %> skip +(6) 3 EXIT q %> leap Yes (0.00s cpu) [eclipse 4]: The second way would look like this: test :- compile_term(q :- writeln("!")), compile_term(p :- trace(q)), p. Here, the debugger gets started automatically: [eclipse 2]: test. (1) 1 CALL q %> creep (2) 2 CALL writeln_body("!", eclipse) %> skip ! (2) 2 EXIT writeln_body("!", eclipse) %> creep (1) 1 EXIT q %> creep Yes (0.00s cpu) [eclipse 3]: Cheers, ThorstenReceived on Fri Jun 11 2010 - 14:05:58 CEST
This archive was generated by hypermail 2.3.0 : Wed Sep 25 2024 - 15:13:20 CEST