GROFF_TRACE

Section: Environments, Tables, and Troff Macros (7)
Updated: 13 July 2002
Index Return to Main Contents
 

NAME

groff_trace - groff macro package trace.tmac  

SYNOPSIS

groff -m trace [optionsEllipsis]] [filesEllipsis]] Elements in brackets denote optional arguments, and the ellipsis means that there can be any number of arguments of this kind.  

DESCRIPTION

The trace macro package of groff(1) can be a valuable tool for debugging documents written in the roff formatting language. A call stack trace is protocolled on standard error, that means, a diagnostic message is emitted on entering and exiting of a macro call. This greatly eases to track down an error in some macro. This tracing process is activated by specifying the groff or troff command line option -m~trace. This works also with the groffer(1) viewer program. A finer control can be obtained by including the macro file within the document by the groff macro call .mso~trace.tmac. Only macros that are defined after this line are traced. If some other macro package should be traced as well it must be specified after -m~trace on the command line. The macro file trace.tmac is unusual because it does not contain any macros to be called by a user. Instead, the existing macro definition and appending facilities are modified such that they display diagnostic messages.  

EXAMPLES

In the following examples, a roff fragment is fed into groff via standard input. As we are only interested in the diagnostic messages (standard error) on the terminal, the normal formatted output (standard output) is redirected into the nirvana device /dev/null. The resulting diagnostic messages are displayed directly below the corresponding example.  

Command line option

 

ell_cmd echo '.

 

ell_cmd+ .de test_macro

 

ell_cmd+ ..

 

ell_cmd+ .test_macro

 

ell_cmd+ .test_macro some dummy arguments

 

ell_cmd+ ' | groff -m trace >/dev/null

*** de trace enter: test_macro
*** trace exit: test_macro
*** de trace enter: test_macro "some" "dummy" "arguments"
*** trace exit: test_macro "some" "dummy" "arguments"