Re: curses_trace() - version 6.6
Thomas Dickey <[email protected]>
| Newsgroups | gmane.comp.lib.ncurses.bugs |
|---|---|
| Message-ID | <[email protected]> |
On Wed, Aug 05, 2026 at 07:41:24PM +0200, Björn Försterling wrote:
> Hello,
>
> the man page "curs_trace" says:
> > The curses_trace function is always available [...]
>
> But you have to configure ncurses with "--with-trace" so that
> `curses_trace()` actually outputs to a "trace" file, which is not clear
> from the man page.
The man page does say that:
DESCRIPTION
The curses trace routines are used for debugging the ncurses libraries,
as well as applications which use the ncurses libraries. Some limita‐
tions apply:
• Aside from curses_trace, the other functions are normally available
only with the debugging library e.g., libncurses_g.a.
All of the trace functions may be compiled into any model (shared,
static, profile) by defining the symbol TRACE.
• Additionally, the functions which use cchar_t are only available
with the wide-character configuration of the libraries.
...and "normally available" should tell you that it's probably not available
for your configuration unless you did something such as recompile.
I did this to allow developers to substitute a debugging version, e.g., using
LD_LIBRARY_PATH (which works well enough except for MacOS...). If the
entrypoint were only available when it's fully functional, that wouldn't
be useful for this case.
Your application can check the return value to see if it was available:
The curses_trace function is always available, whether or not the other
trace functions are available:
• If tracing is available, calling curses_trace with a nonzero para‐
meter updates the trace mask, and returns the previous trace mask.
When the trace mask is nonzero, ncurses creates the file “trace” in
the current directory for output. If the file already exists, no
tracing is done.
• If tracing is not available, curses_trace returns zero (0).
> And `curses_trace(TRACE_MAXIMUM)` seems to return 0 even when tracing is
> available and writing to a file called "trace" works.
> Probably because the previous bitmask was 0.
yes :-)
> But how do you check if tracing is available?
call the function twice:
curses_trace(TRACE_MAXIMUM);
rc = trace(TRACE_NORMAL);
curs_set and umask do something like that with return-codes.
--
Thomas E. Dickey <[email protected]>
https://invisible-island.net
signature.asc
(application/pgp-signature, 659 B)
-----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEEGYgtkt2kxADCLA1WzCr0RyFnvgMFAmpzilYACgkQzCr0RyFn vgP6KAv/SekkS/omURRYxiWxNbGvOgkUxJyneeH27uRDA9gXDOEFiyavbUaokjJ6 W74uW0WdryaXtjNeux8yrlvM6xSeB+obgtbIqms+yDCsKDlZu4VTi/aS2FIEnaAT m/gkO276DN9TJRxQ/FKu9pWYEai2TsN596cX67rgoEUx2Ru65fPS5uXeAdTX/BXO GWZVp8VYHWmSpoqtS9IW/HTfWjgQPsXhaM9azBrtwzFeAvICQMuok/x1CqaomR0T xtj7yYu0S9RbzQU56MmByXRT+6ah2qDouw93A5hLFlQ3vt/ooiDl2gMVU4wU5YhR SpOBt+FQoladePCkI95XT4teiRxjGD2Z//LTkqZ4HBbt6dWvZIdI2zrG8dnlmeQd +1FvjsM6STNKTkXhdbYrC1hwJX7YCjSLimu1vdtgFXIM+54XECfYfcJ1xtmA+sD0 /+quJflN3sn8uSAAv3c6SRub8Q8LZAcSYU88my0w8UIHbu3SgzcLls8IyXrBlPtI 1bnozaJq =Jexy -----END PGP SIGNATURE-----