Split development option into separate things

This commit is contained in:
matt335672
2021-05-19 11:19:43 +01:00
parent fa1a6cfe5e
commit 52a52daddd
22 changed files with 61 additions and 88 deletions
-4
View File
@@ -29,10 +29,6 @@ AM_CPPFLAGS = \
-DXRDP_LOG_PATH=\"${localstatedir}/log\" \ -DXRDP_LOG_PATH=\"${localstatedir}/log\" \
-DXRDP_SOCKET_PATH=\"${socketdir}\" -DXRDP_SOCKET_PATH=\"${socketdir}\"
if XRDP_DEBUG
AM_CPPFLAGS += -DXRDP_DEBUG
endif
# -no-suppress is an automake-specific flag which is needed # -no-suppress is an automake-specific flag which is needed
# to prevent us missing compiler errors in some circumstances # to prevent us missing compiler errors in some circumstances
# (see https://github.com/neutrinolabs/xrdp/pull/1843 ) # (see https://github.com/neutrinolabs/xrdp/pull/1843 )
+14 -5
View File
@@ -25,6 +25,13 @@
#include "defines.h" #include "defines.h"
#include "list.h" #include "list.h"
/* Check the config_ac.h file is included so we know whether to enable the
* development macros
*/
#ifndef CONFIG_AC_H
# error config_ac.h not visible in log.h
#endif
/* logging buffer size */ /* logging buffer size */
#define LOG_BUFFER_SIZE 8192 #define LOG_BUFFER_SIZE 8192
#define LOGGER_NAME_SIZE 50 #define LOGGER_NAME_SIZE 50
@@ -66,7 +73,7 @@ enum logReturns
/* enable threading */ /* enable threading */
/*#define LOG_ENABLE_THREAD*/ /*#define LOG_ENABLE_THREAD*/
#ifdef XRDP_DEBUG #ifdef USE_DEVEL_LOGGING
#define LOG_PER_LOGGER_LEVEL #define LOG_PER_LOGGER_LEVEL
@@ -77,9 +84,10 @@ enum logReturns
* Note: all log levels are relavant to help a developer understand XRDP at * Note: all log levels are relavant to help a developer understand XRDP at
* different levels of granularity. * different levels of granularity.
* *
* Note: the logging function calls are removed when XRDP_DEBUG is NOT defined. * Note: the logging function calls are removed when USE_DEVEL_LOGGING is
* NOT defined.
* *
* Note: when the build is configured with --enable-xrdpdebug, then * Note: when the build is configured with --enable-devel-logging, then
* the log level can be configured per the source file name or method name * the log level can be configured per the source file name or method name
* (with the suffix "()") in the [LoggingPerLogger] * (with the suffix "()") in the [LoggingPerLogger]
* section of the configuration file. * section of the configuration file.
@@ -103,7 +111,7 @@ enum logReturns
* configure and run XRDP on their machine. * configure and run XRDP on their machine.
* *
* Note: the logging function calls contain additional code location info when * Note: the logging function calls contain additional code location info when
* XRDP_DEBUG is defined. * USE_DEVEL_LOGGING is defined.
* *
* @param lvl, the log level * @param lvl, the log level
* @param msg, the log text as a printf format c-string * @param msg, the log text as a printf format c-string
@@ -116,7 +124,8 @@ enum logReturns
* @brief Logging macro for logging the contents of a byte array using a hex * @brief Logging macro for logging the contents of a byte array using a hex
* dump format. * dump format.
* *
* Note: the logging function calls are removed when XRDP_DEBUG is NOT defined. * Note: the logging function calls are removed when USE_DEVEL_LOGGING is
* NOT defined.
* *
* @param log_level, the log level * @param log_level, the log level
* @param message, a message prefix for the hex dump. Note: no printf like * @param message, a message prefix for the hex dump. Note: no printf like
+1 -1
View File
@@ -89,7 +89,7 @@
#define PREFIX(x) pixman_region##x #define PREFIX(x) pixman_region##x
#endif #endif
#ifdef XRDP_DEBUG #ifdef USE_DEVEL_LOGGING
pixman_bool_t PREFIX(_selfcheck) (region_type_t *reg); pixman_bool_t PREFIX(_selfcheck) (region_type_t *reg);
+23 -6
View File
@@ -98,10 +98,19 @@ AC_ARG_ENABLE(pam-config, AS_HELP_STRING([--enable-pam-config=CONF],
[Select PAM config to install: arch, debian, redhat, suse, freebsd, macos, unix [Select PAM config to install: arch, debian, redhat, suse, freebsd, macos, unix
(default: autodetect)])) (default: autodetect)]))
AC_ARG_ENABLE(xrdpdebug, AS_HELP_STRING([--enable-xrdpdebug], # Development options. devel_all is first as this provides a default for
[Build debug (default: no)]), # the others
[], [enable_xrdpdebug=no]) AC_ARG_ENABLE(devel_all, AS_HELP_STRING([--enable-devel-all],
AM_CONDITIONAL(XRDP_DEBUG, [test x$enable_xrdpdebug = xyes]) [Enable all development options (default: no)]),
[devel_all=$enableval], [devel_all=no])
AC_ARG_ENABLE(devel_debug, AS_HELP_STRING([--enable-devel-debug],
[Build exes with no optimisation and debugging symbols (default: no)]),
[devel_debug=$enableval], [devel_debug=$devel_all])
AM_CONDITIONAL(DEVEL_DEBUG, [test x$devel_debug = xyes ])
AC_ARG_ENABLE(devel_logging, AS_HELP_STRING([--enable-devel-logging],
[Enable development logging (default: no)]),
[devel_logging=$enableval], [devel_logging=$devel_all])
AC_ARG_ENABLE(neutrinordp, AS_HELP_STRING([--enable-neutrinordp], AC_ARG_ENABLE(neutrinordp, AS_HELP_STRING([--enable-neutrinordp],
[Build neutrinordp module (default: no)]), [Build neutrinordp module (default: no)]),
[], [enable_neutrinordp=no]) [], [enable_neutrinordp=no])
@@ -163,7 +172,7 @@ AX_APPEND_COMPILE_FLAGS([-Wwrite-strings])
AM_COND_IF([LINUX], AM_COND_IF([LINUX],
[AX_APPEND_COMPILE_FLAGS([-Werror])]) # bsd has warnings that have not been fixed yet [AX_APPEND_COMPILE_FLAGS([-Werror])]) # bsd has warnings that have not been fixed yet
AM_COND_IF([XRDP_DEBUG], AM_COND_IF([DEVEL_DEBUG],
[AX_APPEND_COMPILE_FLAGS([-g -O0])], [AX_APPEND_COMPILE_FLAGS([-g -O0])],
[AX_APPEND_COMPILE_FLAGS([-O2])]) [AX_APPEND_COMPILE_FLAGS([-O2])])
@@ -247,6 +256,13 @@ fi
AC_SUBST(PAM_RULES) AC_SUBST(PAM_RULES)
# Add define for development options to config_ac.h
AC_DEFINE([CONFIG_AC_H],1, [Allow sources to check config_ac.h is included])
if test x$devel_logging = xyes
then
AC_DEFINE([USE_DEVEL_LOGGING],1,[Enable development logging])
fi
if test "x$enable_vsock" = "xyes" if test "x$enable_vsock" = "xyes"
then then
enable_vsock=yes enable_vsock=yes
@@ -451,8 +467,9 @@ echo " ipv6 $enable_ipv6"
echo " ipv6only $enable_ipv6only" echo " ipv6only $enable_ipv6only"
echo " vsock $enable_vsock" echo " vsock $enable_vsock"
echo " auth mechanism $auth_mech" echo " auth mechanism $auth_mech"
echo " debug $enable_xrdpdebug"
echo " rdpsndaudin $enable_rdpsndaudin" echo " rdpsndaudin $enable_rdpsndaudin"
echo
echo " development logging $devel_logging"
echo "" echo ""
echo " strict_locations $enable_strict_locations" echo " strict_locations $enable_strict_locations"
echo " prefix $prefix" echo " prefix $prefix"
-4
View File
@@ -14,10 +14,6 @@ AM_LDFLAGS =
LIBXRDP_EXTRA_LIBS = LIBXRDP_EXTRA_LIBS =
if XRDP_DEBUG
AM_CPPFLAGS += -DXRDP_DEBUG
endif
if XRDP_NEUTRINORDP if XRDP_NEUTRINORDP
AM_CPPFLAGS += -DXRDP_NEUTRINORDP AM_CPPFLAGS += -DXRDP_NEUTRINORDP
LIBXRDP_EXTRA_LIBS += $(FREERDP_LIBS) LIBXRDP_EXTRA_LIBS += $(FREERDP_LIBS)
+1 -1
View File
@@ -626,7 +626,7 @@ static int
xrdp_caps_process_surface_cmds(struct xrdp_rdp *self, struct stream *s, int len) xrdp_caps_process_surface_cmds(struct xrdp_rdp *self, struct stream *s, int len)
{ {
int cmdFlags; int cmdFlags;
#ifndef XRDP_DEBUG #ifndef USE_DEVEL_LOGGING
/* TODO: remove UNUSED_VAR once the `cmdFlags` variable is used for more than /* TODO: remove UNUSED_VAR once the `cmdFlags` variable is used for more than
logging in debug mode */ logging in debug mode */
UNUSED_VAR(cmdFlags); UNUSED_VAR(cmdFlags);
+1 -1
View File
@@ -1406,7 +1406,7 @@ xrdp_sec_recv_fastpath(struct xrdp_sec *self, struct stream *s)
int len; int len;
int pad; int pad;
#ifndef XRDP_DEBUG #ifndef USE_DEVEL_LOGGING
/* TODO: remove UNUSED_VAR once the `ver` variable is used for more than /* TODO: remove UNUSED_VAR once the `ver` variable is used for more than
logging in debug mode */ logging in debug mode */
UNUSED_VAR(ver); UNUSED_VAR(ver);
-4
View File
@@ -5,10 +5,6 @@ AM_CPPFLAGS = \
-DXRDP_PID_PATH=\"${localstatedir}/run\" \ -DXRDP_PID_PATH=\"${localstatedir}/run\" \
-I$(top_srcdir)/common -I$(top_srcdir)/common
if XRDP_DEBUG
AM_CPPFLAGS += -DXRDP_DEBUG
endif
module_LTLIBRARIES = \ module_LTLIBRARIES = \
libmc.la libmc.la
-4
View File
@@ -6,10 +6,6 @@ AM_CPPFLAGS = \
-I$(top_srcdir)/common \ -I$(top_srcdir)/common \
$(FREERDP_CFLAGS) $(FREERDP_CFLAGS)
if XRDP_DEBUG
AM_CPPFLAGS += -DXRDP_DEBUG
endif
module_LTLIBRARIES = \ module_LTLIBRARIES = \
libxrdpneutrinordp.la libxrdpneutrinordp.la
-4
View File
@@ -11,10 +11,6 @@ AM_CPPFLAGS = \
-I$(top_srcdir)/common \ -I$(top_srcdir)/common \
-I$(top_srcdir)/sesman/libscp -I$(top_srcdir)/sesman/libscp
if XRDP_DEBUG
AM_CPPFLAGS += -DXRDP_DEBUG
endif
if SESMAN_BSD if SESMAN_BSD
AUTH_C = verify_user_bsd.c AUTH_C = verify_user_bsd.c
AUTH_LIB = AUTH_LIB =
-4
View File
@@ -11,10 +11,6 @@ AM_CPPFLAGS = \
-DXRDP_SOCKET_PATH=\"${socketdir}\" \ -DXRDP_SOCKET_PATH=\"${socketdir}\" \
-I$(top_srcdir)/common -I$(top_srcdir)/common
if XRDP_DEBUG
AM_CPPFLAGS += -DXRDP_DEBUG
endif
CHANSRV_EXTRA_LIBS = CHANSRV_EXTRA_LIBS =
if XRDP_FUSE if XRDP_FUSE
-4
View File
@@ -5,10 +5,6 @@ AM_CPPFLAGS = \
-DXRDP_PID_PATH=\"${localstatedir}/run\" \ -DXRDP_PID_PATH=\"${localstatedir}/run\" \
-I$(top_srcdir)/common -I$(top_srcdir)/common
if XRDP_DEBUG
AM_CPPFLAGS += -DXRDP_DEBUG
endif
module_LTLIBRARIES = \ module_LTLIBRARIES = \
libscp.la libscp.la
+4 -2
View File
@@ -74,7 +74,8 @@ EnableSyslog=true
#EnableProcessId=false #EnableProcessId=false
[LoggingPerLogger] [LoggingPerLogger]
; Note: per logger configuration is only used in XRDP_DEBUG builds of XRDP. ; Note: per logger configuration is only used if xrdp is built with
; --enable-devel-logging
#sesman.c=INFO #sesman.c=INFO
#main()=INFO #main()=INFO
@@ -139,7 +140,8 @@ EnableSyslog=true
#EnableProcessId=false #EnableProcessId=false
[ChansrvLoggingPerLogger] [ChansrvLoggingPerLogger]
; Note: per logger configuration is only used in XRDP_DEBUG builds of XRDP. ; Note: per logger configuration is only used if xrdp is built with
; --enable-devel-logging
#chansrv.c=INFO #chansrv.c=INFO
#main()=INFO #main()=INFO
-4
View File
@@ -8,10 +8,6 @@ AM_CPPFLAGS = \
-I$(top_srcdir)/sesman/libscp \ -I$(top_srcdir)/sesman/libscp \
-I$(top_srcdir)/sesman -I$(top_srcdir)/sesman
if XRDP_DEBUG
AM_CPPFLAGS += -DXRDP_DEBUG
endif
AM_CFLAGS = $(X_CFLAGS) AM_CFLAGS = $(X_CFLAGS)
bin_PROGRAMS = \ bin_PROGRAMS = \
-4
View File
@@ -3,10 +3,6 @@ AM_CPPFLAGS = \
-I$(top_builddir) \ -I$(top_builddir) \
-I$(top_srcdir)/common -I$(top_srcdir)/common
if XRDP_DEBUG
AM_CPPFLAGS += -DXRDP_DEBUG
endif
LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) \ LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) \
$(top_srcdir)/tap-driver.sh $(top_srcdir)/tap-driver.sh
-4
View File
@@ -2,10 +2,6 @@
AM_CPPFLAGS = \ AM_CPPFLAGS = \
-I$(top_srcdir)/common -I$(top_srcdir)/common
if XRDP_DEBUG
AM_CPPFLAGS += -DXRDP_DEBUG
endif
check_PROGRAMS = \ check_PROGRAMS = \
memtest memtest
-4
View File
@@ -2,10 +2,6 @@
AM_CPPFLAGS = \ AM_CPPFLAGS = \
-I$(top_srcdir)/common -I$(top_srcdir)/common
if XRDP_DEBUG
AM_CPPFLAGS += -DXRDP_DEBUG
endif
noinst_PROGRAMS = \ noinst_PROGRAMS = \
tcp_proxy tcp_proxy
-4
View File
@@ -5,10 +5,6 @@ AM_CPPFLAGS = \
-DXRDP_PID_PATH=\"${localstatedir}/run\" \ -DXRDP_PID_PATH=\"${localstatedir}/run\" \
-I$(top_srcdir)/common -I$(top_srcdir)/common
if XRDP_DEBUG
AM_CPPFLAGS += -DXRDP_DEBUG
endif
module_LTLIBRARIES = \ module_LTLIBRARIES = \
libvnc.la libvnc.la
-4
View File
@@ -16,10 +16,6 @@ AM_CPPFLAGS = \
XRDP_EXTRA_LIBS = XRDP_EXTRA_LIBS =
if XRDP_DEBUG
AM_CPPFLAGS += -DXRDP_DEBUG
endif
if XRDP_RFXCODEC if XRDP_RFXCODEC
AM_CPPFLAGS += -DXRDP_RFXCODEC AM_CPPFLAGS += -DXRDP_RFXCODEC
AM_CPPFLAGS += -I$(top_srcdir)/librfxcodec/include AM_CPPFLAGS += -I$(top_srcdir)/librfxcodec/include
+1 -1
View File
@@ -454,7 +454,7 @@ main(int argc, char **argv)
const char *pid_file = XRDP_PID_PATH "/xrdp.pid"; const char *pid_file = XRDP_PID_PATH "/xrdp.pid";
int errored_argc; int errored_argc;
#ifdef XRDP_DEBUG #ifdef USE_DEVEL_LOGGING
int test; int test;
for (test = 0; test < argc; test++) for (test = 0; test < argc; test++)
{ {
+2 -1
View File
@@ -166,7 +166,8 @@ EnableSyslog=true
#EnableProcessId=false #EnableProcessId=false
[LoggingPerLogger] [LoggingPerLogger]
; Note: per logger configuration is only used in XRDP_DEBUG builds of XRDP. ; Note: per logger configuration is only used if xrdp is built with
; --enable-devel-logging
#xrdp.c=INFO #xrdp.c=INFO
#main()=INFO #main()=INFO
-4
View File
@@ -5,10 +5,6 @@ AM_CPPFLAGS = \
-DXRDP_PID_PATH=\"${localstatedir}/run\" \ -DXRDP_PID_PATH=\"${localstatedir}/run\" \
-I$(top_srcdir)/common -I$(top_srcdir)/common
if XRDP_DEBUG
AM_CPPFLAGS += -DXRDP_DEBUG
endif
module_LTLIBRARIES = \ module_LTLIBRARIES = \
libxup.la libxup.la