Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Commit

Permalink
Mark the profiler attach thread during attach
Browse files Browse the repository at this point in the history
  • Loading branch information
davmason authored Jun 21, 2019
1 parent 3954d18 commit e999f37
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions src/vm/profilerdiagnosticprotocolhelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down

0 comments on commit e999f37

Please sign in to comment.