diff options
author | David Mason <davmason@microsoft.com> | 2019-09-18 02:57:27 -0700 |
---|---|---|
committer | Alexander Soldatov/AI Compiler Lab /SRR/Staff Engineer/삼성전자 <soldatov.a@samsung.com> | 2019-10-07 11:59:33 +0300 |
commit | dcfac98e5f9efc8d05e4560f8933785a9053c306 (patch) | |
tree | eef2ee8b7448395257ea7473946c2091de4d94ad | |
parent | f13b05d6fcc83193b4f072fda8e7b9a63bebb899 (diff) | |
download | coreclr-dcfac98e5f9efc8d05e4560f8933785a9053c306.tar.gz coreclr-dcfac98e5f9efc8d05e4560f8933785a9053c306.tar.bz2 coreclr-dcfac98e5f9efc8d05e4560f8933785a9053c306.zip |
bail if profiler is terminated
-rw-r--r-- | src/vm/proftoeeinterfaceimpl.cpp | 39 |
1 files changed, 24 insertions, 15 deletions
diff --git a/src/vm/proftoeeinterfaceimpl.cpp b/src/vm/proftoeeinterfaceimpl.cpp index 03362f9299..b053f176e7 100644 --- a/src/vm/proftoeeinterfaceimpl.cpp +++ b/src/vm/proftoeeinterfaceimpl.cpp @@ -10235,11 +10235,15 @@ HCIMPL2(EXTERN_C void, ProfileEnter, UINT_PTR clientData, void * platformSpecifi #ifdef PROFILING_SUPPORTED + // We might have already torn down the profiler, if so we need to abort. + if (g_profControlBlock.curProfStatus.Get() != kProfStatusActive #ifdef PROF_TEST_ONLY_FORCE_ELT - // If this test-only flag is set, it's possible we might not have a profiler - // attached, or might not have any of the hooks set. See - // code:ProfControlBlock#TestOnlyELT - if (g_profControlBlock.fTestOnlyForceEnterLeave) + // If this test-only flag is set, it's possible we might not have a profiler + // attached, or might not have any of the hooks set. See + // code:ProfControlBlock#TestOnlyELT + || g_profControlBlock.fTestOnlyForceEnterLeave +#endif // PROF_TEST_ONLY_FORCE_ELT + ) { if ((g_profControlBlock.pProfInterface.Load() == NULL) || ( @@ -10253,7 +10257,6 @@ HCIMPL2(EXTERN_C void, ProfileEnter, UINT_PTR clientData, void * platformSpecifi return; } } -#endif // PROF_TEST_ONLY_FORCE_ELT // ELT3 Fast-Path hooks should be NULL when ELT intermediary is used. _ASSERTE(g_profControlBlock.pProfInterface->GetEnter3Hook() == NULL); @@ -10407,11 +10410,15 @@ HCIMPL2(EXTERN_C void, ProfileLeave, UINT_PTR clientData, void * platformSpecifi #ifdef PROFILING_SUPPORTED + // We might have already torn down the profiler, if so we need to abort. + if (g_profControlBlock.curProfStatus.Get() != kProfStatusActive #ifdef PROF_TEST_ONLY_FORCE_ELT - // If this test-only flag is set, it's possible we might not have a profiler - // attached, or might not have any of the hooks set. See - // code:ProfControlBlock#TestOnlyELT - if (g_profControlBlock.fTestOnlyForceEnterLeave) + // If this test-only flag is set, it's possible we might not have a profiler + // attached, or might not have any of the hooks set. See + // code:ProfControlBlock#TestOnlyELT + || g_profControlBlock.fTestOnlyForceEnterLeave +#endif // PROF_TEST_ONLY_FORCE_ELT + ) { if ((g_profControlBlock.pProfInterface.Load() == NULL) || ( @@ -10425,7 +10432,6 @@ HCIMPL2(EXTERN_C void, ProfileLeave, UINT_PTR clientData, void * platformSpecifi return; } } -#endif // PROF_TEST_ONLY_FORCE_ELT // ELT3 Fast-Path hooks should be NULL when ELT intermediary is used. _ASSERTE(g_profControlBlock.pProfInterface->GetLeave3Hook() == NULL); @@ -10539,11 +10545,15 @@ HCIMPL2(EXTERN_C void, ProfileTailcall, UINT_PTR clientData, void * platformSpec #ifdef PROFILING_SUPPORTED + // We might have already torn down the profiler, if so we need to abort. + if (g_profControlBlock.curProfStatus.Get() != kProfStatusActive #ifdef PROF_TEST_ONLY_FORCE_ELT - // If this test-only flag is set, it's possible we might not have a profiler - // attached, or might not have any of the hooks set. See - // code:ProfControlBlock#TestOnlyELT - if (g_profControlBlock.fTestOnlyForceEnterLeave) + // If this test-only flag is set, it's possible we might not have a profiler + // attached, or might not have any of the hooks set. See + // code:ProfControlBlock#TestOnlyELT + || g_profControlBlock.fTestOnlyForceEnterLeave +#endif // PROF_TEST_ONLY_FORCE_ELT + ) { if ((g_profControlBlock.pProfInterface.Load() == NULL) || ( @@ -10557,7 +10567,6 @@ HCIMPL2(EXTERN_C void, ProfileTailcall, UINT_PTR clientData, void * platformSpec return; } } -#endif // PROF_TEST_ONLY_FORCE_ELT // ELT3 fast-path hooks should be NULL when ELT intermediary is used. _ASSERTE(g_profControlBlock.pProfInterface->GetTailcall3Hook() == NULL); |