Skip to content
Merged
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
21 changes: 12 additions & 9 deletions src/coreclr/vm/eventpipe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,8 @@ void EventPipe::EnableViaEnvironmentVariables()
int providerCnt = 0;

// Create EventPipeProviderConfiguration and start tracing.
NewHolder<EventPipeProviderConfiguration> pProviders = nullptr;
NewArrayHolder<EventPipeProviderConfiguration> pProviders = nullptr;
NewArrayHolder<XplatEventLoggerConfiguration> pConfigurations = nullptr;

// If COMPlus_EnableEventPipe is set to 1 but no configuration was specified, enable EventPipe session
// with the default provider configurations.
Expand All @@ -183,7 +184,6 @@ void EventPipe::EnableViaEnvironmentVariables()
}
else
{
auto configuration = XplatEventLoggerConfiguration();
// Count how many providers there are to parse
static WCHAR comma = W(',');
while (*configToParse != '\0')
Expand All @@ -198,25 +198,28 @@ void EventPipe::EnableViaEnvironmentVariables()
}
configToParse = eventpipeConfig;
pProviders = new EventPipeProviderConfiguration[providerCnt];
pConfigurations = new XplatEventLoggerConfiguration[providerCnt];
int i = 0;
while (*configToParse != '\0')
{
auto end = wcschr(configToParse, comma);
configuration.Parse(configToParse);
pConfigurations[i].Parse(configToParse);

// if we find any invalid configuration, do not trace.
if (!configuration.IsValid())
if (!pConfigurations[i].IsValid())
{
return;
}

pProviders[i++] = EventPipeProviderConfiguration(
configuration.GetProviderName(),
configuration.GetEnabledKeywordsMask(),
configuration.GetLevel(),
configuration.GetArgument()
pProviders[i] = EventPipeProviderConfiguration(
pConfigurations[i].GetProviderName(),
pConfigurations[i].GetEnabledKeywordsMask(),
pConfigurations[i].GetLevel(),
pConfigurations[i].GetArgument()
);

++i;

if (end == nullptr)
{
break;
Expand Down