m4: Debug Output

 
 7.4 Saving debugging output
 ===========================
 
 Debug and tracing output can be redirected to files using either the
 '--debugfile' option to 'm4' (⇒Invoking m4 Debugging options.), or
 with the builtin macro 'debugfile':
 
  -- Builtin: debugfile ([FILE])
      Sends all further debug and trace output to FILE, opened in append
      mode.  If FILE is the empty string, debug and trace output are
      discarded.  If 'debugfile' is called without any arguments, debug
      and trace output are sent to standard error.  This does not affect
      warnings, error messages, or 'errprint' output, which are always
      sent to standard error.  If FILE cannot be opened, the current
      debug file is unchanged, and an error is issued.
 
      The expansion of 'debugfile' is void.
 
      $ m4 -d
      traceon(`divnum')
      =>
      divnum(`extra')
      error->m4:stdin:2: Warning: excess arguments to builtin `divnum' ignored
      error->m4trace: -1- divnum(`extra') -> `0'
      =>0
      debugfile()
      =>
      divnum(`extra')
      error->m4:stdin:4: Warning: excess arguments to builtin `divnum' ignored
      =>0
      debugfile
      =>
      divnum
      error->m4trace: -1- divnum -> `0'
      =>0