1 .\"***************************************************************************
2 .\" Copyright (c) 2000-2016,2017 Free Software Foundation, Inc. *
4 .\" Permission is hereby granted, free of charge, to any person obtaining a *
5 .\" copy of this software and associated documentation files (the *
6 .\" "Software"), to deal in the Software without restriction, including *
7 .\" without limitation the rights to use, copy, modify, merge, publish, *
8 .\" distribute, distribute with modifications, sublicense, and/or sell *
9 .\" copies of the Software, and to permit persons to whom the Software is *
10 .\" furnished to do so, subject to the following conditions: *
12 .\" The above copyright notice and this permission notice shall be included *
13 .\" in all copies or substantial portions of the Software. *
15 .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
16 .\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
17 .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
18 .\" IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
19 .\" DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
20 .\" OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
21 .\" THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
23 .\" Except as contained in this notice, the name(s) of the above copyright *
24 .\" holders shall not be used in advertising or otherwise to promote the *
25 .\" sale, use or other dealings in this Software without prior written *
27 .\"***************************************************************************
29 .\" $Id: curs_trace.3x,v 1.18 2017/01/14 19:46:40 tom Exp $
48 \fB_tracemouse\fR \- \fBcurses\fR debugging routines
52 \fB#include <curses.h>\fR
54 \fBvoid trace(const unsigned int \fP\fIparam\fP\fB);\fR
56 \fBvoid _tracef(const char *\fP\fIformat\fP\fB, ...);\fR
58 \fBchar *_traceattr(attr_t \fP\fIattr\fP\fB);\fR
60 \fBchar *_traceattr2(int \fP\fIbuffer\fP\fB, chtype \fP\fIch\fP\fB);\fR
62 \fBchar *_tracecchar_t(const cchar_t *\fP\fIstring\fP\fB);\fR
64 \fBchar *_tracecchar_t2(int \fP\fIbuffer\fP\fB, const cchar_t *\fP\fIstring\fP\fB);\fR
66 \fBchar *_tracechar(int \fP\fIch\fP\fB);\fR
68 \fBchar *_tracechtype(chtype \fP\fIch\fP\fB);\fR
70 \fBchar *_tracechtype2(int \fP\fIbuffer\fP\fB, chtype \fP\fIch\fP\fB);\fR
72 \fBvoid _tracedump(const char *\fP\fIlabel\fP\fB, WINDOW *\fP\fIwin\fP\fB);\fR
74 \fBchar *_nc_tracebits(void);\fR
76 \fBchar *_tracemouse(const MEVENT *\fP\fIevent\fP\fB);\fR
78 The \fBtrace\fR routines are used for debugging the ncurses libraries,
79 as well as applications which use the ncurses libraries.
80 These functions are normally available only with the debugging library
81 e.g., \fIlibncurses_g.a\fR, but may be compiled into any model (shared, static,
82 profile) by defining the symbol \fBTRACE\fR.
83 Additionally, some functions are only available with the wide-character
84 configuration of the libraries.
86 The principal parts of this interface are
88 \fBtrace\fR, which selectively enables different tracing features, and
90 \fB_tracef\fR, which writes formatted data to the \fItrace\fR file.
92 Calling \fBtrace\fR with a nonzero parameter creates the file \fBtrace\fR
93 in the current directory for output.
94 If the file already exists, no tracing is done.
96 The other functions either return a pointer to a string-area
97 (allocated by the corresponding function),
98 or return no value (such as \fB_tracedump\fP, which implements the
99 screen dump for \fBTRACE_UPDATE\fP).
100 The caller should not free these
101 strings, since the allocation is reused on successive calls.
102 To work around the problem of a single string-area per function,
103 some use a buffer-number parameter, telling the library to allocate
104 additional string-areas.
106 The trace parameter is formed by OR'ing
107 values from the list of \fBTRACE_\fP\fIxxx\fR definitions in \fB<curses.h>\fR.
111 turn off tracing by passing a zero parameter.
113 The library flushes the output file,
114 but retains an open file-descriptor to the trace file
115 so that it can resume tracing later if a nonzero parameter is passed
116 to the \fBtrace\fP function.
119 trace user and system times of updates.
122 trace \fBtputs\fP(3X) calls.
125 trace update actions, old & new screens.
128 trace cursor movement and scrolling.
131 trace all character outputs.
134 trace all update actions.
135 The old and new screen contents are written to the trace file
139 trace all curses calls.
140 The parameters for each call are traced, as well as return values.
143 trace virtual character puts, i.e., calls to \fBaddch\fR.
146 trace low-level input processing, including timeouts.
149 trace state of TTY control bits.
152 trace internal/nested calls.
155 trace per-character calls.
158 trace read/write of terminfo/termcap data.
161 trace changes to video attributes and colors.
164 maximum trace level, enables all of the separate trace features.
166 Some tracing features are enabled whenever the \fBtrace\fR parameter
168 Some features overlap.
169 The specific names are used as a guideline.
171 These functions check the \fBNCURSES_TRACE\fP environment variable,
172 to set the tracing feature as if \fBtrace\fP was called:
193 .SS Command-line Utilities
195 The command-line utilities such as \fBtic\fP(1) provide a verbose option
196 which extends the set of messages written using the \fBtrace\fP function.
197 Both of these (\fB\-v\fP and \fBtrace\fP)
198 use the same variable (\fB_nc_tracing\fP),
199 which determines the messages which are written.
201 Because the command-line utilities may call initialization functions
202 such as \fBsetupterm\fP, \fBtgetent\fP or \fBuse_extended_names\fP,
203 some of their debugging output may be directed to the \fItrace\fP file
204 if the \fBNCURSES_TRACE\fP environment variable is set:
206 messages produced in the utility are written to the standard error.
208 messages produced by the underlying library are written to \fItrace\fP.
210 If ncurses is built without tracing, none of the latter are produced,
211 and fewer diagnostics are provided by the command-line utilities.
213 Routines which return a value are designed to be used as parameters
214 to the \fB_tracef\fR routine.
216 These functions are not part of the XSI interface.
217 Some other curses implementations are known to
218 have similar, undocumented features,
219 but they are not compatible with ncurses.
221 A few functions are not provided when symbol versioning is used: