[lldb] Get the TargetAPI lock in SBProcess::IsInstrumentationRuntimePresent

Summary:
We should get the TargetAPI lock here to prevent the process of being destroyed while we are in the function. Thanks Jim for explaining what's going on.

Fixes rdar://54424754

Reviewers: jingham

Reviewed By: jingham

Subscribers: JDevlieghere, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D67831

llvm-svn: 373725
This commit is contained in:
Raphael Isemann
2019-10-04 09:54:58 +00:00
parent b3cc321cb2
commit baf769d322

View File

@@ -1180,6 +1180,9 @@ bool SBProcess::IsInstrumentationRuntimePresent(
if (!process_sp)
return false;
std::lock_guard<std::recursive_mutex> guard(
process_sp->GetTarget().GetAPIMutex());
InstrumentationRuntimeSP runtime_sp =
process_sp->GetInstrumentationRuntime(type);