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