spy/1 development

Synopsis

spy +PredSpecs

Sets spypoints on all the predicates represented by PredSpecs

Arguments


PredSpecs gen_pred_spec_tree
Single predicate specification of form: Name, or Name/Arity, or a list of such. [MOD]

Description

Turns debugger on in debug mode, so that it will stop as soon as it reaches a spypoint. Turning off the debugger does not remove spypoints. Use nospy/1 or nospyall/0) to explicitly remove them.

Note that since spy is a built-in operator, the parentheses, which usually surround the arguments to a predicate, are not necessary (although they can be used if desired).

If you use the predicate specification form Name but there are no clauses for Name (of any arity), then a warning message will be displayed and no spypoint will be set.

     | ?- spy test.
     % The debugger will first leap -- showing spypoints (debug)
     * There are no predicates with the name test in module user
     
     yes
     [debug]
     

To place a spypoint on a currently undefined procedure, use the full form Name/Arity; you will still get a warning message, but the spypoint will be set .

     | ?- spy test/1.
     * You have no clauses for user:test/1
     % Spypoint placed on user:test/1
     
     yes
     [debug]
     | ?-
     

If spy/1 is given any invalid argument it prints a warning.

This predicate is not supported in runtime systems.

Exceptions


instantiation_error
if the argument is not ground.
type_error
if a Name is not an atom or an Arity not an integer.
domain_error
if a PredSpec is not a valid procedure specification, or if an Arity is specified as an integer outside the range 0-255.
permission_error
if a specified procedure is built-in or imported into the source module.

See Also

nospy/1, nospyall/0, debug/0, current_spypoint/1, add_spypoint/1, remove_spypoint/1