Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/gc/env/etmdummy.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@
#define FireEtwDebugIPCEventEnd() 0
#define FireEtwDebugExceptionProcessingStart() 0
#define FireEtwDebugExceptionProcessingEnd() 0
#define FireEtwCodeSymbols(ModuleId, TotalChunks, ChunkNumber, ChunkLength, Chunk, ClrInstanceID) 0
#define FireEtwCLRStackWalkDCStart(ClrInstanceID, Reserved1, Reserved2, FrameCount, Stack) 0
#define FireEtwMethodDCStart(MethodID, ModuleID, MethodStartAddress, MethodSize, MethodToken, MethodFlags) 0
#define FireEtwMethodDCStart_V1(MethodID, ModuleID, MethodStartAddress, MethodSize, MethodToken, MethodFlags, ClrInstanceID) 0
Expand Down
16 changes: 16 additions & 0 deletions src/inc/eventtracebase.h
Original file line number Diff line number Diff line change
Expand Up @@ -730,6 +730,22 @@ namespace ETW
static VOID RuntimeInformation(INT32 type);
#else
static VOID RuntimeInformation(INT32 type) {};
#endif // FEATURE_EVENT_TRACE
};

class CodeSymbolLog
{
public:
#ifdef FEATURE_EVENT_TRACE
static VOID EmitCodeSymbols(Module* pModule);
static HRESULT GetInMemorySymbolsLength(Module* pModule, DWORD* pCountSymbolBytes);
static HRESULT ReadInMemorySymbols(Module* pmodule, DWORD symbolsReadOffset, BYTE* pSymbolBytes,
DWORD countSymbolBytes, DWORD* pCountSymbolBytesRead);
#else
static VOID EmitCodeSymbols(Module* pModule) {}
static HRESULT GetInMemorySymbolsLength(Module* pModule, DWORD* pCountSymbolBytes) { return S_OK; }
static HRESULT ReadInMemorySymbols(Module* pmodule, DWORD symbolsReadOffset, BYTE* pSymbolBytes,
DWORD countSymbolBytes, DWORD* pCountSymbolBytesRead) { return S_OK; }
#endif // FEATURE_EVENT_TRACE
};
};
Expand Down
78 changes: 74 additions & 4 deletions src/pal/prebuilt/inc/clretwall.h
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ Routine Description:
#endif
#endif // MCGEN_DISABLE_PROVIDER_CODE_GENERATION
//+
// Provider Microsoft-Windows-DotNETRuntime Event Count 166
// Provider Microsoft-Windows-DotNETRuntime Event Count 167
//+
EXTERN_C __declspec(selectany) const GUID MICROSOFT_WINDOWS_DOTNETRUNTIME_PROVIDER = {0xe13c0d23, 0xccbc, 0x4e12, {0x93, 0x1b, 0xd9, 0xcc, 0x2e, 0xee, 0x27, 0xe4}};

Expand Down Expand Up @@ -371,6 +371,8 @@ EXTERN_C __declspec(selectany) const GUID ThreadId = {0x641994c5, 0x16f2, 0x4123
EXTERN_C __declspec(selectany) const GUID DebugIPCEventId = {0xec2f3703, 0x8321, 0x4301, {0xbd, 0x51, 0x2c, 0xb9, 0xa0, 0x9f, 0x31, 0xb1}};
#define CLR_EXCEPTION_PROCESSING_TASK 0x1a
EXTERN_C __declspec(selectany) const GUID DebugExceptionProcessingId = {0xc4412198, 0xef03, 0x47f1, {0x9b, 0xd1, 0x11, 0xc6, 0x63, 0x7a, 0x20, 0x62}};
#define CLR_CODE_SYMBOLS_TASK 0x1e
EXTERN_C __declspec(selectany) const GUID CodeSymbolsId = {0x53aedf69, 0x2049, 0x4f7d, {0x93, 0x45, 0xd3, 0x01, 0x8b, 0x5c, 0x4d, 0x80}};
//
// Keyword
//
Expand Down Expand Up @@ -403,6 +405,7 @@ EXTERN_C __declspec(selectany) const GUID DebugExceptionProcessingId = {0xc44121
#define CLR_THREADTRANSFER_KEYWORD 0x80000000
#define CLR_DEBUGGER_KEYWORD 0x100000000
#define CLR_MONITORING_KEYWORD 0x200000000
#define CLR_CODESYMBOLS_KEYWORD 0x400000000

//
// Event Descriptors
Expand Down Expand Up @@ -739,6 +742,8 @@ EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR DebugExceptionProcessingSt
#define DebugExceptionProcessingStart_value 0xf2
EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR DebugExceptionProcessingEnd = {0xf3, 0x0, 0x0, 0x4, 0x2, 0x1a, 0x100000000};
#define DebugExceptionProcessingEnd_value 0xf3
EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR CodeSymbols = {0x104, 0x0, 0x0, 0x5, 0x1, 0x1e, 0x400000000};
#define CodeSymbols_value 0x104

//
// Note on Generate Code from Manifest Windows Vista and above
Expand Down Expand Up @@ -768,9 +773,9 @@ EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR DebugExceptionProcessingEn
//

EXTERN_C __declspec(selectany) DECLSPEC_CACHEALIGN ULONG Microsoft_Windows_DotNETRuntimeEnableBits[1];
EXTERN_C __declspec(selectany) const ULONGLONG Microsoft_Windows_DotNETRuntimeKeywords[31] = {0x1, 0x1, 0x10001, 0x80000, 0x100000, 0x200000, 0x400000, 0x2, 0x2000000, 0x10000, 0x10000, 0x80010000, 0x80010000, 0x0, 0x200008000, 0x8000, 0x4000, 0x40000000, 0x800, 0x10800, 0x2000, 0x30, 0x10, 0x1000, 0x20000, 0x8, 0x20000008, 0x20000000, 0x400, 0x400, 0x100000000};
EXTERN_C __declspec(selectany) const UCHAR Microsoft_Windows_DotNETRuntimeLevels[31] = {4, 5, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 4, 4, 2, 4, 4, 0, 4, 4, 4, 4, 5, 5, 5, 4, 4, 4, 5, 4, 4};
EXTERN_C __declspec(selectany) MCGEN_TRACE_CONTEXT MICROSOFT_WINDOWS_DOTNETRUNTIME_PROVIDER_Context = {0, 0, 0, 0, 0, 0, 0, 0, 31, Microsoft_Windows_DotNETRuntimeEnableBits, Microsoft_Windows_DotNETRuntimeKeywords, Microsoft_Windows_DotNETRuntimeLevels};
EXTERN_C __declspec(selectany) const ULONGLONG Microsoft_Windows_DotNETRuntimeKeywords[32] = {0x1, 0x1, 0x10001, 0x80000, 0x100000, 0x200000, 0x400000, 0x2, 0x2000000, 0x10000, 0x10000, 0x80010000, 0x80010000, 0x0, 0x200008000, 0x8000, 0x4000, 0x40000000, 0x800, 0x10800, 0x2000, 0x30, 0x10, 0x1000, 0x20000, 0x8, 0x20000008, 0x20000000, 0x400, 0x400, 0x100000000, 0x400000000};
EXTERN_C __declspec(selectany) const UCHAR Microsoft_Windows_DotNETRuntimeLevels[32] = {4, 5, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 4, 4, 2, 4, 4, 0, 4, 4, 4, 4, 5, 5, 5, 4, 4, 4, 5, 4, 4, 5};
EXTERN_C __declspec(selectany) MCGEN_TRACE_CONTEXT MICROSOFT_WINDOWS_DOTNETRUNTIME_PROVIDER_Context = {0, 0, 0, 0, 0, 0, 0, 0, 32, Microsoft_Windows_DotNETRuntimeEnableBits, Microsoft_Windows_DotNETRuntimeKeywords, Microsoft_Windows_DotNETRuntimeLevels};

EXTERN_C __declspec(selectany) REGHANDLE Microsoft_Windows_DotNETRuntimeHandle = (REGHANDLE)0;

Expand Down Expand Up @@ -3191,6 +3196,20 @@ Routine Description:
CoTemplateEventDescriptor(Microsoft_Windows_DotNETRuntimeHandle, &DebugExceptionProcessingEnd)\
: ERROR_SUCCESS\

//
// Enablement check macro for CodeSymbols
//

#define EventEnabledCodeSymbols() ((Microsoft_Windows_DotNETRuntimeEnableBits[0] & 0x80000000) != 0)

//
// Event Macro for CodeSymbols
//
#define FireEtwCodeSymbols(ModuleId, TotalChunks, ChunkNumber, ChunkLength, Chunk, ClrInstanceID)\
EventEnabledCodeSymbols() ?\
CoTemplate_xhhqbh(Microsoft_Windows_DotNETRuntimeHandle, &CodeSymbols, ModuleId, TotalChunks, ChunkNumber, ChunkLength, Chunk, ClrInstanceID)\
: ERROR_SUCCESS\

#endif // MCGEN_DISABLE_PROVIDER_CODE_GENERATION

//+
Expand Down Expand Up @@ -10909,6 +10928,54 @@ MCGEN_CALLOUT(RegHandle,
}
#endif

//
//Template from manifest : CodeSymbols
//
#ifndef CoTemplate_xhhqbh_def
#define CoTemplate_xhhqbh_def
ETW_INLINE
ULONG
CoTemplate_xhhqbh(
_In_ REGHANDLE RegHandle,
_In_ PCEVENT_DESCRIPTOR Descriptor,
_In_ unsigned __int64 _Arg0,
_In_ const unsigned short _Arg1,
_In_ const unsigned short _Arg2,
_In_ const unsigned int _Arg3,
_In_reads_(_Arg3) const BYTE* _Arg4,
_In_ const unsigned short _Arg5
)
{
#define ARGUMENT_COUNT_xhhqbh 6
ULONG Error = ERROR_SUCCESS;

EVENT_DATA_DESCRIPTOR EventData[ARGUMENT_COUNT_xhhqbh];

EventDataDescCreate(&EventData[0], &_Arg0, sizeof(unsigned __int64) );

EventDataDescCreate(&EventData[1], &_Arg1, sizeof(const unsigned short) );

EventDataDescCreate(&EventData[2], &_Arg2, sizeof(const unsigned short) );

EventDataDescCreate(&EventData[3], &_Arg3, sizeof(const unsigned int) );

EventDataDescCreate(&EventData[4], _Arg4, (ULONG)sizeof(char)*_Arg3);

EventDataDescCreate(&EventData[5], &_Arg5, sizeof(const unsigned short) );

Error = EventWrite(RegHandle, Descriptor, ARGUMENT_COUNT_xhhqbh, EventData);

#ifdef MCGEN_CALLOUT
MCGEN_CALLOUT(RegHandle,
Descriptor,
ARGUMENT_COUNT_xhhqbh,
EventData);
#endif

return Error;
}
#endif

//
//Template from manifest : StressLog
//
Expand Down Expand Up @@ -12438,6 +12505,7 @@ MCGEN_CALLOUT(RegHandle,
#define MSG_RuntimePublisher_ThreadTransferKeywordMessage 0x10000020L
#define MSG_RuntimePublisher_DebuggerKeywordMessage 0x10000021L
#define MSG_RuntimePublisher_MonitoringKeywordMessage 0x10000022L
#define MSG_RuntimePublisher_CodeSymbolsKeywordMessage 0x10000023L
#define MSG_RundownPublisher_LoaderKeywordMessage 0x11000004L
#define MSG_RundownPublisher_JitKeywordMessage 0x11000005L
#define MSG_RundownPublisher_NGenKeywordMessage 0x11000006L
Expand Down Expand Up @@ -12725,6 +12793,7 @@ MCGEN_CALLOUT(RegHandle,
#define MSG_RuntimePublisher_ExceptionCatchTaskMessage 0x7000001BL
#define MSG_RuntimePublisher_ExceptionFinallyTaskMessage 0x7000001CL
#define MSG_RuntimePublisher_ExceptionFilterTaskMessage 0x7000001DL
#define MSG_RuntimePublisher_CodeSymbolsTaskMessage 0x7000001EL
#define MSG_RundownPublisher_MethodTaskMessage 0x71000001L
#define MSG_RundownPublisher_LoaderTaskMessage 0x71000002L
#define MSG_RundownPublisher_StackTaskMessage 0x7100000BL
Expand Down Expand Up @@ -12848,6 +12917,7 @@ MCGEN_CALLOUT(RegHandle,
#define MSG_RuntimePublisher_GCMarkWithTypeEventMessage 0xB00000CAL
#define MSG_RuntimePublisher_ExceptionExceptionHandlingEventMessage 0xB00000FAL
#define MSG_RuntimePublisher_ExceptionExceptionHandlingNoneEventMessage 0xB00000FBL
#define MSG_RuntimePublisher_CodeSymbolsEventMessage 0xB0000104L
#define MSG_RuntimePublisher_GCStart_V1EventMessage 0xB0010001L
#define MSG_RuntimePublisher_GCEnd_V1EventMessage 0xB0010002L
#define MSG_RuntimePublisher_GCRestartEEEnd_V1EventMessage 0xB0010003L
Expand Down
1 change: 1 addition & 0 deletions src/pal/prebuilt/inc/etmdummy.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@
#define FireEtwDebugIPCEventEnd() 0
#define FireEtwDebugExceptionProcessingStart() 0
#define FireEtwDebugExceptionProcessingEnd() 0
#define FireEtwCodeSymbols(ModuleId, TotalChunks, ChunkNumber, ChunkLength, Chunk, ClrInstanceID) 0
#define FireEtwCLRStackWalkDCStart(ClrInstanceID, Reserved1, Reserved2, FrameCount, Stack) 0
#define FireEtwMethodDCStart(MethodID, ModuleID, MethodStartAddress, MethodSize, MethodToken, MethodFlags) 0
#define FireEtwMethodDCStart_V1(MethodID, ModuleID, MethodStartAddress, MethodSize, MethodToken, MethodFlags, ClrInstanceID) 0
Expand Down
38 changes: 37 additions & 1 deletion src/vm/ClrEtwAll.man
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@
message="$(string.RuntimePublisher.DebuggerKeywordMessage)" symbol="CLR_DEBUGGER_KEYWORD" />
<keyword name="MonitoringKeyword" mask="0x200000000"
message="$(string.RuntimePublisher.MonitoringKeywordMessage)" symbol="CLR_MONITORING_KEYWORD" />
<keyword name="CodeSymbolsKeyword" mask="0x400000000"
message="$(string.RuntimePublisher.CodeSymbolsKeywordMessage)" symbol="CLR_CODESYMBOLS_KEYWORD" />
</keywords>
<!--Tasks-->
<tasks>
Expand Down Expand Up @@ -362,7 +364,13 @@
<opcodes>
</opcodes>
</task>
<!--Next available ID is 30-->
<task name="CodeSymbols" symbol="CLR_CODE_SYMBOLS_TASK"
value="30" eventGUID="{53aedf69-2049-4f7d-9345-d3018b5c4d80}"
message="$(string.RuntimePublisher.CodeSymbolsTaskMessage)">
<opcodes>
</opcodes>
</task>
<!--Next available ID is 31-->
</tasks>
<!--Maps-->
<maps>
Expand Down Expand Up @@ -2249,6 +2257,25 @@
</UserData>
</template>

<template tid="CodeSymbols">
<data name="ModuleId" inType="win:UInt64" />
<data name="TotalChunks" inType="win:UInt16" />
<data name="ChunkNumber" inType="win:UInt16" />
<data name="ChunkLength" inType="win:UInt32" />
<data name="Chunk" inType="win:Binary" length="ChunkLength"/>
<data name="ClrInstanceID" inType="win:UInt16" />
<UserData>
<CodeSymbols xmlns="myNs">
<ClrInstanceID> %1 </ClrInstanceID>
<ModuleId> %2 </ModuleId>
<TotalChunks> %3 </TotalChunks>
<ChunkNumber> %4 </ChunkNumber>
<ChunkLength> %5 </ChunkLength>
<Chunk> %6 </Chunk>
</CodeSymbols>
</UserData>
</template>

</templates>

<events>
Expand Down Expand Up @@ -3121,6 +3148,12 @@
keywords="DebuggerKeyword" opcode="win:Stop"
task="DebugExceptionProcessing"
symbol="DebugExceptionProcessingEnd" />

<!-- CLR Code Symbol Emission events 260-269 -->
<event value="260" version="0" level="win:Verbose" template="CodeSymbols"
keywords="CodeSymbolsKeyword" opcode="win:Start"
task="CodeSymbols"
symbol="CodeSymbols" message="$(string.RuntimePublisher.CodeSymbolsEventMessage)"/>
</events>
</provider>

Expand Down Expand Up @@ -6262,6 +6295,7 @@
<string id="RuntimePublisher.MethodJitTailCallSucceededEventMessage" value="MethodBeingCompiledNamespace=%1;%nMethodBeingCompiledName=%2;%nMethodBeingCompiledNameSignature=%3;%nCallerNamespace=%4;%nCallerName=%5;%nCallerNameSignature=%6;%nCalleeNamespace=%7;%nCalleeName=%8;%nCalleeNameSignature=%9;%nTailPrefix=%10;%nTailCallType=%11;%nClrInstanceID=%12" />
<string id="RuntimePublisher.SetGCHandleEventMessage" value="HandleID=%1;%nObjectID=%2;%nKind=%3;%nGeneration=%4;%nAppDomainID=%5;%nClrInstanceID=%6" />
<string id="RuntimePublisher.DestroyGCHandleEventMessage" value="HandleID=%1;%nClrInstanceID=%2" />
<string id="RuntimePublisher.CodeSymbolsEventMessage" value="%nClrInstanceId=%1;%nModuleId=%2;%nTotalChunks=%3;%nChunkNumber=%4;%nChunkLength=%5;%nChunk=%6" />
<string id="RundownPublisher.MethodDCStartEventMessage" value="MethodID=%1;%nModuleID=%2;%nMethodStartAddress=%3;%nMethodSize=%4;%nMethodToken=%5;%nMethodFlags=%6" />
<string id="RundownPublisher.MethodDCStart_V1EventMessage" value="MethodID=%1;%nModuleID=%2;%nMethodStartAddress=%3;%nMethodSize=%4;%nMethodToken=%5;%nMethodFlags=%6;%nClrInstanceID=%7" />
<string id="RundownPublisher.MethodDCStart_V2EventMessage" value="MethodID=%1;%nModuleID=%2;%nMethodStartAddress=%3;%nMethodSize=%4;%nMethodToken=%5;%nMethodFlags=%6;%nClrInstanceID=%7;%nReJITID=%8" />
Expand Down Expand Up @@ -6416,6 +6450,7 @@
<string id="RuntimePublisher.ThreadTaskMessage" value="Thread" />
<string id="RuntimePublisher.DebugIPCEventTaskMessage" value="DebugIPCEvent" />
<string id="RuntimePublisher.DebugExceptionProcessingTaskMessage" value="DebugExceptionProcessing" />
<string id="RuntimePublisher.CodeSymbolsTaskMessage" value="CodeSymbols" />
<string id="RundownPublisher.EEStartupTaskMessage" value="Runtime" />
<string id="RundownPublisher.MethodTaskMessage" value="Method" />
<string id="RundownPublisher.LoaderTaskMessage" value="Loader" />
Expand Down Expand Up @@ -6689,6 +6724,7 @@
<string id="RuntimePublisher.ThreadTransferKeywordMessage" value="ThreadTransfer" />
<string id="RuntimePublisher.DebuggerKeywordMessage" value="Debugger" />
<string id="RuntimePublisher.MonitoringKeywordMessage" value="Monitoring" />
<string id="RuntimePublisher.CodeSymbolsKeywordMessage" value="CodeSymbols" />
<string id="RundownPublisher.LoaderKeywordMessage" value="Loader" />
<string id="RundownPublisher.JitKeywordMessage" value="Jit" />
<string id="RundownPublisher.JittedMethodILToNativeMapRundownKeywordMessage" value="JittedMethodILToNativeMapRundown" />
Expand Down
3 changes: 1 addition & 2 deletions src/vm/ceeload.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4467,8 +4467,7 @@ void Module::SetSymbolBytes(LPCBYTE pbSyms, DWORD cbSyms)
&cbWritten);
IfFailThrow(HRESULT_FROM_WIN32(dwError));

// Don't eager load the diasymreader

ETW::CodeSymbolLog::EmitCodeSymbols(this);
// Tell the debugger that symbols have been loaded for this
// module. We iterate through all domains which contain this
// module's assembly, and send a debugger notify for each one.
Expand Down
2 changes: 2 additions & 0 deletions src/vm/compile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1875,6 +1875,8 @@ BOOL CEEPreloader::DoesMethodNeedRestoringBeforePrestubIsRun(

BOOL CEECompileInfo::IsNativeCallableMethod(CORINFO_METHOD_HANDLE handle)
{
WRAPPER_NO_CONTRACT;

MethodDesc * pMethod = GetMethod(handle);
return pMethod->HasNativeCallableAttribute();
}
Expand Down
Loading