
spy_term(?Term, ++Cond)

   Create a SPYTERM-port in the debugger and prepare for tracing
modifications to Term as MODIFY-ports.



Arguments
   Term                A variable or any term containing variables.
   Cond                A trigger condition (as in suspend/3).

Type
   Debugging

Description
    This predicate allows to trace modifications to variables in Term.


    When the debugger is on, this predicate causes a SPYTERM-port
    to be displayed. In the subsequent execution, any variable
    modification in Term which satisfies the trigger condition Cond
    will be shown as a MODIFY-port. The SPYTERM and MODIFY-port have
    the same unique invocation number, therefore the invocation-skip
    command (i) can be used to follow the chain of modifications.


    The  trigger conditions are specified in the same way as in the
    suspend/3 built-in.
    
    This feature is implemented using high-priority (1) delayed goals
    which create the MODIFY-ports.  These goals are visible to the
    user as monitor_term/4 goals among the delayed goals.


    CAUTION: Term is interpreted by the debugger as a goal. If Term
    looks like a call of a visible predicate, this predicate's settings
    (spy, traceable, etc) are taken into account for the SPYTERM and
    MODIFY ports as well. In particular, don't use a list for Term,
    since that looks like the compile-built-in ./2 which is untraceable.




Modes and Determinism
   spy_term(?, ++) is det

Modules
   This predicate is sensitive to its module context (tool predicate, see @/2).

Exceptions
     6 --- Not a valid trigger condition.

Examples
   
[eclipse 1]: lib(fd).
yes.

[eclipse 1]: trace.
Debugger switched on - creep mode

[eclipse 3]: [X, Y] :: 1..9,
	     spy_term(v(X,Y), v(X,Y)->any),
	     X #> Y, Y #> X.
  (1) 1 CALL  [X, Y] :: 1..9   %> creep
  (1) 1 EXIT  [X{[... .. ...]}, Y{[...]}] :: 1..9   %> creep
  (3) 2 SPYTERM  v(X{[1..9]}, Y{[1..9]})   %> jump to invoc: [3]? 
  (3) 3 MODIFY  v(X{[2..9]}, Y{[1..8]})   %> jump to invoc: [3]? 
  (3) 3 MODIFY  v(X{[2..7]}, Y{[3..8]})   %> jump to invoc: [3]? 
  (3) 4 MODIFY  v(X{[4..7]}, Y{[3..6]})   %> jump to invoc: [3]? 
  (3) 4 MODIFY  v(X{[4, 5]}, Y{[5, 6]})   %> jump to invoc: [3]? 

no (more) solution.






See Also
   suspend / 3, spy_var / 1, trace_point_port / 3, trace / 1
