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.19 2017/11/18 23:47:37 tom Exp $
49 \fB_tracemouse\fR \- \fBcurses\fR debugging routines
53 \fB#include <curses.h>\fR
55 \fBvoid trace(const unsigned int \fP\fIparam\fP\fB);\fR
57 \fBvoid _tracef(const char *\fP\fIformat\fP\fB, ...);\fR
59 \fBchar *_traceattr(attr_t \fP\fIattr\fP\fB);\fR
61 \fBchar *_traceattr2(int \fP\fIbuffer\fP\fB, chtype \fP\fIch\fP\fB);\fR
63 \fBchar *_tracecchar_t(const cchar_t *\fP\fIstring\fP\fB);\fR
65 \fBchar *_tracecchar_t2(int \fP\fIbuffer\fP\fB, const cchar_t *\fP\fIstring\fP\fB);\fR
67 \fBchar *_tracechar(int \fP\fIch\fP\fB);\fR
69 \fBchar *_tracechtype(chtype \fP\fIch\fP\fB);\fR
71 \fBchar *_tracechtype2(int \fP\fIbuffer\fP\fB, chtype \fP\fIch\fP\fB);\fR
73 \fBvoid _tracedump(const char *\fP\fIlabel\fP\fB, WINDOW *\fP\fIwin\fP\fB);\fR
75 \fBchar *_nc_tracebits(void);\fR
77 \fBchar *_tracemouse(const MEVENT *\fP\fIevent\fP\fB);\fR
79 The \fBtrace\fR routines are used for debugging the ncurses libraries,
80 as well as applications which use the ncurses libraries.
81 These functions are normally available only with the debugging library
82 e.g., \fIlibncurses_g.a\fR, but may be compiled into any model (shared, static,
83 profile) by defining the symbol \fBTRACE\fR.
84 Additionally, some functions are only available with the wide-character
85 configuration of the libraries.
87 The principal parts of this interface are
89 \fBtrace\fR, which selectively enables different tracing features, and
91 \fB_tracef\fR, which writes formatted data to the \fItrace\fR file.
93 Calling \fBtrace\fR with a nonzero parameter creates the file \fBtrace\fR
94 in the current directory for output.
95 If the file already exists, no tracing is done.
97 The other functions either return a pointer to a string-area
98 (allocated by the corresponding function),
99 or return no value (such as \fB_tracedump\fP, which implements the
100 screen dump for \fBTRACE_UPDATE\fP).
101 The caller should not free these
102 strings, since the allocation is reused on successive calls.
103 To work around the problem of a single string-area per function,
104 some use a buffer-number parameter, telling the library to allocate
105 additional string-areas.
107 The trace parameter is formed by OR'ing
108 values from the list of \fBTRACE_\fP\fIxxx\fR definitions in \fB<curses.h>\fR.
112 turn off tracing by passing a zero parameter.
114 The library flushes the output file,
115 but retains an open file-descriptor to the trace file
116 so that it can resume tracing later if a nonzero parameter is passed
117 to the \fBtrace\fP function.
120 trace user and system times of updates.
123 trace \fBtputs\fP(3X) calls.
126 trace update actions, old & new screens.
129 trace cursor movement and scrolling.
132 trace all character outputs.
135 trace all update actions.
136 The old and new screen contents are written to the trace file
140 trace all curses calls.
141 The parameters for each call are traced, as well as return values.
144 trace virtual character puts, i.e., calls to \fBaddch\fR.
147 trace low-level input processing, including timeouts.
150 trace state of TTY control bits.
153 trace internal/nested calls.
156 trace per-character calls.
159 trace read/write of terminfo/termcap data.
162 trace changes to video attributes and colors.
165 maximum trace level, enables all of the separate trace features.
167 Some tracing features are enabled whenever the \fBtrace\fR parameter
169 Some features overlap.
170 The specific names are used as a guideline.
172 These functions check the \fBNCURSES_TRACE\fP environment variable,
173 to set the tracing feature as if \fBtrace\fP was called:
194 .SS Command-line Utilities
196 The command-line utilities such as \fBtic\fP(1) provide a verbose option
197 which extends the set of messages written using the \fBtrace\fP function.
198 Both of these (\fB\-v\fP and \fBtrace\fP)
199 use the same variable (\fB_nc_tracing\fP),
200 which determines the messages which are written.
202 Because the command-line utilities may call initialization functions
203 such as \fBsetupterm\fP, \fBtgetent\fP or \fBuse_extended_names\fP,
204 some of their debugging output may be directed to the \fItrace\fP file
205 if the \fBNCURSES_TRACE\fP environment variable is set:
207 messages produced in the utility are written to the standard error.
209 messages produced by the underlying library are written to \fItrace\fP.
211 If ncurses is built without tracing, none of the latter are produced,
212 and fewer diagnostics are provided by the command-line utilities.
214 Routines which return a value are designed to be used as parameters
215 to the \fB_tracef\fR routine.
217 These functions are not part of the XSI interface.
218 Some other curses implementations are known to
219 have similar, undocumented features,
220 but they are not compatible with ncurses.
222 A few functions are not provided when symbol versioning is used: