From: John Salem Date: Thu, 30 May 2019 01:59:27 +0000 (-0700) Subject: Add COMPlus_LTTng environment variable (#24733) X-Git-Tag: accepted/tizen/unified/20190813.215958~42^2~30 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cc1f8ab68e645cd46601b1df50ff644dfffc4dae;p=platform%2Fupstream%2Fcoreclr.git Add COMPlus_LTTng environment variable (#24733) * default value is 1, and when set to 0 will disable loading LTTng. Co-Authored-By: Jan Kotas --- diff --git a/src/inc/clrconfigvalues.h b/src/inc/clrconfigvalues.h index ab28104..c995e6e 100644 --- a/src/inc/clrconfigvalues.h +++ b/src/inc/clrconfigvalues.h @@ -248,6 +248,10 @@ CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_SuppressChecks, W("SuppressChecks"), "" CONFIG_DWORD_INFO(INTERNAL_SuppressLockViolationsOnReentryFromOS, W("SuppressLockViolationsOnReentryFromOS"), 0, "64 bit OOM tests re-enter the CLR via RtlVirtualUnwind. This indicates whether to suppress resulting locking violations.") #endif // WIN64EXCEPTIONS +/// +/// Diagnostics (unsuported general-purpose) +/// +RETAIL_CONFIG_DWORD_INFO(UNSUPORTED_LTTng, W("LTTng"), 1, "If COMPlus_LTTng is set to 0, this will prevent the LTTng library from being loaded at runtime") /// /// Exception Handling diff --git a/src/pal/src/misc/tracepointprovider.cpp b/src/pal/src/misc/tracepointprovider.cpp index 8d20266..6aa8fb5 100644 --- a/src/pal/src/misc/tracepointprovider.cpp +++ b/src/pal/src/misc/tracepointprovider.cpp @@ -59,6 +59,16 @@ __attribute__((constructor (200))) static void PAL_InitializeTracing(void) { + int fShouldLoad = 1; + // Check if loading the LTTng providers should be disabled. + // Note: this env var is formally declared in clrconfigvalues.h, but + // this code is executed too early to use the mechanics that come with that definition. + char *disableValue = getenv("COMPlus_LTTng"); + if (disableValue != NULL) + { + fShouldLoad = strtol(disableValue, NULL, 10); + } + // Get the path to the currently executing shared object (libcoreclr.so). Dl_info info; int succeeded = dladdr((void *)PAL_InitializeTracing, &info); @@ -99,11 +109,13 @@ PAL_InitializeTracing(void) return; } - - - // Load the tracepoint provider. - // It's OK if this fails - that just means that tracing dependencies aren't available. - dlopen(tpProvPath, RTLD_NOW | RTLD_GLOBAL); + + if (fShouldLoad) + { + // Load the tracepoint provider. + // It's OK if this fails - that just means that tracing dependencies aren't available. + dlopen(tpProvPath, RTLD_NOW | RTLD_GLOBAL); + } } #endif