Next: Debug Output, Previous: Trace, Up: Debugging
The -d option to m4 (or --debug,
see Invoking m4) controls the amount of details
presented in three
categories of output. Trace output is requested by traceon
(see Trace), and each line is prefixed by `m4trace:' in
relation to a macro invocation. Debug output tracks useful events not
associated with a macro invocation, and each line is prefixed by
`m4debug:'. Finally, dumpdef (see Dumpdef) output is
affected, with no prefix added to the output lines.
The flags following the option can be one or more of the following:
atraceon.
cetraceon.
filpqtm4, regardless of the settings of traceon.
xVIf 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:
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
debugmodeis void.
$ m4
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