diff options
Diffstat (limited to 'lldb/source/Core/ModuleList.cpp')
-rw-r--r-- | lldb/source/Core/ModuleList.cpp | 42 |
1 files changed, 32 insertions, 10 deletions
diff --git a/lldb/source/Core/ModuleList.cpp b/lldb/source/Core/ModuleList.cpp index 07100bb81dca1..0345678ddafff 100644 --- a/lldb/source/Core/ModuleList.cpp +++ b/lldb/source/Core/ModuleList.cpp @@ -1,4 +1,4 @@ -//===-- ModuleList.cpp ------------------------------------------*- C++ -*-===// +//===-- ModuleList.cpp ----------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -12,6 +12,7 @@ #include "lldb/Core/ModuleSpec.h" #include "lldb/Host/FileSystem.h" #include "lldb/Interpreter/OptionValueFileSpec.h" +#include "lldb/Interpreter/OptionValueFileSpecList.h" #include "lldb/Interpreter/OptionValueProperties.h" #include "lldb/Interpreter/Property.h" #include "lldb/Symbol/LocateSymbolFile.h" @@ -77,6 +78,8 @@ ModuleListProperties::ModuleListProperties() { m_collection_sp = std::make_shared<OptionValueProperties>(ConstString("symbols")); m_collection_sp->Initialize(g_modulelist_properties); + m_collection_sp->SetValueChangedCallback(ePropertySymLinkPaths, + [this] { UpdateSymlinkMappings(); }); llvm::SmallString<128> path; clang::driver::Driver::getDefaultModuleCachePath(path); @@ -106,6 +109,28 @@ bool ModuleListProperties::SetClangModulesCachePath(llvm::StringRef path) { nullptr, ePropertyClangModulesCachePath, path); } +void ModuleListProperties::UpdateSymlinkMappings() { + FileSpecList list = m_collection_sp + ->GetPropertyAtIndexAsOptionValueFileSpecList( + nullptr, false, ePropertySymLinkPaths) + ->GetCurrentValue(); + llvm::sys::ScopedWriter lock(m_symlink_paths_mutex); + const bool notify = false; + m_symlink_paths.Clear(notify); + for (FileSpec symlink : list) { + FileSpec resolved; + Status status = FileSystem::Instance().Readlink(symlink, resolved); + if (status.Success()) + m_symlink_paths.Append(ConstString(symlink.GetPath()), + ConstString(resolved.GetPath()), notify); + } +} + +PathMappingList ModuleListProperties::GetSymlinkMappings() const { + llvm::sys::ScopedReader lock(m_symlink_paths_mutex); + return m_symlink_paths; +} + ModuleList::ModuleList() : m_modules(), m_modules_mutex(), m_notifier(nullptr) {} @@ -338,7 +363,7 @@ void ModuleList::FindFunctions(ConstString name, std::lock_guard<std::recursive_mutex> guard(m_modules_mutex); collection::const_iterator pos, end = m_modules.end(); for (pos = m_modules.begin(); pos != end; ++pos) { - (*pos)->FindFunctions(lookup_info.GetLookupName(), nullptr, + (*pos)->FindFunctions(lookup_info.GetLookupName(), CompilerDeclContext(), lookup_info.GetNameTypeMask(), include_symbols, include_inlines, sc_list); } @@ -351,8 +376,8 @@ void ModuleList::FindFunctions(ConstString name, std::lock_guard<std::recursive_mutex> guard(m_modules_mutex); collection::const_iterator pos, end = m_modules.end(); for (pos = m_modules.begin(); pos != end; ++pos) { - (*pos)->FindFunctions(name, nullptr, name_type_mask, include_symbols, - include_inlines, sc_list); + (*pos)->FindFunctions(name, CompilerDeclContext(), name_type_mask, + include_symbols, include_inlines, sc_list); } } } @@ -409,7 +434,8 @@ void ModuleList::FindGlobalVariables(ConstString name, size_t max_matches, std::lock_guard<std::recursive_mutex> guard(m_modules_mutex); collection::const_iterator pos, end = m_modules.end(); for (pos = m_modules.begin(); pos != end; ++pos) { - (*pos)->FindGlobalVariables(name, nullptr, max_matches, variable_list); + (*pos)->FindGlobalVariables(name, CompilerDeclContext(), max_matches, + variable_list); } } @@ -565,10 +591,6 @@ size_t ModuleList::GetSize() const { } void ModuleList::Dump(Stream *s) const { - // s.Printf("%.*p: ", (int)sizeof(void*) * 2, this); - // s.Indent(); - // s << "ModuleList\n"; - std::lock_guard<std::recursive_mutex> guard(m_modules_mutex); collection::const_iterator pos, end = m_modules.end(); for (pos = m_modules.begin(); pos != end; ++pos) { @@ -807,7 +829,7 @@ Status ModuleList::GetSharedModule(const ModuleSpec &module_spec, if (!FileSystem::Instance().IsDirectory(search_path_spec)) continue; search_path_spec.AppendPathComponent( - module_spec.GetFileSpec().GetFilename().AsCString()); + module_spec.GetFileSpec().GetFilename().GetStringRef()); if (!FileSystem::Instance().Exists(search_path_spec)) continue; |