summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Mason <davmason@microsoft.com>2019-06-21 02:20:57 -0700
committerGitHub <noreply@github.com>2019-06-21 02:20:57 -0700
commite999f37a83583768aa68ad9fda805088ac9df6b8 (patch)
treeb5c65d6621c347755154f1d462175d09e1bf7fdd
parent3954d187d1563a886f5ae2ed72442a813bbf2573 (diff)
downloadcoreclr-e999f37a83583768aa68ad9fda805088ac9df6b8.tar.gz
coreclr-e999f37a83583768aa68ad9fda805088ac9df6b8.tar.bz2
coreclr-e999f37a83583768aa68ad9fda805088ac9df6b8.zip
Mark the profiler attach thread during attach
-rw-r--r--src/vm/profilerdiagnosticprotocolhelper.cpp21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/vm/profilerdiagnosticprotocolhelper.cpp b/src/vm/profilerdiagnosticprotocolhelper.cpp
index 3f81b51226..3f9691206c 100644
--- a/src/vm/profilerdiagnosticprotocolhelper.cpp
+++ b/src/vm/profilerdiagnosticprotocolhelper.cpp
@@ -102,12 +102,23 @@ void ProfilerDiagnosticProtocolHelper::AttachProfiler(DiagnosticsIpc::IpcMessage
hr = CORPROF_E_RUNTIME_UNINITIALIZED;
goto ErrExit;
}
+
+ // Certain actions are only allowable during attach, and this flag is how we track it.
+ ClrFlsSetThreadType(ThreadType_ProfAPI_Attach);
+
+ EX_TRY
+ {
+ hr = ProfilingAPIUtility::LoadProfilerForAttach(&payload->profilerGuid,
+ payload->pwszProfilerPath,
+ payload->pClientData,
+ payload->cbClientData,
+ payload->dwAttachTimeout);
+ }
+ EX_CATCH_HRESULT(hr);
+
+ // Clear the flag so this thread isn't permanently marked as the attach thread.
+ ClrFlsClearThreadType(ThreadType_ProfAPI_Attach);
- hr = ProfilingAPIUtility::LoadProfilerForAttach(&payload->profilerGuid,
- payload->pwszProfilerPath,
- payload->pClientData,
- payload->cbClientData,
- payload->dwAttachTimeout);
ErrExit:
if (hr != S_OK)
{