1curs_trace(3X)                                                  curs_trace(3X)
2
3
4

NAME

6       curses_trace, trace, _tracef, _traceattr, _traceattr2, _tracecchar_t,
7       _tracecchar_t2, _tracechar, _tracechtype, _tracechtype2, _nc_tracebits,
8       _tracedump, _tracemouse - curses debugging routines
9

SYNOPSIS

11       #include <curses.h>
12
13       unsigned curses_trace(const unsigned param);
14
15       void _tracef(const char *format, ...);
16
17       char *_traceattr(attr_t attr);
18       char *_traceattr2(int buffer, chtype ch);
19       char *_tracecchar_t(const cchar_t *string);
20       char *_tracecchar_t2(int buffer, const cchar_t *string);
21       char *_tracechar(int ch);
22       char *_tracechtype(chtype ch);
23       char *_tracechtype2(int buffer, chtype ch);
24
25       void _tracedump(const char *label, WINDOW *win);
26       char *_nc_tracebits(void);
27       char *_tracemouse(const MEVENT *event);
28
29       /* deprecated */
30       void trace(const unsigned int param);
31

DESCRIPTION

33       The curses trace routines are used for debugging the ncurses libraries,
34       as well as applications which use the ncurses libraries.  Some  limita‐
35       tions apply:
36
37       •   Aside from curses_trace, the other functions are normally available
38           only with the debugging library e.g., libncurses_g.a.
39
40           All of the trace functions may be compiled into any model  (shared,
41           static, profile) by defining the symbol TRACE.
42
43       •   Additionally,  the  functions  which use cchar_t are only available
44           with the wide-character configuration of the libraries.
45
46   Functions
47       The principal parts of this interface are
48
49curses_trace, which selectively enables different tracing features,
50           and
51
52_tracef, which writes formatted data to the trace file.
53
54           The other functions either return a pointer to a string-area (allo‐
55           cated by the corresponding function), or return no value  (such  as
56           _tracedump,  which  implements  the  screen dump for TRACE_UPDATE).
57           The caller should not free these strings, since the  allocation  is
58           reused on successive calls.  To work around the problem of a single
59           string-area per  function,  some  use  a  buffer-number  parameter,
60           telling the library to allocate additional string-areas.
61
62       The curses_trace function is always available, whether or not the other
63       trace functions are available:
64
65       •   If tracing is available, calling curses_trace with a nonzero param‐
66           eter updates the trace mask, and returns the previous trace mask.
67
68           When the trace mask is nonzero, ncurses creates the file “trace” in
69           the current directory for output.  If the file already  exists,  no
70           tracing is done.
71
72       •   If tracing is not available, curses_trace returns zero (0).
73
74   Trace Parameter
75       The  trace  parameter  is  formed  by  OR'ing  values  from the list of
76       TRACE_xxx definitions in <curses.h>.  These include:
77
78       TRACE_DISABLE
79            turn off tracing by passing a zero parameter.
80
81            The library flushes the output file, but retains an open  file-de‐
82            scriptor  to the trace file so that it can resume tracing later if
83            a nonzero parameter is passed to the curses_trace function.
84
85       TRACE_TIMES
86            trace user and system times of updates.
87
88       TRACE_TPUTS
89            trace tputs(3X) calls.
90
91       TRACE_UPDATE
92            trace update actions, old & new screens.
93
94       TRACE_MOVE
95            trace cursor movement and scrolling.
96
97       TRACE_CHARPUT
98            trace all character outputs.
99
100       TRACE_ORDINARY
101            trace all update actions.  The old and  new  screen  contents  are
102            written to the trace file for each refresh.
103
104       TRACE_CALLS
105            trace  all curses calls.  The parameters for each call are traced,
106            as well as return values.
107
108       TRACE_VIRTPUT
109            trace virtual character puts, i.e., calls to addch.
110
111       TRACE_IEVENT
112            trace low-level input processing, including timeouts.
113
114       TRACE_BITS
115            trace state of TTY control bits.
116
117       TRACE_ICALLS
118            trace internal/nested calls.
119
120       TRACE_CCALLS
121            trace per-character calls.
122
123       TRACE_DATABASE
124            trace read/write of terminfo/termcap data.
125
126       TRACE_ATTRS
127            trace changes to video attributes and colors.
128
129       TRACE_MAXIMUM
130            maximum trace level, enables all of the separate trace features.
131
132       Some tracing features are enabled whenever the  curses_trace  parameter
133       is  nonzero.   Some features overlap.  The specific names are used as a
134       guideline.
135
136   Initialization
137       These functions check the NCURSES_TRACE environment  variable,  to  set
138       the tracing feature as if curses_trace was called:
139
140           filter, initscr, new_prescr, newterm, nofilter, restartterm,
141           ripoffline, setupterm, slk_init, tgetent, use_env,
142           use_extended_names, use_tioctl
143
144   Command-line Utilities
145       The  command-line  utilities  such  as  tic(1) provide a verbose option
146       which extends the set of messages written using the curses_trace  func‐
147       tion.   Both  of  these  (-v  and  curses_trace)  use the same variable
148       (_nc_tracing), which determines the messages which are written.
149
150       Because the command-line utilities may  call  initialization  functions
151       such  as setupterm, tgetent or use_extended_names, some of their debug‐
152       ging output may be directed to the trace file if the NCURSES_TRACE  en‐
153       vironment variable is set:
154
155       •   messages produced in the utility are written to the standard error.
156
157       •   messages produced by the underlying library are written to trace.
158
159       If  ncurses  is built without tracing, none of the latter are produced,
160       and fewer diagnostics are provided by the command-line utilities.
161

RETURN VALUE

163       Routines which return a value are designed to be used as parameters  to
164       the _tracef routine.
165

PORTABILITY

167       These  functions  are not part of the XSI interface.  Some other curses
168       implementations are known to have similar features, but  they  are  not
169       compatible with ncurses:
170
171       •   SVr4  provided  traceon  and traceoff, to control whether debugging
172           information was written to the “trace” file.  While  the  functions
173           were  always  available, this feature was only enabled if DEBUG was
174           defined when building the library.
175
176           The SVr4 tracing feature is undocumented.
177
178       •   PDCurses provides traceon and traceoff, which (like SVr4)  are  al‐
179           ways  available, and enable tracing to the “trace” file only when a
180           debug-library is built.
181
182           PDCurses has a short description of these functions,  with  a  note
183           that  they are not present in X/Open Curses, ncurses or NetBSD.  It
184           does not mention SVr4, but the functions'  inclusion  in  a  header
185           file section labeled “Quasi-standard” hints at the origin.
186
187       •   NetBSD  does  not  provide functions for enabling/disabling traces.
188           It  uses  environment   variables   CURSES_TRACE_MASK   and   CURS‐
189           ES_TRACE_FILE  to  determine  what is traced, and where the results
190           are written.  This is available only when a debug-library is built.
191
192           The NetBSD tracing feature is undocumented.
193
194       A few ncurses functions are not  provided  when  symbol  versioning  is
195       used:
196
197           _nc_tracebits, _tracedump, _tracemouse
198
199       The  original  trace routine was deprecated because it often conflicted
200       with application names.
201

SEE ALSO

203       curses(3X).
204
205
206
207                                                                curs_trace(3X)
Impressum