All Manuals > LispWorks® User Guide and Reference Manual > 31 The CLOS Package

trace-new-instances-on-access Function

Summary

Traces new instances of a given class, based on access modes.

Package

clos

Signature

trace-new-instances-on-access class-designator &key read write slot-names break when process trace-output entrycond eval-before before backtrace => t

Arguments
class-designator
The class to trace.
read
A generalized boolean.
write
A generalized boolean.
slot-names
A list of symbols, or t.
break
A generalized boolean.
when
A form.
process
A form.
trace-output
A form.
entrycond
A form.
eval-before
A list of forms.
before
A list of forms.
backtrace
A keyword, t or nil.
Description

The function trace-new-instances-on-access causes new instances of the class given by class-designator to be traced for the access modes given by read, write and slot-names.

The keyword arguments read, write, slot-names, break, when, process, trace-output, entrycond, eval-before, before and backtrace control which type of access are traced, and provide preconditions for tracing, code to run before access, and how to print any trace output. They are interpreted as described for trace-on-access.

This function, when used with the :break keyword, replaces the deprecated function break-new-instances-on-access.

Examples
(trace-new-instances-on-access 'capi:display-pane
                               :slot-names nil)

Suppose you have a bug whereby the slot bar of an instance of your class foo is incorrectly being set to a negative integer value. You could cause entry into the debugger at the point where the slot is set incorrectly by evaluating this form:

(clos:trace-new-instances-on-access
  'foo
  :slot-names '(bar)
  :read nil
  :when '(and (integerp (car *traced-arglist*))
              (< (car *traced-arglist*) 0))
  :break t)

and running your program.

See also

break-new-instances-on-access
untrace-new-instances-on-access
trace-on-access


LispWorks® User Guide and Reference Manual - 01 Dec 2021 19:30:25