diff --git a/src/core/ddsc/src/dds_rhc.c b/src/core/ddsc/src/dds_rhc.c index 81b3f0c..dd73cbe 100644 --- a/src/core/ddsc/src/dds_rhc.c +++ b/src/core/ddsc/src/dds_rhc.c @@ -2625,6 +2625,9 @@ int dds_rhc_takecdr #define CHECK_MAX_CONDS 64 static int rhc_check_counts_locked (struct rhc *rhc, bool check_conds, bool check_qcmask) { + if (!(config.enabled_xchecks & DDS_XCHECK_RHC)) + return 1; + const uint32_t ncheck = rhc->nconds < CHECK_MAX_CONDS ? rhc->nconds : CHECK_MAX_CONDS; unsigned n_instances = 0, n_nonempty_instances = 0; unsigned n_not_alive_disposed = 0, n_not_alive_no_writers = 0, n_new = 0; diff --git a/src/core/ddsc/src/dds_whc.c b/src/core/ddsc/src/dds_whc.c index 4e1333b..e715a2d 100644 --- a/src/core/ddsc/src/dds_whc.c +++ b/src/core/ddsc/src/dds_whc.c @@ -258,6 +258,7 @@ static void check_whc (const struct whc_impl *whc) assert (whc->maxseq_node == whc_findmax_procedurally (whc)); #if !defined(NDEBUG) + if (config.enabled_xchecks & DDS_XCHECK_WHC) { struct whc_intvnode *firstintv; struct whc_node *cur; diff --git a/src/core/ddsi/include/dds/ddsi/q_config.h b/src/core/ddsi/include/dds/ddsi/q_config.h index c771810..c37a40e 100644 --- a/src/core/ddsi/include/dds/ddsi/q_config.h +++ b/src/core/ddsi/include/dds/ddsi/q_config.h @@ -218,10 +218,15 @@ struct ssl_min_version { }; #endif +/* Expensive checks (compiled in when NDEBUG not defined, enabled only if flag set in xchecks) */ +#define DDS_XCHECK_WHC 1u +#define DDS_XCHECK_RHC 2u + struct config { int valid; uint32_t enabled_logcats; + uint32_t enabled_xchecks; char *servicename; char *pcap_file; diff --git a/src/core/ddsi/src/q_config.c b/src/core/ddsi/src/q_config.c index a0663d6..2def582 100644 --- a/src/core/ddsi/src/q_config.c +++ b/src/core/ddsi/src/q_config.c @@ -105,6 +105,14 @@ static const uint32_t logcat_codes[] = { DDS_LC_FATAL, DDS_LC_ERROR, DDS_LC_WARNING, DDS_LC_INFO, DDS_LC_CONFIG, DDS_LC_DISCOVERY, DDS_LC_DATA, DDS_LC_RADMIN, DDS_LC_TIMING, DDS_LC_TRAFFIC, DDS_LC_TOPIC, DDS_LC_TCP, DDS_LC_PLIST, DDS_LC_WHC, DDS_LC_THROTTLE, DDS_LC_RHC, DDS_LC_ALL }; +/* "trace" is special: it enables (nearly) everything */ +static const char *xcheck_names[] = { + "whc", "rhc", "all", NULL +}; +static const uint32_t xcheck_codes[] = { + DDS_XCHECK_WHC, DDS_XCHECK_RHC, ~(uint32_t)0 +}; + /* We want the tracing/verbosity settings to be fixed while parsing the configuration, so we update this variable instead. */ static unsigned enabled_logcats; @@ -131,6 +139,7 @@ DUPF(string); DU(tracingOutputFileName); DU(verbosity); DUPF(logcat); +DUPF(xcheck); DUPF(float); DUPF(int); DUPF(uint); @@ -632,6 +641,12 @@ static const struct cfgelem unsupp_cfgelems[] = { "

Testing options.

" }, { GROUP("Watermarks", unsupp_watermarks_cfgelems), "

Watermarks for flow-control.

" }, +{ LEAF("EnableExpensiveChecks"), 1, "", ABSOFF(enabled_xchecks), 0, uf_xcheck, 0, pf_xcheck, + "

This element enables expensive checks in builds with assertions enabled and is ignored otherwise. Recognised categories are:

\n\ +