1 .TH GROFF_TRACE @MAN7EXT@ "@MDATE@" "groff @VERSION@"
3 groff_trace \- groff macro package trace.tmac
6 .\" File position: <groff-source>/tmac/groff_trace.man
9 .\" Save and disable compatibility mode (for, e.g., Solaris 10/11).
10 .do nr groff_trace_C \n[.C]
14 .\" ====================================================================
16 .\" ====================================================================
18 .\" Copyright (C) 2002-2018 Free Software Foundation, Inc.
20 .\" This file is part of groff, the GNU roff type-setting system.
22 .\" Permission is granted to copy, distribute and/or modify this
23 .\" document under the terms of the GNU Free Documentation License,
24 .\" Version 1.3 or any later version published by the Free Software
25 .\" Foundation; with no Invariant Sections, with no Front-Cover Texts,
26 .\" and with no Back-Cover Texts.
28 .\" A copy of the Free Documentation License is included as a file
29 .\" called FDL in the main directory of the groff source package.
32 .\" ====================================================================
34 .\" ====================================================================
44 .\" ====================================================================
46 .\" ====================================================================
52 can be a valuable tool for debugging documents written in the roff
55 A call stack trace is protocolled on standard error, this is, a
56 diagnostic message is emitted on entering and exiting of a macro call.
58 This greatly eases to track down an error in some macro.
62 This tracing process is activated by specifying the groff or troff
66 This works also with the
67 .BR groffer (@MAN1EXT@)
70 A finer control can be obtained by including the macro file within the
71 document by the groff macro call
72 .BR .mso\ trace.tmac .
74 Only macros that are defined after this line are traced.
78 If the command-line option
80 is given (or if this register is set in the document), number and
81 string register assignments together with some other requests are
86 If some other macro package should be traced as well it must be
95 is unusual because it does not contain any macros to be called by a
98 Instead, the existing macro definition and appending facilities are
99 modified such that they display diagnostic messages.
102 .\" ====================================================================
104 .\" ====================================================================
106 In the following examples, a roff fragment is fed into groff via
109 As we are only interested in the diagnostic messages (standard error)
110 on the terminal, the normal formatted output (standard output) is
111 redirected to the nirvana device
114 The resulting diagnostic messages are displayed directly below the
115 corresponding example.
118 .\" ====================================================================
119 .SS "Command line option"
125 \fIsh#\fP echo \[aq].
129 > .test_macro some dummy arguments
130 > \[aq] | groff \-m trace > /dev/null
133 *** de trace enter: .test_macro
134 *** trace exit: .test_macro
135 *** de trace enter: .test_macro "some" "dummy" "arguments"
136 *** trace exit: .test_macro "some" "dummy" "arguments"
141 The entry and the exit of each macro call is displayed on the terminal
142 (standard output) \[em] together with the arguments (if any).
145 .\" ====================================================================
146 .SS "Nested macro calls"
152 \fIsh#\fP echo \[aq].
159 > \[aq] | groff \-m trace > /dev/null
163 *** de trace enter: .parent
164 *** de trace enter: .child
165 *** trace exit: .child
166 *** trace exit: .parent
171 This shows that macro calls can be nested.
173 This powerful feature can help to tack down quite complex call stacks.
176 .\" ====================================================================
177 .SS "Activating with .mso"
183 \fIsh#\fP echo \[aq].
192 > \[aq] | groff > /dev/null
194 *** de trace enter: .after
195 *** trace exit: .after
200 Here, the tracing is activated within the document, not by a
203 As tracing was not active when macro
205 was defined, no call of this macro is protocolled; on the other hand,
208 is fully protocolled.
211 .\" ====================================================================
213 .\" ====================================================================
219 request (and its cousins), macro arguments are expanded one level more.
221 This causes problems if an argument contains four backslashes or more
222 to prevent too early expansion of the backslash.
224 For example, this macro call
228 \&.foo \e\e\e\en[bar]
233 normally passes \[oq]\e\en[bar]\[cq] to macro \[oq].foo\[cq], but with
236 request it passes \[oq]\en[bar]\[cq] instead.
240 The solution to this problem is to use groff's
242 escape which is an escape character not interpreted in copy mode, for
251 .\" ====================================================================
253 .\" ====================================================================
257 macros are kept in the file
260 .IR "tmac directory" ;
262 .BR groff_tmac (@MAN5EXT@)
266 .\" ====================================================================
268 .\" ====================================================================
272 A colon-separated list of additional tmac directories in which to
273 search for macro files; see
274 .BR groff_tmac (@MAN5EXT@)
278 .\" ====================================================================
280 .\" ====================================================================
284 macro packages was written by James Clark.
286 This document was written by
287 .MT groff\-bernd.warken\-72@\:web.de
292 .\" ====================================================================
294 .\" ====================================================================
296 .IR "Groff: The GNU Implementation of troff" ,
297 by Trent A.\& Fisher and Werner Lemberg,
302 You can browse it interactively with \[lq]info groff\[rq].
306 .BR groff (@MAN1EXT@)
307 An overview of the groff system.
310 .BR troff (@MAN1EXT@)
311 For details on option
315 .BR groffer (@MAN1EXT@)
316 A viewer program for all kinds of roff documents.
319 .BR groff_tmac (@MAN5EXT@)
320 A general description of groff macro packages.
323 .BR groff (@MAN7EXT@)
324 A short reference for the groff formatting language.
326 .\" Restore compatibility mode (for, e.g., Solaris 10/11).
327 .cp \n[groff_trace_C]
333 .\" vim: set filetype=groff: