Next: , Previous: Trace, Up: Debugging


6.3 Controlling debugging output

The -d option to m4 (see Invoking m4) controls the amount of details presented, when using the macros described in the preceding sections.

The flags following the option can be one or more of the following:

a
Show the actual arguments in each macro call. This applies to all macro calls if the `t' flag is used, otherwise only the macros covered by calls of traceon.
c
Show several trace lines for each macro call. A line is shown when the macro is seen, but before the arguments are collected; a second line when the arguments have been collected and a third line after the call has completed.
e
Show the expansion of each macro call, if it is not void. This applies to all macro calls if the `t' flag is used, otherwise only the macros covered by calls of traceon.
f
Show the name of the current input file in each trace output line.
i
Print a message each time the current input file is changed, giving file name and input line number.
l
Show the current input line number in each trace output line.
p
Print a message when a named file is found through the path search mechanism (see Search Path), giving the actual file name used.
q
Quote actual arguments and macro expansions in the display with the current quotes.
t
Trace all macro calls made in this invocation of m4.
x
Add a unique `macro call id' to each line of the trace output. This is useful in connection with the `c' flag above.
V
A shorthand for all of the above flags.

If no flags are specified with the -d option, the default is `aeq'. The examples throughout this manual assume the default flags.

There is a builtin macro debugmode, which allows on-the-fly control of the debugging output format:

— Builtin: debugmode ([flags])

The argument flags should be a subset of the letters listed above. As special cases, if the argument starts with a `+', the flags are added to the current debug flags, and if it starts with a `-', they are removed. If no argument is present, all debugging flags are cleared (as if no -d was given), and with an empty argument the flags are reset to the default of `aeq'.

The expansion of debugmode is void.

     define(`foo', `FOO')
     =>
     traceon(`foo')
     =>
     debugmode()
     =>
     foo
     error-->m4trace: -1- foo -> `FOO'
     =>FOO
     debugmode
     =>
     foo
     error-->m4trace: -1- foo
     =>FOO
     debugmode(`+l')
     =>
     foo
     error-->m4trace:8: -1- foo
     =>FOO