From 7a8e08cac71924a301d96dbac6dcb283677e93b1 Mon Sep 17 00:00:00 2001 From: Sung Yoon Whang Date: Mon, 21 Oct 2019 16:04:28 -0700 Subject: [PATCH] Fix LTTng build for build environments with older liblttng-ust-dev (#27273) (#27294) * Fix macro redefinition to use XplatEventLogger instead of simply writing FALSE * Fix linker error * undo newline changes * Some changes to comment * Move wrapper export from eventpipe.cpp to eventtrace.cpp --- src/scripts/genLttngProvider.py | 5 ++++- src/vm/eventtrace.cpp | 8 ++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/scripts/genLttngProvider.py b/src/scripts/genLttngProvider.py index 38fca2d09bb1..393ca3f4c022 100644 --- a/src/scripts/genLttngProvider.py +++ b/src/scripts/genLttngProvider.py @@ -546,7 +546,10 @@ def generateLttngFiles(etwmanifest,eventprovider_directory, dryRun): lttngimpl_file.write("#include \"" + lttngevntheadershortname + "\"\n\n") lttngimpl_file.write("""#ifndef tracepoint_enabled -#define tracepoint_enabled(provider, name) FALSE + +extern "C" bool XplatEventLoggerIsEnabled(); + +#define tracepoint_enabled(provider, name) XplatEventLoggerIsEnabled() #define do_tracepoint tracepoint #endif diff --git a/src/vm/eventtrace.cpp b/src/vm/eventtrace.cpp index f5f6389d89a1..ec0940074578 100644 --- a/src/vm/eventtrace.cpp +++ b/src/vm/eventtrace.cpp @@ -7543,3 +7543,11 @@ bool EventPipeHelper::IsEnabled(DOTNET_TRACE_CONTEXT Context, UCHAR Level, ULONG return false; } #endif // FEATURE_PERFTRACING + +#if defined(FEATURE_PAL) && defined(FEATURE_PERFTRACING) +// This is a wrapper method for LTTng. See https://github.com/dotnet/coreclr/pull/27273 for details. +extern "C" bool XplatEventLoggerIsEnabled() +{ + return XplatEventLogger::IsEventLoggingEnabled(); +} +#endif // FEATURE_PAL && FEATURE_PERFTRACING