Go to the first, previous, next, last section, table of contents.

TRACE Pragma

<*TRACE <trace proc>*>
The pragma <*TRACE <trace proc>*> may appear at the end of any variable or formal declaration. This pragma will generate tracing calls whenever the declared variable is modified. The <trace proc> must evaluate to a procedure of two arguments. The first argument is the name of the traced variable, a TEXT. The second argument is the traced variable. Note that any of the formal passing modes may be used with the second argument. For example:

MODULE M;
VAR x: Foo <*TRACE MyTrace.FooChanged*>;

will cause

MyTrace.FooChanged ("M.x", x)

to be generated after each statement that modifies x. Variable aliasing is not tracked, so

WITH  alias = x DO  INC(alias) END

will not generate any tracing. The pragma <*TRACE stmt-list*> may appear immediately after any BEGIN. The specified "stmt-list" will be inserted after each statement of the block started by the BEGIN. For example:

BEGIN <* TRACE  INC(cnt); MyTrace(cnt) *>
  i := j;
  j := i;
END;

will generate INC(cnt); MyTrace(cnt) after each of the assignment statements.


Go to the first, previous, next, last section, table of contents.