]> ncurses.scripts.mit.edu Git - ncurses.git/blob - man/curs_trace.3x
ncurses 6.0 - patch 20170415
[ncurses.git] / man / curs_trace.3x
1 .\"***************************************************************************
2 .\" Copyright (c) 2000-2016,2017 Free Software Foundation, Inc.              *
3 .\"                                                                          *
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:                 *
11 .\"                                                                          *
12 .\" The above copyright notice and this permission notice shall be included  *
13 .\" in all copies or substantial portions of the Software.                   *
14 .\"                                                                          *
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.                               *
22 .\"                                                                          *
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       *
26 .\" authorization.                                                           *
27 .\"***************************************************************************
28 .\"
29 .\" $Id: curs_trace.3x,v 1.18 2017/01/14 19:46:40 tom Exp $
30 .de bP
31 .IP \(bu 4
32 ..
33 .TH curs_trace 3X ""
34 .na
35 .hy 0
36 .SH NAME
37 \fBtrace\fR,
38 \fB_tracef\fR,
39 \fB_traceattr\fR,
40 \fB_traceattr2\fR,
41 \fB_tracecchar_t\fR,
42 \fB_tracecchar_t2\fR,
43 \fB_tracechar\fR,
44 \fB_tracechtype\fR,
45 \fB_tracechtype2\fR,
46 \fB_nc_tracebits\fR,
47 \fB_tracedump\fR,
48 \fB_tracemouse\fR \- \fBcurses\fR debugging routines
49 .ad
50 .hy
51 .SH SYNOPSIS
52 \fB#include <curses.h>\fR
53 .sp
54 \fBvoid trace(const unsigned int \fP\fIparam\fP\fB);\fR
55 .sp
56 \fBvoid _tracef(const char *\fP\fIformat\fP\fB, ...);\fR
57 .sp
58 \fBchar *_traceattr(attr_t \fP\fIattr\fP\fB);\fR
59 .br
60 \fBchar *_traceattr2(int \fP\fIbuffer\fP\fB, chtype \fP\fIch\fP\fB);\fR
61 .br
62 \fBchar *_tracecchar_t(const cchar_t *\fP\fIstring\fP\fB);\fR
63 .br
64 \fBchar *_tracecchar_t2(int \fP\fIbuffer\fP\fB, const cchar_t *\fP\fIstring\fP\fB);\fR
65 .br
66 \fBchar *_tracechar(int \fP\fIch\fP\fB);\fR
67 .br
68 \fBchar *_tracechtype(chtype \fP\fIch\fP\fB);\fR
69 .br
70 \fBchar *_tracechtype2(int \fP\fIbuffer\fP\fB, chtype \fP\fIch\fP\fB);\fR
71 .sp
72 \fBvoid _tracedump(const char *\fP\fIlabel\fP\fB, WINDOW *\fP\fIwin\fP\fB);\fR
73 .br
74 \fBchar *_nc_tracebits(void);\fR
75 .br
76 \fBchar *_tracemouse(const MEVENT *\fP\fIevent\fP\fB);\fR
77 .SH DESCRIPTION
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.
85 .SS Functions
86 The principal parts of this interface are
87 .bP
88 \fBtrace\fR, which selectively enables different tracing features, and
89 .bP
90 \fB_tracef\fR, which writes formatted data to the \fItrace\fR file.
91 .PP
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.
95 .PP
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.
105 .SS Trace Parameter
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.
108 These include:
109 .TP 5
110 .B TRACE_DISABLE
111 turn off tracing by passing a zero parameter.
112 .IP
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.
117 .TP 5
118 .B TRACE_TIMES
119 trace user and system times of updates.
120 .TP 5
121 .B TRACE_TPUTS
122 trace \fBtputs\fP(3X) calls.
123 .TP 5
124 .B TRACE_UPDATE
125 trace update actions, old & new screens.
126 .TP 5
127 .B TRACE_MOVE
128 trace cursor movement and scrolling.
129 .TP 5
130 .B TRACE_CHARPUT
131 trace all character outputs.
132 .TP 5
133 .B TRACE_ORDINARY
134 trace all update actions.
135 The old and new screen contents are written to the trace file
136 for each refresh.
137 .TP 5
138 .B TRACE_CALLS
139 trace all curses calls.
140 The parameters for each call are traced, as well as return values.
141 .TP 5
142 .B TRACE_VIRTPUT
143 trace virtual character puts, i.e., calls to \fBaddch\fR.
144 .TP 5
145 .B TRACE_IEVENT
146 trace low-level input processing, including timeouts.
147 .TP 5
148 .B TRACE_BITS
149 trace state of TTY control bits.
150 .TP 5
151 .B TRACE_ICALLS
152 trace internal/nested calls.
153 .TP 5
154 .B TRACE_CCALLS
155 trace per-character calls.
156 .TP 5
157 .B TRACE_DATABASE
158 trace read/write of terminfo/termcap data.
159 .TP 5
160 .B TRACE_ATTRS
161 trace changes to video attributes and colors.
162 .TP 5
163 .B TRACE_MAXIMUM
164 maximum trace level, enables all of the separate trace features.
165 .PP
166 Some tracing features are enabled whenever the \fBtrace\fR parameter
167 is nonzero.
168 Some features overlap.
169 The specific names are used as a guideline.
170 .SS Initialization
171 These functions check the \fBNCURSES_TRACE\fP environment variable,
172 to set the tracing feature as if \fBtrace\fP was called:
173 .RS 4
174 .PP
175 .na
176 .hy 0
177 filter,
178 initscr,
179 new_prescr,
180 newterm,
181 nofilter,
182 restartterm,
183 ripoffline,
184 setupterm,
185 slk_init,
186 tgetent,
187 use_env,
188 use_extended_names,
189 use_tioctl
190 .hy
191 .ad
192 .RE
193 .SS Command-line Utilities
194 .PP
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.
200 .PP
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:
205 .bP
206 messages produced in the utility are written to the standard error.
207 .bP
208 messages produced by the underlying library are written to \fItrace\fP.
209 .PP
210 If ncurses is built without tracing, none of the latter are produced,
211 and fewer diagnostics are provided by the command-line utilities.
212 .SH RETURN VALUE
213 Routines which return a value are designed to be used as parameters
214 to the \fB_tracef\fR routine.
215 .SH PORTABILITY
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.
220 .PP
221 A few functions are not provided when symbol versioning is used:
222 .RS 4
223 .PP
224 _nc_tracebits,
225 _tracedump,
226 _tracemouse
227 .RE
228 .SH SEE ALSO
229 \fBcurses\fR(3X).