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


Tracing macro calls

It is possible to trace macro calls and expansions through the builtins traceon and traceoff:

traceon(...)
traceoff(...)

When called without any arguments, traceon and traceoff will turn tracing on and off, respectively, for all defined macros. When called with arguments, only the named macros are affected.

The expansion of traceon and traceoff is void.

Whenever a traced macro is called and the arguments have been collected, the call is displayed. If the expansion of the macro call is not void, the expansion can be displayed after the call. The output is printed directly on the standard error output.

define(`foo', `Hello World.')
=>
define(`echo', `$@')
=>
traceon(`foo', `echo')
=>
foo
error-->m4trace: -1- foo -> `Hello World.'
=>Hello World.
echo(gnus, and gnats)
error-->m4trace: -1- echo(`gnus', `and gnats') -> ``gnus',`and gnats''
=>gnus,and gnats

The number between dashes is the depth of the expansion. It is one most of the time, signifying an expansion at the outermost level, but it increases when macro arguments contain unquoted macro calls.

See section Controlling debugging output for information on controlling the details of the display.


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