Hi,

The patch below allows to build a version of xterm with tracing (very
verbose debugging log) active. This is only useful to debug xterm, and
I've been carrying this local change for years now.
After all, every developer may want to be able to see how xterm is
processing its data.

To enable tracing, add -DOPT_TRACE=1 to CPPFLAGS Makefile. Avoid
installing this version, it will fill your disks.

The patch builds an additional file needed for tracing (VTparse.cin)
and disables visibleTekparse() if the Tektronics widget isn't built.

ok ?

Index: Makefile
===================================================================
RCS file: /cvs/OpenBSD/xenocara/app/xterm/Makefile,v
retrieving revision 1.32
diff -u -r1.32 Makefile
--- Makefile    18 Jun 2017 21:09:07 -0000      1.32
+++ Makefile    26 Feb 2019 20:53:28 -0000
@@ -37,6 +37,8 @@
 
 misc.o:        builtin_icons.h
 
+trace.o: VTparse.cin
+
 # do this to quiet gcc -Wcast-qual warnings 
 builtin_icons.h :
        @echo "#if OPT_BUILTIN_XPMS" >$@
@@ -57,7 +59,7 @@
 beforedepend: builtin_icons.h VTparse.hin
 BUILDFIRST = builtin_icons.h VTparse.hin
 
-.SUFFIXES: .man .1
+.SUFFIXES: .man .1 .def .cin .hin
 
 PATCH_NUM != sed -n '/XTERM_PATCH/s/[^0-9]*//gp' ${.CURDIR}/version.h
 PATCH_YMD != sed -n '/XTERM_DATE/s,[^0-9/.-]*,,gp' ${.CURDIR}/version.h
@@ -82,7 +84,7 @@
            -e s%/etc/wtmp%/var/run/wtmp%g \
             < $< > $@
 
-CLEANFILES+=   ${MAN} builtin_icons.h VTparse.hin
+CLEANFILES+=   ${MAN} builtin_icons.h VTparse.cin VTparse.hin
 
 afterinstall:
        ${INSTALL} ${INSTALL_COPY} -m ${SHAREMODE} \
@@ -93,6 +95,14 @@
                ${DESTDIR}${X11BASE}/share/X11/app-defaults/XTerm-color
 
 obj: _xenocara_obj
+
+AWK?= awk
+
+.def.cin:
+       $(AWK) '/^CASE_/{printf "{ %d, \"%s\" },\n", n++, $$1; }' < $< >$@
+
+.def.hin:
+       $(AWK) '/^CASE_/{printf "#define %s %d\n", $$1, n++}' < $< >$@
 
 .include <bsd.prog.mk>
 .include <bsd.xorg.mk>
Index: trace.c
===================================================================
RCS file: /cvs/OpenBSD/xenocara/app/xterm/trace.c,v
retrieving revision 1.29
diff -u -r1.29 trace.c
--- trace.c     24 Feb 2019 11:41:42 -0000      1.29
+++ trace.c     26 Feb 2019 20:53:31 -0000
@@ -492,6 +492,7 @@
     return result;
 }
 
+#if OPT_TEK4014
 const char *
 visibleTekparse(int code)
 {
@@ -511,6 +512,7 @@
     }
     return result;
 }
+#endif
 
 const char *
 visibleVTparse(int code)

-- 
Matthieu Herrb

Reply via email to