www.delorie.com/gnu/docs/m4/m4_33.html   search  
Buy GNU books!

GNU macro processor

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.2 Tracing macro calls

It is possible to trace macro calls and expansions through the builtins traceon and 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')
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 6.3 Controlling debugging output for information on controlling the details of the display.

  webmaster     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003