Path: blob/main/contrib/llvm-project/lldb/source/Plugins/InstrumentationRuntime/Utility/Utility.cpp
213845 views
//===-- Utility.cpp -------------------------------------------------------===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#include "Utility.h"910#include "lldb/Core/Module.h"11#include "lldb/Target/Target.h"1213namespace lldb_private {1415lldb::ModuleSP GetPreferredAsanModule(const Target &target) {16// Currently only supported on Darwin.17if (!target.GetArchitecture().GetTriple().isOSDarwin())18return nullptr;1920lldb::ModuleSP module;21llvm::Regex pattern(R"(libclang_rt\.asan_.*_dynamic\.dylib)");22target.GetImages().ForEach([&](const lldb::ModuleSP &m) {23if (pattern.match(m->GetFileSpec().GetFilename().GetStringRef())) {24module = m;25return false;26}2728return true;29});3031return module;32}3334} // namespace lldb_private353637