1GROFF_TRACE(7)         Miscellaneous Information Manual         GROFF_TRACE(7)
2
3
4

NAME

6       groff_trace - groff macro package trace.tmac
7

SYNOPSIS

9       groff -m trace [options...] [files...]
10
11       Elements  in brackets denote optional arguments, and the ellipsis means
12       that there can be any number of arguments of this kind.
13

DESCRIPTION

15       The trace macro package of groff(1) can be a valuable tool  for  debug‐
16       ging  documents  written in the roff formatting language.  A call stack
17       trace is protocolled on standard error, that means, a  diagnostic  mes‐
18       sage  is emitted on entering and exiting of a macro call.  This greatly
19       eases to track down an error in some macro.
20
21       This tracing process is activated by specifying the groff or troff com‐
22       mand  line option -m trace.  This works also with the groffer(1) viewer
23       program.  A finer control can be obtained by including the  macro  file
24       within  the  document  by  the  groff macro call .mso trace.tmac.  Only
25       macros that are defined after this line are traced.
26
27       If some other macro package should be traced as well it must be  speci‐
28       fied after -m trace on the command line.
29
30       The  macro  file  trace.tmac is unusual because it does not contain any
31       macros to be called by a user.  Instead, the existing macro  definition
32       and appending facilities are modified such that they display diagnostic
33       messages.
34

EXAMPLES

36       In the following examples, a roff fragment is fed into groff via  stan‐
37       dard  input.   As  we  are  only  interested in the diagnostic messages
38       (standard error) on the terminal, the normal formatted output (standard
39       output) is redirected into the nirvana device /dev/null.  The resulting
40       diagnostic messages are  displayed  directly  below  the  corresponding
41       example.
42
43   Command line option
44       sh# echo '.
45       >   .de test_macro
46       >   ..
47       >   .test_macro
48       >   .test_macro some dummy arguments
49       >   ' | groff -m trace >/dev/null
50
51       *** de trace enter: test_macro
52       *** trace exit: test_macro
53       *** de trace enter: test_macro "some" "dummy" "arguments"
54       *** trace exit: test_macro "some" "dummy" "arguments"
55
56       The  entry and the exit of each macro call is displayed on the terminal
57       (standard output) — together with the arguments (if any).
58
59   Nested macro calls
60       sh# echo '.
61       >   .de child
62       >   ..
63       >   .de parent
64       >   .child
65       >   ..
66       >   .parent
67       >   ' | groff -m trace >/dev/null
68
69       *** de trace enter: parent
70       *** de trace enter: child
71       *** trace exit: child
72       *** trace exit: parent
73
74       This shows that macro calls can be nested.  This powerful  feature  can
75       help to tack down quite complex call stacks.
76
77   Activating with .mso
78       sh# echo '.
79       >   .de before
80       >   ..
81       >   .mso trace.tmac
82       >   .de after
83       >   ..
84       >   .before
85       >   .after
86       >   .before
87       >   ' | groff >/dev/null
88
89       *** de trace enter: after
90       *** trace exit: after
91
92       Here,  the  tracing  is activated within the document, not by a command
93       line option.  As tracing was not active when macro before was  defined,
94       no  call of this macro is protocolled; on the other hand, the macro af‐
95       ter is fully protocolled.
96

FILES

98       The trace macros are kept in the file trace.tmac located  in  the  tmac
99       directory; see groff_tmac(5) for details.
100

ENVIRONMENT

102       $GROFF_TMAC_PATH
103              A  colon-separated  list of additional tmac directories in which
104              to search for macro files; see groff_tmac(5) for details.
105

AUTHOR

107       Copyright (C) 2002 Free Software Foundation, Inc.
108
109       This document is distributed under the terms of the FDL (GNU Free Docu‐
110       mentation  License)  version  1.1 or later.  You should have received a
111       copy of the FDL on your system, it is also available on-line at the GNU
112       copyleft site ⟨http://www.gnu.org/copyleft/fdl.html⟩.
113
114       This  document  is  part  of  groff, the GNU roff distribution.  It was
115       written by Bernd Warken ⟨bwarken@mayn.de⟩.
116

SEE ALSO

118       groff(1)
119              An overview of the groff system.
120
121       troff(1)
122              For details on option -m.
123
124       groffer(1)
125              A viewer program for all kinds of roff documents.
126
127       groff_tmac(5)
128              A general description of groff macro packages.
129
130       groff(7)
131              A short reference for the groff formatting language.
132
133       A complete reference for all parts of the groff system is found in  the
134       groff info(1) file.
135
136
137
138Groff Version 1.18.1.4           13 July 2002                   GROFF_TRACE(7)
Impressum