GROFF_TRACE(7) | Miscellaneous Information Manual | GROFF_TRACE(7) |
NAME
groff_trace - groff macro package trace.tmacSYNOPSIS
[options ...] [files ...]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, this is, a diagnostic message is emitted on entering and exiting of a macro call. This greatly eases to track down an error in some macro.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 to the nirvana device /dev/null. The resulting diagnostic messages are displayed directly below the corresponding example.Command line option
Example:sh# echo '.
> .de test_macro
> ..
> .test_macro
> .test_macro some dummy arguments
> ' | groff -m trace >/dev/null
*** .de test_macro
*** de trace enter: .test_macro
*** trace exit: .test_macro
*** de trace enter: .test_macro "some" "dummy" "arguments"
*** trace exit: .test_macro "some" "dummy" "arguments"
Nested macro calls
Example:sh# echo '.
> .de child
> ..
> .de parent
> .child
> ..
> .parent
> ' | groff -m trace >/dev/null
*** .de child
*** .de parent
*** de trace enter: .parent
*** de trace enter: .child
*** trace exit: .child
*** trace exit: .parent
Activating with .mso
Example:sh# echo '.
> .de before
> ..
> .mso trace.tmac
> .de after
> ..
> .before
> .after
> .before
> ' | groff >/dev/null
*** de trace enter: .after
*** trace exit: .after
PROBLEMS
Because trace.tmac wraps the .de request (and its cousins), macro arguments are expanded one level more. This causes problems if an argument contains four backslashes or more to prevent too early expansion of the backslash. For example, this macro call-
.foo \\\\n[bar]
-
.foo \En[bar]
FILES
The trace macros are kept in the file trace.tmac located in the tmac directory; see groff_tmac(5) for details.ENVIRONMENT
- $GROFF_TMAC_PATH
- A colon-separated list of additional tmac directories in which to search for macro files; see groff_tmac(5) for details.
AUTHOR
Copyright (C) 2002, 2006, 2007, 2008 Free Software Foundation, Inc.SEE ALSO
- groff(1)
- An overview of the groff system.
- troff(1)
- For details on option -m.
- groffer(1)
- A viewer program for all kinds of roff documents.
- groff_tmac(5)
- A general description of groff macro packages.
- groff(7)
- A short reference for the groff formatting language.
30 December 2012 | Groff Version 1.22.1 |