34#include "clang/Driver/Driver.h"
35#include "llvm/ADT/StringRef.h"
36#include "llvm/Support/FileSystem.h"
37#include "llvm/Support/Threading.h"
38#include "llvm/Support/raw_ostream.h"
67#define LLDB_PROPERTIES_modulelist
68#include "CoreProperties.inc"
71#define LLDB_PROPERTIES_modulelist
72#include "CorePropertiesEnum.inc"
83 llvm::SmallString<128> path;
84 if (clang::driver::Driver::getDefaultModuleCachePath(path)) {
89 if (llvm::sys::path::cache_directory(path)) {
90 llvm::sys::path::append(path,
"lldb");
91 llvm::sys::path::append(path,
"IndexCache");
98 const uint32_t idx = ePropertyEnableExternalLookup;
100 idx, g_modulelist_properties[idx].default_uint_value != 0);
112 const uint32_t idx = ePropertyAutoDownload;
115 g_modulelist_properties[idx].default_uint_value));
119 const uint32_t idx = ePropertyClangModulesCachePath;
124 const uint32_t idx = ePropertyClangModulesCachePath;
129 const uint32_t idx = ePropertyLLDBIndexCachePath;
134 const uint32_t idx = ePropertyLLDBIndexCachePath;
139 const uint32_t idx = ePropertyEnableLLDBIndexCache;
141 idx, g_modulelist_properties[idx].default_uint_value != 0);
149 const uint32_t idx = ePropertyLLDBIndexCacheMaxByteSize;
151 idx, g_modulelist_properties[idx].default_uint_value);
155 const uint32_t idx = ePropertyLLDBIndexCacheMaxPercent;
157 idx, g_modulelist_properties[idx].default_uint_value);
161 const uint32_t idx = ePropertyLLDBIndexCacheExpirationDays;
163 idx, g_modulelist_properties[idx].default_uint_value);
170 const bool notify =
false;
172 for (
auto symlink : list) {
186 const uint32_t idx = ePropertyLoadSymbolOnDemand;
188 idx, g_modulelist_properties[idx].default_uint_value != 0);
233 const bool elem_zero_is_executable =
234 m_modules[0]->GetObjectFile()->GetType() ==
237 if (!elem_zero_is_executable && obj &&
248 m_notifier->NotifyModuleAdded(*
this, module_sp);
263 ModuleSpec equivalent_module_spec(module_sp->GetFileSpec(),
264 module_sp->GetArchitecture());
266 module_sp->GetPlatformFileSpec();
271 if (test_module_sp->MatchesModuleSpec(equivalent_module_spec)) {
273 old_modules->push_back(test_module_sp);
288 if (module_sp.get() == new_module.get())
292 Append(new_module, notify);
315 collection::iterator pos, end =
m_modules.end();
316 for (pos =
m_modules.begin(); pos != end; ++pos) {
317 if (pos->get() == module_sp.get()) {
320 m_notifier->NotifyModuleRemoved(*
this, module_sp);
328ModuleList::collection::iterator
332 collection::iterator retval =
m_modules.erase(pos);
348 m_notifier->NotifyModuleUpdated(*
this, old_module_sp, new_module_sp);
353 if (
auto module_sp = module_wp.lock()) {
355 collection::iterator pos, end =
m_modules.end();
356 for (pos =
m_modules.begin(); pos != end; ++pos) {
357 if (pos->get() == module_sp.get()) {
361 if (pos->use_count() == kUseCountOrphaned) {
373 std::unique_lock<std::recursive_mutex> lock(
m_modules_mutex, std::defer_lock);
379 if (!lock.try_lock())
382 size_t remove_count = 0;
386 bool made_progress =
true;
387 while (made_progress) {
389 made_progress =
false;
390 collection::iterator pos =
m_modules.begin();
396 made_progress =
true;
407 size_t num_removed = 0;
408 collection::iterator pos, end = module_list.
m_modules.end();
409 for (pos = module_list.
m_modules.begin(); pos != end; ++pos) {
414 m_notifier->NotifyModulesRemoved(module_list);
449 FunctionNameType name_type_mask,
452 const size_t old_size = sc_list.
GetSize();
454 if (name_type_mask & eFunctionNameTypeAuto) {
463 const size_t new_size = sc_list.
GetSize();
465 if (old_size < new_size)
466 lookup_info.Prune(sc_list, old_size);
470 module_sp->FindFunctions(name, CompilerDeclContext(), name_type_mask,
477 lldb::FunctionNameType name_type_mask,
479 const size_t old_size = sc_list.
GetSize();
481 if (name_type_mask & eFunctionNameTypeAuto) {
490 const size_t new_size = sc_list.
GetSize();
492 if (old_size < new_size)
493 lookup_info.
Prune(sc_list, old_size);
497 module_sp->FindFunctionSymbols(name, name_type_mask, sc_list);
507 module_sp->FindFunctions(name, options, sc_list);
514 module_sp->FindCompileUnits(path, sc_list);
531 module_sp->FindGlobalVariables(regex, max_matches, variable_list);
539 module_sp->FindSymbolsWithNameAndType(name, symbol_type, sc_list);
547 module_sp->FindSymbolsMatchingRegExAndType(regex, symbol_type, sc_list);
554 if (module_sp->MatchesModuleSpec(module_spec))
555 matching_module_list.
Append(module_sp);
565 collection::const_iterator pos, end =
m_modules.end();
567 for (pos =
m_modules.begin(); pos != end; ++pos) {
568 if ((*pos).get() == module_ptr) {
582 collection::const_iterator pos, end =
m_modules.end();
584 for (pos =
m_modules.begin(); pos != end; ++pos) {
585 if ((*pos)->GetUUID() == uuid) {
597 if (m->GetID() == uid) {
613 if (results.
Done(query))
616 for (
const auto &module_sp :
m_modules) {
617 if (search_first != module_sp.get()) {
618 module_sp->FindTypes(query, results);
619 if (results.
Done(query))
629 if (module_sp->FindSourceFile(orig_spec, new_spec))
636 const FileSpec &file, uint32_t line,
638 std::vector<Address> &output_local,
639 std::vector<Address> &output_extern) {
642 module_sp->FindAddressesForLine(target_sp, file, line, function,
643 output_local, output_extern);
650 collection::const_iterator pos, end =
m_modules.end();
651 for (pos =
m_modules.begin(); pos != end; ++pos) {
653 if (module_sp->MatchesModuleSpec(module_spec))
675 if (log !=
nullptr) {
677 collection::const_iterator pos, begin =
m_modules.begin(),
679 for (pos = begin; pos != end; ++pos) {
680 Module *module = pos->get();
681 const FileSpec &module_file_spec =
module->GetFileSpec();
682 LLDB_LOGF(log,
"%s[%u] %s (%s) \"%s\"", prefix_cstr ? prefix_cstr :
"",
683 (uint32_t)std::distance(begin, pos),
686 module_file_spec.
GetPath().c_str());
695 if (module_sp->ResolveFileAddress(vm_addr, so_addr))
704 SymbolContextItem resolve_scope,
707 uint32_t resolved_flags = 0;
711 module_sp->ResolveSymbolContextForAddress(so_addr, resolve_scope, sc);
714 collection::const_iterator pos, end =
m_modules.end();
715 for (pos =
m_modules.begin(); pos != end; ++pos) {
717 (*pos)->ResolveSymbolContextForAddress(so_addr, resolve_scope, sc);
718 if (resolved_flags != 0)
723 return resolved_flags;
727 const char *file_path, uint32_t line,
bool check_inlines,
731 resolve_scope, sc_list);
735 const FileSpec &file_spec, uint32_t line,
bool check_inlines,
739 module_sp->ResolveSymbolContextsForFileSpec(file_spec, line, check_inlines,
740 resolve_scope, sc_list);
749 collection::const_iterator pos;
750 collection::const_iterator begin =
m_modules.begin();
751 collection::const_iterator end =
m_modules.end();
752 for (pos = begin; pos != end; ++pos) {
753 if ((*pos).get() == module)
754 return std::distance(begin, pos);
763class SharedModuleList {
767 void FindModules(
const ModuleSpec &module_spec,
769 std::lock_guard<std::recursive_mutex> guard(GetMutex());
772 FindModulesInMap(module_spec, matching_module_list);
773 if (!matching_module_list.
IsEmpty())
775 m_list.FindModules(module_spec, matching_module_list);
780 assert((matching_module_list.
IsEmpty() ||
786 "Search by name not found in SharedModuleList's map");
791 std::lock_guard<std::recursive_mutex> guard(GetMutex());
792 if (
ModuleSP result = FindModuleInMap(module))
794 return m_list.FindModule(&module);
798 ModuleSP FindModule(
const UUID &uuid)
const {
799 return m_list.FindModule(uuid);
802 void Append(
const ModuleSP &module_sp,
bool use_notifier) {
805 std::lock_guard<std::recursive_mutex> guard(GetMutex());
806 m_list.Append(module_sp, use_notifier);
810 size_t RemoveOrphans(
bool mandatory) {
811 std::unique_lock<std::recursive_mutex> lock(GetMutex(), std::defer_lock);
815 if (!lock.try_lock())
818 size_t total_count = 0;
824 run_count = RemoveOrphansFromMapAndList();
825 run_count += m_list.RemoveOrphans(mandatory);
826 total_count += run_count;
829 }
while (run_count != 0);
834 bool Remove(
const ModuleSP &module_sp,
bool use_notifier =
true) {
837 std::lock_guard<std::recursive_mutex> guard(GetMutex());
838 RemoveFromMap(module_sp);
839 return m_list.Remove(module_sp, use_notifier);
842 void ReplaceEquivalent(
const ModuleSP &module_sp,
843 llvm::SmallVectorImpl<lldb::ModuleSP> *old_modules) {
844 std::lock_guard<std::recursive_mutex> guard(GetMutex());
845 m_list.ReplaceEquivalent(module_sp, old_modules);
846 ReplaceEquivalentInMap(module_sp);
849 bool RemoveIfOrphaned(
const ModuleWP module_wp) {
850 std::lock_guard<std::recursive_mutex> guard(GetMutex());
851 RemoveFromMap(module_wp,
true);
852 return m_list.RemoveIfOrphaned(module_wp);
855 std::recursive_mutex &GetMutex()
const {
return m_list.GetMutex(); }
861 ConstString name =
module.GetFileSpec().GetFilename();
862 auto it = m_name_to_modules.find(name);
863 if (it == m_name_to_modules.end())
865 const llvm::SmallVectorImpl<ModuleSP> &vector = it->second;
866 for (
const ModuleSP &module_sp : vector) {
867 if (module_sp.get() == &module)
873 void FindModulesInMap(
const ModuleSpec &module_spec,
874 ModuleList &matching_module_list)
const {
876 if (it == m_name_to_modules.end())
878 const llvm::SmallVectorImpl<ModuleSP> &vector = it->second;
879 for (
const ModuleSP &module_sp : vector) {
880 if (module_sp->MatchesModuleSpec(module_spec))
881 matching_module_list.
Append(module_sp);
885 void AddToMap(
const ModuleSP &module_sp) {
886 ConstString name = module_sp->GetFileSpec().GetFilename();
889 m_name_to_modules[name].push_back(module_sp);
892 void RemoveFromMap(
const ModuleWP module_wp,
bool if_orphaned =
false) {
893 if (
auto module_sp = module_wp.lock()) {
894 ConstString name = module_sp->GetFileSpec().GetFilename();
895 if (!m_name_to_modules.contains(name))
897 llvm::SmallVectorImpl<ModuleSP> &vec = m_name_to_modules[name];
898 for (
auto *it = vec.begin(); it != vec.end(); ++it) {
899 if (it->get() == module_sp.get()) {
902 constexpr long kUseCountOrphaned =
903 kUseCountSharedModuleListOrphaned + 1;
904 if (!if_orphaned || it->use_count() == kUseCountOrphaned) {
913 void ReplaceEquivalentInMap(
const ModuleSP &module_sp) {
914 RemoveEquivalentModulesFromMap(module_sp);
918 void RemoveEquivalentModulesFromMap(
const ModuleSP &module_sp) {
919 ConstString name = module_sp->GetFileSpec().GetFilename();
923 auto it = m_name_to_modules.find(name);
924 if (it == m_name_to_modules.end())
929 ModuleSpec equivalent_module_spec(module_sp->GetFileSpec(),
930 module_sp->GetArchitecture());
931 equivalent_module_spec.GetPlatformFileSpec() =
932 module_sp->GetPlatformFileSpec();
934 llvm::SmallVectorImpl<ModuleSP> &vec = it->second;
935 llvm::erase_if(vec, [&equivalent_module_spec](
ModuleSP &element) {
936 return element->MatchesModuleSpec(equivalent_module_spec);
941 ModuleList RemoveOrphansFromVector(llvm::SmallVectorImpl<ModuleSP> &vec) {
944 auto *to_remove_start = llvm::remove_if(vec, [](
const ModuleSP &module) {
945 return module.use_count() == kUseCountSharedModuleListOrphaned;
948 ModuleList to_remove;
949 for (
ModuleSP *it = to_remove_start; it != vec.end(); ++it)
950 to_remove.Append(*it);
952 vec.erase(to_remove_start, vec.end());
960 int RemoveOrphansFromMapAndList() {
964 int remove_count = 0;
965 int previous_remove_count;
967 previous_remove_count = remove_count;
968 for (
auto &[name, vec] : m_name_to_modules) {
971 ModuleList to_remove = RemoveOrphansFromVector(vec);
972 remove_count += to_remove.
GetSize();
973 m_list.Remove(to_remove);
976 }
while (previous_remove_count != remove_count);
985 llvm::DenseMap<ConstString, llvm::SmallVector<ModuleSP, 1>> m_name_to_modules;
988 static constexpr long kUseCountSharedModuleListOrphaned = 2;
991struct SharedModuleListInfo {
992 ModuleList module_list;
993 ModuleListProperties module_list_properties;
998 static SharedModuleListInfo *g_shared_module_list_info =
nullptr;
999 static llvm::once_flag g_once_flag;
1000 llvm::call_once(g_once_flag, []() {
1004 if (g_shared_module_list_info ==
nullptr)
1005 g_shared_module_list_info =
new SharedModuleListInfo();
1007 return *g_shared_module_list_info;
1021 return shared_module_list.
FindModule(module_ptr).get() !=
nullptr;
1043 bool *did_create_ptr,
bool always_create) {
1045 std::lock_guard<std::recursive_mutex> guard(
1054 *did_create_ptr =
false;
1063 if (!always_create) {
1065 shared_module_list.
FindModules(module_spec, matching_module_list);
1066 const size_t num_matching_modules = matching_module_list.
GetSize();
1068 if (num_matching_modules > 0) {
1069 for (
size_t module_idx = 0; module_idx < num_matching_modules;
1074 if (module_sp->FileHasChanged()) {
1076 old_modules->push_back(module_sp);
1081 log,
"%p '%s' module changed: removing from global module list",
1082 static_cast<void *
>(module_sp.get()),
1083 module_sp->GetFileSpec().GetFilename().GetCString());
1085 shared_module_list.
Remove(module_sp);
1099 module_sp = std::make_shared<Module>(module_spec);
1103 if (module_sp->GetObjectFile()) {
1106 if (uuid_ptr && *uuid_ptr != module_sp->GetUUID()) {
1109 if (module_sp->GetObjectFile() &&
1110 module_sp->GetObjectFile()->GetType() ==
1114 if (did_create_ptr) {
1115 *did_create_ptr =
true;
1126 if (module_search_paths_ptr) {
1127 const auto num_directories = module_search_paths_ptr->
GetSize();
1128 for (
size_t idx = 0; idx < num_directories; ++idx) {
1131 namespace fs = llvm::sys::fs;
1134 search_path_spec.AppendPathComponent(
1139 auto resolved_module_spec(module_spec);
1140 resolved_module_spec.GetFileSpec() = search_path_spec;
1141 module_sp = std::make_shared<Module>(resolved_module_spec);
1142 if (module_sp->GetObjectFile()) {
1145 if (uuid_ptr && *uuid_ptr != module_sp->GetUUID()) {
1148 if (module_sp->GetObjectFile()->GetType() ==
1153 *did_create_ptr =
true;
1174 module_spec, symbol_locator_map);
1177 if (located_binary_modulespec.
GetFileSpec() != module_file_spec) {
1181 if (path[0] ==
'\0')
1182 module_file_spec.
GetPath(path,
sizeof(path));
1187 std::string uuid_str;
1188 if (uuid_ptr && uuid_ptr->
IsValid())
1192 if (!uuid_str.empty())
1194 "'%s' does not contain the %s architecture and UUID %s", path,
1198 "'%s' does not contain the %s architecture.", path,
1212 ModuleSpec platform_module_spec(module_spec);
1220 shared_module_list.
FindModules(platform_module_spec, matching_module_list);
1221 if (!matching_module_list.
IsEmpty()) {
1226 if (platform_module_spec.
GetUUIDPtr() ==
nullptr) {
1229 if (file_spec_mod_time != llvm::sys::TimePoint<>()) {
1230 if (file_spec_mod_time != module_sp->GetModificationTime()) {
1232 old_modules->push_back(module_sp);
1233 shared_module_list.
Remove(module_sp);
1241 module_sp = std::make_shared<Module>(platform_module_spec);
1246 if (module_sp && module_sp->GetObjectFile()) {
1247 module_sp->GetSymbolLocatorStatistics().merge(symbol_locator_map);
1248 if (module_sp->GetObjectFile()->GetType() ==
1253 *did_create_ptr =
true;
1263 "unable to open %s architecture in '%s'",
1269 std::string uuid_str;
1270 if (uuid_ptr && uuid_ptr->
IsValid())
1273 if (!uuid_str.empty())
1275 "cannot locate a module for UUID '%s'", uuid_str.c_str());
1295 std::list<Status> &errors,
1297 bool continue_on_error) {
1310 if (!module->LoadScriptingResourceInTarget(target,
error,
1314 "unable to load scripting data for "
1315 "module %s - error reported was %s",
1316 module->GetFileSpec()
1317 .GetFileNameStrippingExtension()
1320 errors.push_back(std::move(
error));
1321 if (!continue_on_error)
1327 return errors.empty();
1334 for (
const auto &module_sp :
m_modules) {
1335 assert(module_sp !=
nullptr);
1345 for (
const auto &module_sp :
m_modules) {
1346 assert(module_sp !=
nullptr);
1347 if (callback(*module_sp))
1357 std::scoped_lock<std::recursive_mutex, std::recursive_mutex> lock(
static llvm::raw_ostream & error(Stream &strm)
#define LLDB_LOGF(log,...)
static SharedModuleListInfo & GetSharedModuleListInfo()
static ModuleList & GetSharedModuleList()
A section + offset based address class.
lldb::ModuleSP GetModule() const
Get accessor for the module for this address.
An architecture specification class.
bool IsValid() const
Tests if this ArchSpec is valid.
const char * GetArchitectureName() const
Returns a static string representing the current architecture.
Represents a generic declaration context in a program.
A uniqued constant string class.
bool IsEmpty() const
Test for empty string.
llvm::StringRef GetStringRef() const
Get the string value as a llvm::StringRef.
const FileSpec & GetFileSpecAtIndex(size_t idx) const
Get file at index.
size_t GetSize() const
Get the number of files in the file list.
const ConstString & GetFilename() const
Filename string const get accessor.
size_t GetPath(char *path, size_t max_path_length, bool denormalize=true) const
Extract the full path to the file.
void Resolve(llvm::SmallVectorImpl< char > &path)
Resolve path to make it canonical.
llvm::sys::TimePoint GetModificationTime(const FileSpec &file_spec) const
Returns the modification time of the given file.
Status Readlink(const FileSpec &src, FileSpec &dst)
static FileSystem & Instance()
A class that describes a function.
bool SetClangModulesCachePath(const FileSpec &path)
lldb::SymbolDownload GetSymbolAutoDownload() const
bool GetEnableExternalLookup() const
bool SetLLDBIndexCachePath(const FileSpec &path)
bool GetEnableLLDBIndexCache() const
bool SetEnableExternalLookup(bool new_value)
FileSpec GetLLDBIndexCachePath() const
PathMappingList GetSymlinkMappings() const
uint64_t GetLLDBIndexCacheMaxByteSize()
PathMappingList m_symlink_paths
bool GetLoadSymbolOnDemand()
FileSpec GetClangModulesCachePath() const
llvm::sys::RWMutex m_symlink_paths_mutex
uint64_t GetLLDBIndexCacheMaxPercent()
void UpdateSymlinkMappings()
bool SetEnableLLDBIndexCache(bool new_value)
uint64_t GetLLDBIndexCacheExpirationDays()
virtual void NotifyModuleRemoved(const ModuleList &module_list, const lldb::ModuleSP &module_sp)=0
A collection class for Module objects.
bool ReplaceModule(const lldb::ModuleSP &old_module_sp, const lldb::ModuleSP &new_module_sp)
collection m_modules
The collection of modules.
void ClearImpl(bool use_notifier=true)
uint32_t ResolveSymbolContextsForFileSpec(const FileSpec &file_spec, uint32_t line, bool check_inlines, lldb::SymbolContextItem resolve_scope, SymbolContextList &sc_list) const
Resolve items in the symbol context for a given file and line. (const FileSpec&,...
static bool RemoveSharedModule(lldb::ModuleSP &module_sp)
void FindFunctions(ConstString name, lldb::FunctionNameType name_type_mask, const ModuleFunctionSearchOptions &options, SymbolContextList &sc_list) const
bool FindSourceFile(const FileSpec &orig_spec, FileSpec &new_spec) const
bool AnyOf(std::function< bool(lldb_private::Module &module)> const &callback) const
Returns true if 'callback' returns true for one of the modules in this ModuleList.
ModuleIterableNoLocking ModulesNoLocking() const
static constexpr long kUseCountModuleListOrphaned
An orphaned module that lives only in the ModuleList has a count of 1.
static bool ModuleIsInCache(const Module *module_ptr)
void FindGlobalVariables(ConstString name, size_t max_matches, VariableList &variable_list) const
Find global and static variables by name.
void Swap(ModuleList &other)
Atomically swaps the contents of this module list with other.
size_t GetIndexForModule(const Module *module) const
bool RemoveImpl(const lldb::ModuleSP &module_sp, bool use_notifier=true)
lldb::ModuleSP FindFirstModule(const ModuleSpec &module_spec) const
Finds the first module whose file specification matches module_spec.
void Clear()
Clear the object's state.
ModuleList()
Default constructor.
void Dump(Stream *s) const
Dump the description of each module contained in this list.
void FindTypes(Module *search_first, const TypeQuery &query, lldb_private::TypeResults &results) const
Find types using a type-matching object that contains all search parameters.
uint32_t ResolveSymbolContextForFilePath(const char *file_path, uint32_t line, bool check_inlines, lldb::SymbolContextItem resolve_scope, SymbolContextList &sc_list) const
Resolve items in the symbol context for a given file and line. (const char*,uint32_t,...
lldb::ModuleSP GetModuleAtIndexUnlocked(size_t idx) const
Get the module shared pointer for the module at index idx without acquiring the ModuleList mutex.
static bool RemoveSharedModuleIfOrphaned(const lldb::ModuleWP module_ptr)
void FindCompileUnits(const FileSpec &path, SymbolContextList &sc_list) const
Find compile units by partial or full path.
const ModuleList & operator=(const ModuleList &rhs)
Assignment operator.
std::recursive_mutex m_modules_mutex
bool AppendIfNeeded(const lldb::ModuleSP &new_module, bool notify=true)
Append a module to the module list, if it is not already there.
static Status GetSharedModule(const ModuleSpec &module_spec, lldb::ModuleSP &module_sp, const FileSpecList *module_search_paths_ptr, llvm::SmallVectorImpl< lldb::ModuleSP > *old_modules, bool *did_create_ptr, bool always_create=false)
Module * GetModulePointerAtIndex(size_t idx) const
Get the module pointer for the module at index idx.
void FindSymbolsWithNameAndType(ConstString name, lldb::SymbolType symbol_type, SymbolContextList &sc_list) const
static lldb::ModuleSP FindSharedModule(const UUID &uuid)
lldb::ModuleSP FindModule(const Module *module_ptr) const
static ModuleListProperties & GetGlobalModuleListProperties()
void FindModules(const ModuleSpec &module_spec, ModuleList &matching_module_list) const
Finds modules whose file specification matches module_spec.
void FindAddressesForLine(const lldb::TargetSP target_sp, const FileSpec &file, uint32_t line, Function *function, std::vector< Address > &output_local, std::vector< Address > &output_extern)
Find addresses by file/line.
uint32_t ResolveSymbolContextForAddress(const Address &so_addr, lldb::SymbolContextItem resolve_scope, SymbolContext &sc) const
Resolve the symbol context for the given address. (const Address&,uint32_t,SymbolContext&)
bool Remove(const lldb::ModuleSP &module_sp, bool notify=true)
Remove a module from the module list.
size_t RemoveOrphans(bool mandatory)
lldb::ModuleSP GetModuleAtIndex(size_t idx) const
Get the module shared pointer for the module at index idx.
void Append(const lldb::ModuleSP &module_sp, bool notify=true)
Append a module to the module list.
static size_t RemoveOrphanSharedModules(bool mandatory)
void Destroy()
Clear the object's state.
void AppendImpl(const lldb::ModuleSP &module_sp, bool use_notifier=true)
bool LoadScriptingResourcesInTarget(Target *target, std::list< Status > &errors, Stream &feedback_stream, bool continue_on_error=true)
void ReplaceEquivalent(const lldb::ModuleSP &module_sp, llvm::SmallVectorImpl< lldb::ModuleSP > *old_modules=nullptr)
Append a module to the module list and remove any equivalent modules.
void FindFunctionSymbols(ConstString name, lldb::FunctionNameType name_type_mask, SymbolContextList &sc_list)
static void FindSharedModules(const ModuleSpec &module_spec, ModuleList &matching_module_list)
void FindSymbolsMatchingRegExAndType(const RegularExpression ®ex, lldb::SymbolType symbol_type, SymbolContextList &sc_list) const
bool ResolveFileAddress(lldb::addr_t vm_addr, Address &so_addr) const
size_t GetSize() const
Gets the size of the module list.
bool RemoveIfOrphaned(const lldb::ModuleWP module_ptr)
void LogUUIDAndPaths(Log *log, const char *prefix_cstr)
void ForEach(std::function< IterationAction(const lldb::ModuleSP &module_sp)> const &callback) const
Applies 'callback' to each module in this ModuleList.
FileSpec & GetPlatformFileSpec()
ArchSpec & GetArchitecture()
FileSpec & GetSymbolFileSpec()
A class that encapsulates name lookup information.
lldb::FunctionNameType GetNameTypeMask() const
ConstString GetLookupName() const
void Prune(SymbolContextList &sc_list, size_t start_idx) const
A class that describes an executable image and its associated object and symbol files.
const lldb_private::UUID & GetUUID()
Get a reference to the UUID value contained in this object.
const ArchSpec & GetArchitecture() const
Get const accessor for the module architecture.
const FileSpec & GetFileSpec() const
Get const accessor for the module file specification.
void FindTypes(const TypeQuery &query, TypeResults &results)
Find types using a type-matching object that contains all search parameters.
A plug-in interface definition class for object file parsers.
@ eTypeExecutable
A normal executable.
@ eTypeStubLibrary
A library that can be linked against but not used for execution.
static ModuleSpec LocateExecutableObjectFile(const ModuleSpec &module_spec, StatisticsMap &map)
lldb::OptionValuePropertiesSP m_collection_sp
T GetPropertyAtIndexAs(uint32_t idx, T default_value, const ExecutionContext *exe_ctx=nullptr) const
bool SetPropertyAtIndex(uint32_t idx, T t, const ExecutionContext *exe_ctx=nullptr) const
A class to count time for plugins.
static Status FromErrorStringWithFormat(const char *format,...) __attribute__((format(printf
static Status FromErrorString(const char *str)
bool Success() const
Test for success condition.
A stream class that can stream formatted output to a file.
Defines a list of symbol context objects.
uint32_t GetSize() const
Get accessor for a symbol context list size.
Defines a symbol context baton that can be handed other debug core functions.
Provides public interface for all SymbolFiles.
A class that contains all state required for type lookups.
This class tracks the state and results of a TypeQuery.
bool Done(const TypeQuery &query) const
Check if the type matching has found all of the matches that it needs.
Represents UUID's of various sizes.
std::string GetAsString(llvm::StringRef separator="-") const
#define LLDB_INVALID_INDEX32
A class that represents a running process on the host machine.
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
IterationAction
Useful for callbacks whose return type indicates whether to continue iteration or short-circuit.
std::weak_ptr< lldb_private::Module > ModuleWP
@ eLanguageTypeUnknown
Unknown or invalid language value.
std::shared_ptr< lldb_private::Target > TargetSP
@ eSymbolDownloadBackground
std::shared_ptr< lldb_private::Module > ModuleSP
Options used by Module::FindFunctions.