Fix build without FEATURE_EVENT_TRACE (#32746)
authorAdeel Mujahid <adeelbm@outlook.com>
Tue, 25 Feb 2020 20:26:49 +0000 (22:26 +0200)
committerGitHub <noreply@github.com>
Tue, 25 Feb 2020 20:26:49 +0000 (21:26 +0100)
src/coreclr/clrdefinitions.cmake
src/coreclr/src/gc/env/etmdummy.h
src/coreclr/src/inc/eventtracebase.h
src/coreclr/src/scripts/genEventing.py
src/coreclr/src/vm/proftoeeinterfaceimpl.cpp

index 8f04b23..4747880 100644 (file)
@@ -117,6 +117,8 @@ add_definitions(-DFEATURE_DEFAULT_INTERFACES)
 if(FEATURE_EVENT_TRACE)
     add_compile_definitions($<$<NOT:$<BOOL:$<TARGET_PROPERTY:CROSSGEN_COMPONENT>>>:FEATURE_EVENT_TRACE>)
     add_definitions(-DFEATURE_PERFTRACING)
+else(FEATURE_EVENT_TRACE)
+    add_custom_target(eventing_headers) # add a dummy target to avoid checking for FEATURE_EVENT_TRACE in multiple places
 endif(FEATURE_EVENT_TRACE)
 if(FEATURE_GDBJIT)
     add_definitions(-DFEATURE_GDBJIT)
index db9e24e..9359568 100644 (file)
@@ -47,7 +47,7 @@
 #define FireEtwGCMarkHandles(HeapNum, ClrInstanceID) 0
 #define FireEtwGCMarkOlderGenerationRoots(HeapNum, ClrInstanceID) 0
 #define FireEtwFinalizeObject(TypeID, ObjectID, ClrInstanceID) 0
-#define FireEtwSetGCHandle(HandleID, ObjectID, Kind, Generation, ClrInstanceID) 0
+#define FireEtwSetGCHandle(HandleID, ObjectID, Kind, Generation, DomainAddr, ClrInstanceID) 0
 #define FireEtwDestroyGCHandle(HandleID, ClrInstanceID) 0
 #define FireEtwGCSampledObjectAllocationLow(Address, TypeID, ObjectCountForTypeSample, TotalSizeForTypeSample, ClrInstanceID) 0
 #define FireEtwPinObjectAtGCTime(HandleID, ObjectID, ObjectSize, TypeName, ClrInstanceID) 0
 #define FireEtwFailFast(FailFastUserMessage, FailedEIP, OSExitCode, ClrExitCode, ClrInstanceID) 0
 #define FireEtwPrvFinalizeObject(TypeID, ObjectID, ClrInstanceID, TypeName) 0
 #define FireEtwCCWRefCountChange(HandleID, ObjectID, COMInterfacePointer, NewRefCount, AppDomainID, ClassName, NameSpace, Operation, ClrInstanceID) 0
-#define FireEtwPrvSetGCHandle(HandleID, ObjectID, Kind, Generation, ClrInstanceID) 0
+#define FireEtwPrvSetGCHandle(HandleID, ObjectID, Kind, Generation, DomainAddr, ClrInstanceId) 0
 #define FireEtwPrvDestroyGCHandle(HandleID, ClrInstanceID) 0
 #define FireEtwFusionMessageEvent(ClrInstanceID, Prepend, Message) 0
 #define FireEtwFusionErrorCodeEvent(ClrInstanceID, Category, ErrorCode) 0
 #define FireEtwBeginCreateManagedReference(ClrInstanceID) 0
 #define FireEtwEndCreateManagedReference(ClrInstanceID) 0
 #define FireEtwObjectVariantMarshallingToManaged(TypeName, Int1, ClrInstanceID) 0
+#define FireEtwGCDynamicEvent(EventName, PayloadSize, Payload, ClrInstanceId) 0
+#define FireEtwBGC1stSweepEnd(GenNumber, ClrInstanceId) 0
+#define FireEtwResolutionAttempted(ClrInstanceId, asmName, stage, assemblyLoadContextName, result, resultAsmName, resultAsmPath, errMsg) 0
+#define FireEtwResolutionAttempted(ClrInstanceId, asmName, event, alcName, result, resultAsmName, resultAsmPath, errMsg) 0
+#define FireEtwKnownPathProbed(ClrInstanceId, path, source, hr) 0
+#define FireEtwContentionStop_V1(managedContention, ClrInstanceId, elapsedTimeInNanosecond) 0
+#define FireEtwAssemblyLoadContextResolvingHandlerInvoked(ClrInstanceId, assemblyName, handlerName, alcName, resultAssemblyName, resultAssemblyPath) 0
+#define FireEtwAppDomainAssemblyResolveHandlerInvoked(ClrInstanceId, assemblyName, handlerName, resultAssemblyName, resultAssemblyPath) 0
+#define FireEtwAssemblyLoadFromResolveHandlerInvoked(ClrInstanceId, assemblyName, isTrackedAssembly, requestingAssemblyPath, requestedAssemblyPath) 0
+#define FireEtwEventSource(eventID, eventName, eventSourceName, payload) 0
index 7460eca..2d5b305 100644 (file)
@@ -219,7 +219,7 @@ struct ProfilingScanContext;
 
 #else // FEATURE_EVENT_TRACE
 
-#include "etmdummy.h"
+#include "../gc/env/etmdummy.h"
 #endif // FEATURE_EVENT_TRACE
 
 #ifndef FEATURE_REDHAWK
@@ -245,7 +245,9 @@ extern UINT32 g_nClrInstanceId;
 #define TRACE_LEVEL_VERBOSE     5   // Detailed traces from intermediate steps
 
 #define DEF_LTTNG_KEYWORD_ENABLED 1
+#ifdef FEATURE_EVENT_TRACE
 #include "clrproviders.h"
+#endif
 #include "clrconfig.h"
 
 class XplatEventLoggerConfiguration
@@ -388,9 +390,10 @@ public:
         {
             ActivateAllKeywordsOfAllProviders();
         }
+#ifdef FEATURE_EVENT_TRACE
         else
         {
-            auto provider = GetProvider(providerName);
+            LTTNG_TRACE_CONTEXT *provider = GetProvider(providerName);
             if (provider == nullptr)
             {
                 return;
@@ -399,20 +402,23 @@ public:
             provider->Level = level;
             provider->IsEnabled = true;
         }
+#endif
     }
 
     static void ActivateAllKeywordsOfAllProviders()
     {
+#ifdef FEATURE_EVENT_TRACE
         for (LTTNG_TRACE_CONTEXT * const provider : ALL_LTTNG_PROVIDERS_CONTEXT)
         {
             provider->EnabledKeywordsBitmask = (ULONGLONG)(-1);
             provider->Level = TRACE_LEVEL_VERBOSE;
             provider->IsEnabled = true;
         }
+#endif
     }
 
 private:
-
+#ifdef FEATURE_EVENT_TRACE
     static LTTNG_TRACE_CONTEXT * const GetProvider(LPCWSTR providerName)
     {
         auto length = wcslen(providerName);
@@ -425,6 +431,7 @@ private:
         }
         return nullptr;
     }
+#endif
 };
 
 class XplatEventLogger
@@ -437,6 +444,7 @@ public:
         return configEventLogging.val(CLRConfig::EXTERNAL_EnableEventLog);
     }
 
+#ifdef FEATURE_EVENT_TRACE
     inline static bool IsProviderEnabled(DOTNET_TRACE_CONTEXT providerCtx)
     {
         return providerCtx.LttngProvider->IsEnabled;
@@ -458,7 +466,7 @@ public:
         }
         return false;
     }
-
+#endif
 
     /*
     This method is where COMPlus_LTTngConfig environment variable is parsed and is registered with the runtime provider
@@ -1204,6 +1212,10 @@ namespace ETW
 #else
                 static bool IsEnabled() { return false; }
                 static void SendSettings() {}
+                static void SendPause() {}
+                static void SendResume(UINT32 newMethodCount) {}
+                static void SendBackgroundJitStart(UINT32 pendingMethodCount) {}
+                static void SendBackgroundJitStop(UINT32 pendingMethodCount, UINT32 jittedMethodCount) {}
 #endif
 
                 DISABLE_CONSTRUCT_COPY(Runtime);
index e7626cc..50fde02 100644 (file)
@@ -635,12 +635,11 @@ typedef struct _DOTNET_TRACE_CONTEXT
         clrproviders = os.path.join(incDir, "clrproviders.h")
         with open_for_update(clrproviders) as Clrproviders:
             Clrproviders.write("""
-    typedef struct _EVENT_DESCRIPTOR
-    {
-        int const Level;
-        ULONGLONG const Keyword;
-    } EVENT_DESCRIPTOR;
-    """)
+typedef struct _EVENT_DESCRIPTOR
+{
+    int const Level;
+    ULONGLONG const Keyword;
+} EVENT_DESCRIPTOR;""")
 
             if not is_windows:
                 Clrproviders.write(eventpipe_trace_context_typedef)  # define EVENTPIPE_TRACE_CONTEXT
index 7d7e5a0..bae68ea 100644 (file)
@@ -7062,14 +7062,14 @@ HRESULT ProfToEEInterfaceImpl::EventPipeCreateProvider(const WCHAR *szName, EVEN
     EX_CATCH_HRESULT(hr);
 
     return hr;
-#elif // FEATURE_PERFTRACING
+#else // FEATURE_PERFTRACING
     return E_NOTIMPL;
 #endif // FEATURE_PERFTRACING
 }
 
 HRESULT ProfToEEInterfaceImpl::EventPipeDefineEvent(
     EVENTPIPE_PROVIDER provHandle,
-    const WCHAR *szName, 
+    const WCHAR *szName,
     UINT32 eventID,
     UINT64 keywords,
     UINT32 eventVersion,
@@ -7112,7 +7112,7 @@ HRESULT ProfToEEInterfaceImpl::EventPipeDefineEvent(
                       && sizeof(EventPipeParameterDesc) == sizeof(COR_PRF_EVENTPIPE_PARAM_DESC),
             "Layouts of EventPipeParameterDesc type and COR_PRF_EVENTPIPE_PARAM_DESC type do not match!");
         EventPipeParameterDesc *params = reinterpret_cast<EventPipeParameterDesc *>(pParamDescs);
-        
+
         size_t metadataLength;
         NewArrayHolder<BYTE> pMetadata = EventPipeMetadataGenerator::GenerateEventMetadata(
             eventID,
@@ -7139,7 +7139,7 @@ HRESULT ProfToEEInterfaceImpl::EventPipeDefineEvent(
     EX_CATCH_HRESULT(hr);
 
     return hr;
-#elif // FEATURE_PERFTRACING
+#else // FEATURE_PERFTRACING
     return E_NOTIMPL;
 #endif // FEATURE_PERFTRACING
 }
@@ -7174,14 +7174,14 @@ HRESULT ProfToEEInterfaceImpl::EventPipeWriteEvent(
 
     static_assert(offsetof(EventData, Ptr) == offsetof(COR_PRF_EVENT_DATA, ptr)
                     && offsetof(EventData, Size) == offsetof(COR_PRF_EVENT_DATA, size)
-                    && sizeof(EventData) == sizeof(COR_PRF_EVENT_DATA), 
+                    && sizeof(EventData) == sizeof(COR_PRF_EVENT_DATA),
         "Layouts of EventData type and COR_PRF_EVENT_DATA type do not match!");
 
     EventData *pEventData = reinterpret_cast<EventData *>(data);
     EventPipe::WriteEvent(*pEvent, pEventData, cData, pActivityId, pRelatedActivityId);
 
     return S_OK;
-#elif // FEATURE_PERFTRACING
+#else // FEATURE_PERFTRACING
     return E_NOTIMPL;
 #endif // FEATURE_PERFTRACING
 }