summaryrefslogtreecommitdiff
path: root/src/vm/eventpipeconfiguration.cpp
diff options
context:
space:
mode:
authorBrian Robbins <brianrob@microsoft.com>2017-09-22 01:17:48 -0700
committerJan Vorlicek <janvorli@microsoft.com>2017-09-22 10:17:48 +0200
commit42309c858a742e2ec93c34fa4392a9a097d3d816 (patch)
tree5affea7a80fcc3e77d242dd5d1328f664a08f2eb /src/vm/eventpipeconfiguration.cpp
parent6cee2edabe83ebb4899c38859f6e36eb461a3759 (diff)
downloadcoreclr-42309c858a742e2ec93c34fa4392a9a097d3d816.tar.gz
coreclr-42309c858a742e2ec93c34fa4392a9a097d3d816.tar.bz2
coreclr-42309c858a742e2ec93c34fa4392a9a097d3d816.zip
Fix SIGSEGV in EventPipe on Shutdown (#14123)
* Fix a crash that occurs when a provider is registered after the configuration object has been destroyed. * Code review feedback.
Diffstat (limited to 'src/vm/eventpipeconfiguration.cpp')
-rw-r--r--src/vm/eventpipeconfiguration.cpp45
1 files changed, 44 insertions, 1 deletions
diff --git a/src/vm/eventpipeconfiguration.cpp b/src/vm/eventpipeconfiguration.cpp
index 8b703718b2..ae1dd4e099 100644
--- a/src/vm/eventpipeconfiguration.cpp
+++ b/src/vm/eventpipeconfiguration.cpp
@@ -75,7 +75,7 @@ void EventPipeConfiguration::Initialize()
CONTRACTL_END;
// Create the configuration provider.
- m_pConfigProvider = EventPipe::CreateProvider(SL(s_configurationProviderName));
+ m_pConfigProvider = CreateProvider(SL(s_configurationProviderName), NULL, NULL);
// Create the metadata event.
m_pMetadataEvent = m_pConfigProvider->AddEvent(
@@ -86,6 +86,49 @@ void EventPipeConfiguration::Initialize()
false); /* needStack */
}
+EventPipeProvider* EventPipeConfiguration::CreateProvider(const SString &providerName, EventPipeCallback pCallbackFunction, void *pCallbackData)
+{
+ CONTRACTL
+ {
+ THROWS;
+ GC_NOTRIGGER;
+ MODE_ANY;
+ }
+ CONTRACTL_END;
+
+ // Allocate a new provider.
+ EventPipeProvider *pProvider = new EventPipeProvider(this, providerName, pCallbackFunction, pCallbackData);
+
+ // Register the provider with the configuration system.
+ RegisterProvider(*pProvider);
+
+ return pProvider;
+}
+
+void EventPipeConfiguration::DeleteProvider(EventPipeProvider *pProvider)
+{
+ CONTRACTL
+ {
+ THROWS;
+ GC_NOTRIGGER;
+ MODE_ANY;
+ PRECONDITION(pProvider != NULL);
+ }
+ CONTRACTL_END;
+
+ if (pProvider == NULL)
+ {
+ return;
+ }
+
+ // Unregister the provider.
+ UnregisterProvider(*pProvider);
+
+ // Free the provider itself.
+ delete(pProvider);
+}
+
+
bool EventPipeConfiguration::RegisterProvider(EventPipeProvider &provider)
{
CONTRACTL