LLDB mainline
ModuleList.cpp
Go to the documentation of this file.
1//===-- ModuleList.cpp ----------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
10#include "lldb/Core/Module.h"
26#include "lldb/Utility/Log.h"
27#include "lldb/Utility/UUID.h"
28#include "lldb/lldb-defines.h"
29
30#if defined(_WIN32)
32#endif
33
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"
39
40#include <chrono>
41#include <memory>
42#include <mutex>
43#include <string>
44#include <utility>
45
46namespace lldb_private {
47class Function;
48}
49namespace lldb_private {
51}
52namespace lldb_private {
53class Stream;
54}
55namespace lldb_private {
56class SymbolFile;
57}
58namespace lldb_private {
59class Target;
60}
61
62using namespace lldb;
63using namespace lldb_private;
64
65namespace {
66
67#define LLDB_PROPERTIES_modulelist
68#include "CoreProperties.inc"
69
70enum {
71#define LLDB_PROPERTIES_modulelist
72#include "CorePropertiesEnum.inc"
73};
74
75} // namespace
76
78 m_collection_sp = std::make_shared<OptionValueProperties>("symbols");
79 m_collection_sp->Initialize(g_modulelist_properties);
80 m_collection_sp->SetValueChangedCallback(ePropertySymLinkPaths,
81 [this] { UpdateSymlinkMappings(); });
82
83 llvm::SmallString<128> path;
84 if (clang::driver::Driver::getDefaultModuleCachePath(path)) {
86 }
87
88 path.clear();
89 if (llvm::sys::path::cache_directory(path)) {
90 llvm::sys::path::append(path, "lldb");
91 llvm::sys::path::append(path, "IndexCache");
93 }
94
95}
96
98 const uint32_t idx = ePropertyEnableExternalLookup;
99 return GetPropertyAtIndexAs<bool>(
100 idx, g_modulelist_properties[idx].default_uint_value != 0);
101}
102
104 return SetPropertyAtIndex(ePropertyEnableExternalLookup, new_value);
105}
106
108 // Backward compatibility alias.
109 if (GetPropertyAtIndexAs<bool>(ePropertyEnableBackgroundLookup, false))
111
112 const uint32_t idx = ePropertyAutoDownload;
113 return GetPropertyAtIndexAs<lldb::SymbolDownload>(
114 idx, static_cast<lldb::SymbolDownload>(
115 g_modulelist_properties[idx].default_uint_value));
116}
117
119 const uint32_t idx = ePropertyClangModulesCachePath;
120 return GetPropertyAtIndexAs<FileSpec>(idx, {});
121}
122
124 const uint32_t idx = ePropertyClangModulesCachePath;
125 return SetPropertyAtIndex(idx, path);
126}
127
129 const uint32_t idx = ePropertyLLDBIndexCachePath;
130 return GetPropertyAtIndexAs<FileSpec>(idx, {});
131}
132
134 const uint32_t idx = ePropertyLLDBIndexCachePath;
135 return SetPropertyAtIndex(idx, path);
136}
137
139 const uint32_t idx = ePropertyEnableLLDBIndexCache;
140 return GetPropertyAtIndexAs<bool>(
141 idx, g_modulelist_properties[idx].default_uint_value != 0);
142}
143
145 return SetPropertyAtIndex(ePropertyEnableLLDBIndexCache, new_value);
146}
147
149 const uint32_t idx = ePropertyLLDBIndexCacheMaxByteSize;
150 return GetPropertyAtIndexAs<uint64_t>(
151 idx, g_modulelist_properties[idx].default_uint_value);
152}
153
155 const uint32_t idx = ePropertyLLDBIndexCacheMaxPercent;
156 return GetPropertyAtIndexAs<uint64_t>(
157 idx, g_modulelist_properties[idx].default_uint_value);
158}
159
161 const uint32_t idx = ePropertyLLDBIndexCacheExpirationDays;
162 return GetPropertyAtIndexAs<uint64_t>(
163 idx, g_modulelist_properties[idx].default_uint_value);
164}
165
167 FileSpecList list =
168 GetPropertyAtIndexAs<FileSpecList>(ePropertySymLinkPaths, {});
169 llvm::sys::ScopedWriter lock(m_symlink_paths_mutex);
170 const bool notify = false;
171 m_symlink_paths.Clear(notify);
172 for (auto symlink : list) {
173 FileSpec resolved;
174 Status status = FileSystem::Instance().Readlink(symlink, resolved);
175 if (status.Success())
176 m_symlink_paths.Append(symlink.GetPath(), resolved.GetPath(), notify);
177 }
178}
179
181 llvm::sys::ScopedReader lock(m_symlink_paths_mutex);
182 return m_symlink_paths;
183}
184
186 const uint32_t idx = ePropertyLoadSymbolOnDemand;
187 return GetPropertyAtIndexAs<bool>(
188 idx, g_modulelist_properties[idx].default_uint_value != 0);
189}
190
191ModuleList::ModuleList() : m_modules(), m_modules_mutex() {}
192
193ModuleList::ModuleList(const ModuleList &rhs) : m_modules(), m_modules_mutex() {
194 std::lock_guard<std::recursive_mutex> lhs_guard(m_modules_mutex);
195 std::lock_guard<std::recursive_mutex> rhs_guard(rhs.m_modules_mutex);
196 m_modules = rhs.m_modules;
197}
198
200 : m_modules(), m_modules_mutex(), m_notifier(notifier) {}
201
203 if (this != &rhs) {
204 std::lock(m_modules_mutex, rhs.m_modules_mutex);
205 std::lock_guard<std::recursive_mutex> lhs_guard(m_modules_mutex,
206 std::adopt_lock);
207 std::lock_guard<std::recursive_mutex> rhs_guard(rhs.m_modules_mutex,
208 std::adopt_lock);
209 m_modules = rhs.m_modules;
210 }
211 return *this;
212}
213
214ModuleList::~ModuleList() = default;
215
216void ModuleList::AppendImpl(const ModuleSP &module_sp, bool use_notifier) {
217 if (module_sp) {
218 std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
219 // We are required to keep the first element of the Module List as the
220 // executable module. So check here and if the first module is NOT an
221 // but the new one is, we insert this module at the beginning, rather than
222 // at the end.
223 // We don't need to do any of this if the list is empty:
224 if (m_modules.empty()) {
225 m_modules.push_back(module_sp);
226 } else {
227 // Since producing the ObjectFile may take some work, first check the 0th
228 // element, and only if that's NOT an executable look at the incoming
229 // ObjectFile. That way in the normal case we only look at the element
230 // 0 ObjectFile.
231 const bool elem_zero_is_executable
232 = m_modules[0]->GetObjectFile()->GetType()
234 lldb_private::ObjectFile *obj = module_sp->GetObjectFile();
235 if (!elem_zero_is_executable && obj
237 m_modules.insert(m_modules.begin(), module_sp);
238 } else {
239 m_modules.push_back(module_sp);
240 }
241 }
242 if (use_notifier && m_notifier)
243 m_notifier->NotifyModuleAdded(*this, module_sp);
244 }
245}
246
247void ModuleList::Append(const ModuleSP &module_sp, bool notify) {
248 AppendImpl(module_sp, notify);
249}
250
252 const ModuleSP &module_sp,
254 if (module_sp) {
255 std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
256
257 // First remove any equivalent modules. Equivalent modules are modules
258 // whose path, platform path and architecture match.
259 ModuleSpec equivalent_module_spec(module_sp->GetFileSpec(),
260 module_sp->GetArchitecture());
261 equivalent_module_spec.GetPlatformFileSpec() =
262 module_sp->GetPlatformFileSpec();
263
264 size_t idx = 0;
265 while (idx < m_modules.size()) {
266 ModuleSP test_module_sp(m_modules[idx]);
267 if (test_module_sp->MatchesModuleSpec(equivalent_module_spec)) {
268 if (old_modules)
269 old_modules->push_back(test_module_sp);
270 RemoveImpl(m_modules.begin() + idx);
271 } else {
272 ++idx;
273 }
274 }
275 // Now add the new module to the list
276 Append(module_sp);
277 }
278}
279
280bool ModuleList::AppendIfNeeded(const ModuleSP &new_module, bool notify) {
281 if (new_module) {
282 std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
283 for (const ModuleSP &module_sp : m_modules) {
284 if (module_sp.get() == new_module.get())
285 return false; // Already in the list
286 }
287 // Only push module_sp on the list if it wasn't already in there.
288 Append(new_module, notify);
289 return true;
290 }
291 return false;
292}
293
294void ModuleList::Append(const ModuleList &module_list) {
295 for (auto pos : module_list.m_modules)
296 Append(pos);
297}
298
299bool ModuleList::AppendIfNeeded(const ModuleList &module_list) {
300 bool any_in = false;
301 for (auto pos : module_list.m_modules) {
302 if (AppendIfNeeded(pos))
303 any_in = true;
304 }
305 return any_in;
306}
307
308bool ModuleList::RemoveImpl(const ModuleSP &module_sp, bool use_notifier) {
309 if (module_sp) {
310 std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
311 collection::iterator pos, end = m_modules.end();
312 for (pos = m_modules.begin(); pos != end; ++pos) {
313 if (pos->get() == module_sp.get()) {
314 m_modules.erase(pos);
315 if (use_notifier && m_notifier)
316 m_notifier->NotifyModuleRemoved(*this, module_sp);
317 return true;
318 }
319 }
320 }
321 return false;
322}
323
324ModuleList::collection::iterator
325ModuleList::RemoveImpl(ModuleList::collection::iterator pos,
326 bool use_notifier) {
327 ModuleSP module_sp(*pos);
328 collection::iterator retval = m_modules.erase(pos);
329 if (use_notifier && m_notifier)
330 m_notifier->NotifyModuleRemoved(*this, module_sp);
331 return retval;
332}
333
334bool ModuleList::Remove(const ModuleSP &module_sp, bool notify) {
335 return RemoveImpl(module_sp, notify);
336}
337
339 const lldb::ModuleSP &new_module_sp) {
340 if (!RemoveImpl(old_module_sp, false))
341 return false;
342 AppendImpl(new_module_sp, false);
343 if (m_notifier)
344 m_notifier->NotifyModuleUpdated(*this, old_module_sp, new_module_sp);
345 return true;
346}
347
348bool ModuleList::RemoveIfOrphaned(const Module *module_ptr) {
349 if (module_ptr) {
350 std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
351 collection::iterator pos, end = m_modules.end();
352 for (pos = m_modules.begin(); pos != end; ++pos) {
353 if (pos->get() == module_ptr) {
354 if (pos->use_count() == 1) {
355 pos = RemoveImpl(pos);
356 return true;
357 } else
358 return false;
359 }
360 }
361 }
362 return false;
363}
364
365size_t ModuleList::RemoveOrphans(bool mandatory) {
366 std::unique_lock<std::recursive_mutex> lock(m_modules_mutex, std::defer_lock);
367
368 if (mandatory) {
369 lock.lock();
370 } else {
371 // Not mandatory, remove orphans if we can get the mutex
372 if (!lock.try_lock())
373 return 0;
374 }
375 size_t remove_count = 0;
376 // Modules might hold shared pointers to other modules, so removing one
377 // module might make other modules orphans. Keep removing modules until
378 // there are no further modules that can be removed.
379 bool made_progress = true;
380 while (made_progress) {
381 // Keep track if we make progress this iteration.
382 made_progress = false;
383 collection::iterator pos = m_modules.begin();
384 while (pos != m_modules.end()) {
385 if (pos->use_count() == 1) {
386 pos = RemoveImpl(pos);
387 ++remove_count;
388 // We did make progress.
389 made_progress = true;
390 } else {
391 ++pos;
392 }
393 }
394 }
395 return remove_count;
396}
397
398size_t ModuleList::Remove(ModuleList &module_list) {
399 std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
400 size_t num_removed = 0;
401 collection::iterator pos, end = module_list.m_modules.end();
402 for (pos = module_list.m_modules.begin(); pos != end; ++pos) {
403 if (Remove(*pos, false /* notify */))
404 ++num_removed;
405 }
406 if (m_notifier)
407 m_notifier->NotifyModulesRemoved(module_list);
408 return num_removed;
409}
410
412
414
415void ModuleList::ClearImpl(bool use_notifier) {
416 std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
417 if (use_notifier && m_notifier)
419 m_modules.clear();
420}
421
423 std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
424 if (idx < m_modules.size())
425 return m_modules[idx].get();
426 return nullptr;
427}
428
430 std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
431 return GetModuleAtIndexUnlocked(idx);
432}
433
435 ModuleSP module_sp;
436 if (idx < m_modules.size())
437 module_sp = m_modules[idx];
438 return module_sp;
439}
440
442 FunctionNameType name_type_mask,
443 const ModuleFunctionSearchOptions &options,
444 SymbolContextList &sc_list) const {
445 const size_t old_size = sc_list.GetSize();
446
447 if (name_type_mask & eFunctionNameTypeAuto) {
448 Module::LookupInfo lookup_info(name, name_type_mask, eLanguageTypeUnknown);
449
450 std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
451 for (const ModuleSP &module_sp : m_modules) {
452 module_sp->FindFunctions(lookup_info, CompilerDeclContext(), options,
453 sc_list);
454 }
455
456 const size_t new_size = sc_list.GetSize();
457
458 if (old_size < new_size)
459 lookup_info.Prune(sc_list, old_size);
460 } else {
461 std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
462 for (const ModuleSP &module_sp : m_modules) {
463 module_sp->FindFunctions(name, CompilerDeclContext(), name_type_mask,
464 options, sc_list);
465 }
466 }
467}
468
470 lldb::FunctionNameType name_type_mask,
471 SymbolContextList &sc_list) {
472 const size_t old_size = sc_list.GetSize();
473
474 if (name_type_mask & eFunctionNameTypeAuto) {
475 Module::LookupInfo lookup_info(name, name_type_mask, eLanguageTypeUnknown);
476
477 std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
478 for (const ModuleSP &module_sp : m_modules) {
479 module_sp->FindFunctionSymbols(lookup_info.GetLookupName(),
480 lookup_info.GetNameTypeMask(), sc_list);
481 }
482
483 const size_t new_size = sc_list.GetSize();
484
485 if (old_size < new_size)
486 lookup_info.Prune(sc_list, old_size);
487 } else {
488 std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
489 for (const ModuleSP &module_sp : m_modules) {
490 module_sp->FindFunctionSymbols(name, name_type_mask, sc_list);
491 }
492 }
493}
494
496 const ModuleFunctionSearchOptions &options,
497 SymbolContextList &sc_list) {
498 std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
499 for (const ModuleSP &module_sp : m_modules)
500 module_sp->FindFunctions(name, options, sc_list);
501}
502
504 SymbolContextList &sc_list) const {
505 std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
506 for (const ModuleSP &module_sp : m_modules)
507 module_sp->FindCompileUnits(path, sc_list);
508}
509
510void ModuleList::FindGlobalVariables(ConstString name, size_t max_matches,
511 VariableList &variable_list) const {
512 std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
513 for (const ModuleSP &module_sp : m_modules) {
514 module_sp->FindGlobalVariables(name, CompilerDeclContext(), max_matches,
515 variable_list);
516 }
517}
518
520 size_t max_matches,
521 VariableList &variable_list) const {
522 std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
523 for (const ModuleSP &module_sp : m_modules)
524 module_sp->FindGlobalVariables(regex, max_matches, variable_list);
525}
526
528 SymbolType symbol_type,
529 SymbolContextList &sc_list) const {
530 std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
531 for (const ModuleSP &module_sp : m_modules)
532 module_sp->FindSymbolsWithNameAndType(name, symbol_type, sc_list);
533}
534
536 const RegularExpression &regex, lldb::SymbolType symbol_type,
537 SymbolContextList &sc_list) const {
538 std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
539 for (const ModuleSP &module_sp : m_modules)
540 module_sp->FindSymbolsMatchingRegExAndType(regex, symbol_type, sc_list);
541}
542
543void ModuleList::FindModules(const ModuleSpec &module_spec,
544 ModuleList &matching_module_list) const {
545 std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
546 for (const ModuleSP &module_sp : m_modules) {
547 if (module_sp->MatchesModuleSpec(module_spec))
548 matching_module_list.Append(module_sp);
549 }
550}
551
552ModuleSP ModuleList::FindModule(const Module *module_ptr) const {
553 ModuleSP module_sp;
554
555 // Scope for "locker"
556 {
557 std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
558 collection::const_iterator pos, end = m_modules.end();
559
560 for (pos = m_modules.begin(); pos != end; ++pos) {
561 if ((*pos).get() == module_ptr) {
562 module_sp = (*pos);
563 break;
564 }
565 }
566 }
567 return module_sp;
568}
569
571 ModuleSP module_sp;
572
573 if (uuid.IsValid()) {
574 std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
575 collection::const_iterator pos, end = m_modules.end();
576
577 for (pos = m_modules.begin(); pos != end; ++pos) {
578 if ((*pos)->GetUUID() == uuid) {
579 module_sp = (*pos);
580 break;
581 }
582 }
583 }
584 return module_sp;
585}
586
587void ModuleList::FindTypes(Module *search_first, const TypeQuery &query,
588 TypeResults &results) const {
589 std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
590 if (search_first) {
591 search_first->FindTypes(query, results);
592 if (results.Done(query))
593 return;
594 }
595 for (const auto &module_sp : m_modules) {
596 if (search_first != module_sp.get()) {
597 module_sp->FindTypes(query, results);
598 if (results.Done(query))
599 return;
600 }
601 }
602}
603
605 FileSpec &new_spec) const {
606 std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
607 for (const ModuleSP &module_sp : m_modules) {
608 if (module_sp->FindSourceFile(orig_spec, new_spec))
609 return true;
610 }
611 return false;
612}
613
615 const FileSpec &file, uint32_t line,
616 Function *function,
617 std::vector<Address> &output_local,
618 std::vector<Address> &output_extern) {
619 std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
620 for (const ModuleSP &module_sp : m_modules) {
621 module_sp->FindAddressesForLine(target_sp, file, line, function,
622 output_local, output_extern);
623 }
624}
625
627 ModuleSP module_sp;
628 std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
629 collection::const_iterator pos, end = m_modules.end();
630 for (pos = m_modules.begin(); pos != end; ++pos) {
631 ModuleSP module_sp(*pos);
632 if (module_sp->MatchesModuleSpec(module_spec))
633 return module_sp;
634 }
635 return module_sp;
636}
637
638size_t ModuleList::GetSize() const {
639 size_t size = 0;
640 {
641 std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
642 size = m_modules.size();
643 }
644 return size;
645}
646
647void ModuleList::Dump(Stream *s) const {
648 std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
649 for (const ModuleSP &module_sp : m_modules)
650 module_sp->Dump(s);
651}
652
653void ModuleList::LogUUIDAndPaths(Log *log, const char *prefix_cstr) {
654 if (log != nullptr) {
655 std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
656 collection::const_iterator pos, begin = m_modules.begin(),
657 end = m_modules.end();
658 for (pos = begin; pos != end; ++pos) {
659 Module *module = pos->get();
660 const FileSpec &module_file_spec = module->GetFileSpec();
661 LLDB_LOGF(log, "%s[%u] %s (%s) \"%s\"", prefix_cstr ? prefix_cstr : "",
662 (uint32_t)std::distance(begin, pos),
663 module->GetUUID().GetAsString().c_str(),
665 module_file_spec.GetPath().c_str());
666 }
667 }
668}
669
671 Address &so_addr) const {
672 std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
673 for (const ModuleSP &module_sp : m_modules) {
674 if (module_sp->ResolveFileAddress(vm_addr, so_addr))
675 return true;
676 }
677
678 return false;
679}
680
681uint32_t
683 SymbolContextItem resolve_scope,
684 SymbolContext &sc) const {
685 // The address is already section offset so it has a module
686 uint32_t resolved_flags = 0;
687 ModuleSP module_sp(so_addr.GetModule());
688 if (module_sp) {
689 resolved_flags =
690 module_sp->ResolveSymbolContextForAddress(so_addr, resolve_scope, sc);
691 } else {
692 std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
693 collection::const_iterator pos, end = m_modules.end();
694 for (pos = m_modules.begin(); pos != end; ++pos) {
695 resolved_flags =
696 (*pos)->ResolveSymbolContextForAddress(so_addr, resolve_scope, sc);
697 if (resolved_flags != 0)
698 break;
699 }
700 }
701
702 return resolved_flags;
703}
704
706 const char *file_path, uint32_t line, bool check_inlines,
707 SymbolContextItem resolve_scope, SymbolContextList &sc_list) const {
708 FileSpec file_spec(file_path);
709 return ResolveSymbolContextsForFileSpec(file_spec, line, check_inlines,
710 resolve_scope, sc_list);
711}
712
714 const FileSpec &file_spec, uint32_t line, bool check_inlines,
715 SymbolContextItem resolve_scope, SymbolContextList &sc_list) const {
716 std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
717 for (const ModuleSP &module_sp : m_modules) {
718 module_sp->ResolveSymbolContextsForFileSpec(file_spec, line, check_inlines,
719 resolve_scope, sc_list);
720 }
721
722 return sc_list.GetSize();
723}
724
725size_t ModuleList::GetIndexForModule(const Module *module) const {
726 if (module) {
727 std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
728 collection::const_iterator pos;
729 collection::const_iterator begin = m_modules.begin();
730 collection::const_iterator end = m_modules.end();
731 for (pos = begin; pos != end; ++pos) {
732 if ((*pos).get() == module)
733 return std::distance(begin, pos);
734 }
735 }
737}
738
739namespace {
740struct SharedModuleListInfo {
741 ModuleList module_list;
742 ModuleListProperties module_list_properties;
743};
744}
745static SharedModuleListInfo &GetSharedModuleListInfo()
746{
747 static SharedModuleListInfo *g_shared_module_list_info = nullptr;
748 static llvm::once_flag g_once_flag;
749 llvm::call_once(g_once_flag, []() {
750 // NOTE: Intentionally leak the module list so a program doesn't have to
751 // cleanup all modules and object files as it exits. This just wastes time
752 // doing a bunch of cleanup that isn't required.
753 if (g_shared_module_list_info == nullptr)
754 g_shared_module_list_info = new SharedModuleListInfo();
755 });
756 return *g_shared_module_list_info;
757}
758
760 return GetSharedModuleListInfo().module_list;
761}
762
764 return GetSharedModuleListInfo().module_list_properties;
765}
766
767bool ModuleList::ModuleIsInCache(const Module *module_ptr) {
768 if (module_ptr) {
769 ModuleList &shared_module_list = GetSharedModuleList();
770 return shared_module_list.FindModule(module_ptr).get() != nullptr;
771 }
772 return false;
773}
774
776 ModuleList &matching_module_list) {
777 GetSharedModuleList().FindModules(module_spec, matching_module_list);
778}
779
781 return GetSharedModuleList().FindModule(uuid);
782}
783
785 return GetSharedModuleList().RemoveOrphans(mandatory);
786}
787
788Status
789ModuleList::GetSharedModule(const ModuleSpec &module_spec, ModuleSP &module_sp,
790 const FileSpecList *module_search_paths_ptr,
792 bool *did_create_ptr, bool always_create) {
793 ModuleList &shared_module_list = GetSharedModuleList();
794 std::lock_guard<std::recursive_mutex> guard(
795 shared_module_list.m_modules_mutex);
796 char path[PATH_MAX];
797
799
800 module_sp.reset();
801
802 if (did_create_ptr)
803 *did_create_ptr = false;
804
805 const UUID *uuid_ptr = module_spec.GetUUIDPtr();
806 const FileSpec &module_file_spec = module_spec.GetFileSpec();
807 const ArchSpec &arch = module_spec.GetArchitecture();
808
809 // Make sure no one else can try and get or create a module while this
810 // function is actively working on it by doing an extra lock on the global
811 // mutex list.
812 if (!always_create) {
813 ModuleList matching_module_list;
814 shared_module_list.FindModules(module_spec, matching_module_list);
815 const size_t num_matching_modules = matching_module_list.GetSize();
816
817 if (num_matching_modules > 0) {
818 for (size_t module_idx = 0; module_idx < num_matching_modules;
819 ++module_idx) {
820 module_sp = matching_module_list.GetModuleAtIndex(module_idx);
821
822 // Make sure the file for the module hasn't been modified
823 if (module_sp->FileHasChanged()) {
824 if (old_modules)
825 old_modules->push_back(module_sp);
826
828 if (log != nullptr)
829 LLDB_LOGF(
830 log, "%p '%s' module changed: removing from global module list",
831 static_cast<void *>(module_sp.get()),
832 module_sp->GetFileSpec().GetFilename().GetCString());
833
834 shared_module_list.Remove(module_sp);
835 module_sp.reset();
836 } else {
837 // The module matches and the module was not modified from when it
838 // was last loaded.
839 return error;
840 }
841 }
842 }
843 }
844
845 if (module_sp)
846 return error;
847
848 module_sp = std::make_shared<Module>(module_spec);
849 // Make sure there are a module and an object file since we can specify a
850 // valid file path with an architecture that might not be in that file. By
851 // getting the object file we can guarantee that the architecture matches
852 if (module_sp->GetObjectFile()) {
853 // If we get in here we got the correct arch, now we just need to verify
854 // the UUID if one was given
855 if (uuid_ptr && *uuid_ptr != module_sp->GetUUID()) {
856 module_sp.reset();
857 } else {
858 if (module_sp->GetObjectFile() &&
859 module_sp->GetObjectFile()->GetType() ==
861 module_sp.reset();
862 } else {
863 if (did_create_ptr) {
864 *did_create_ptr = true;
865 }
866
867 shared_module_list.ReplaceEquivalent(module_sp, old_modules);
868 return error;
869 }
870 }
871 } else {
872 module_sp.reset();
873 }
874
875 if (module_search_paths_ptr) {
876 const auto num_directories = module_search_paths_ptr->GetSize();
877 for (size_t idx = 0; idx < num_directories; ++idx) {
878 auto search_path_spec = module_search_paths_ptr->GetFileSpecAtIndex(idx);
879 FileSystem::Instance().Resolve(search_path_spec);
880 namespace fs = llvm::sys::fs;
881 if (!FileSystem::Instance().IsDirectory(search_path_spec))
882 continue;
883 search_path_spec.AppendPathComponent(
884 module_spec.GetFileSpec().GetFilename().GetStringRef());
885 if (!FileSystem::Instance().Exists(search_path_spec))
886 continue;
887
888 auto resolved_module_spec(module_spec);
889 resolved_module_spec.GetFileSpec() = search_path_spec;
890 module_sp = std::make_shared<Module>(resolved_module_spec);
891 if (module_sp->GetObjectFile()) {
892 // If we get in here we got the correct arch, now we just need to
893 // verify the UUID if one was given
894 if (uuid_ptr && *uuid_ptr != module_sp->GetUUID()) {
895 module_sp.reset();
896 } else {
897 if (module_sp->GetObjectFile()->GetType() ==
899 module_sp.reset();
900 } else {
901 if (did_create_ptr)
902 *did_create_ptr = true;
903
904 shared_module_list.ReplaceEquivalent(module_sp, old_modules);
905 return Status();
906 }
907 }
908 } else {
909 module_sp.reset();
910 }
911 }
912 }
913
914 // Either the file didn't exist where at the path, or no path was given, so
915 // we now have to use more extreme measures to try and find the appropriate
916 // module.
917
918 // Fixup the incoming path in case the path points to a valid file, yet the
919 // arch or UUID (if one was passed in) don't match.
920 ModuleSpec located_binary_modulespec =
922
923 // Don't look for the file if it appears to be the same one we already
924 // checked for above...
925 if (located_binary_modulespec.GetFileSpec() != module_file_spec) {
926 if (!FileSystem::Instance().Exists(
927 located_binary_modulespec.GetFileSpec())) {
928 located_binary_modulespec.GetFileSpec().GetPath(path, sizeof(path));
929 if (path[0] == '\0')
930 module_file_spec.GetPath(path, sizeof(path));
931 // How can this check ever be true? This branch it is false, and we
932 // haven't modified file_spec.
933 if (FileSystem::Instance().Exists(
934 located_binary_modulespec.GetFileSpec())) {
935 std::string uuid_str;
936 if (uuid_ptr && uuid_ptr->IsValid())
937 uuid_str = uuid_ptr->GetAsString();
938
939 if (arch.IsValid()) {
940 if (!uuid_str.empty())
941 error.SetErrorStringWithFormat(
942 "'%s' does not contain the %s architecture and UUID %s", path,
943 arch.GetArchitectureName(), uuid_str.c_str());
944 else
945 error.SetErrorStringWithFormat(
946 "'%s' does not contain the %s architecture.", path,
947 arch.GetArchitectureName());
948 }
949 } else {
950 error.SetErrorStringWithFormat("'%s' does not exist", path);
951 }
952 if (error.Fail())
953 module_sp.reset();
954 return error;
955 }
956
957 // Make sure no one else can try and get or create a module while this
958 // function is actively working on it by doing an extra lock on the global
959 // mutex list.
960 ModuleSpec platform_module_spec(module_spec);
961 platform_module_spec.GetFileSpec() =
962 located_binary_modulespec.GetFileSpec();
963 platform_module_spec.GetPlatformFileSpec() =
964 located_binary_modulespec.GetFileSpec();
965 platform_module_spec.GetSymbolFileSpec() =
966 located_binary_modulespec.GetSymbolFileSpec();
967 ModuleList matching_module_list;
968 shared_module_list.FindModules(platform_module_spec, matching_module_list);
969 if (!matching_module_list.IsEmpty()) {
970 module_sp = matching_module_list.GetModuleAtIndex(0);
971
972 // If we didn't have a UUID in mind when looking for the object file,
973 // then we should make sure the modification time hasn't changed!
974 if (platform_module_spec.GetUUIDPtr() == nullptr) {
975 auto file_spec_mod_time = FileSystem::Instance().GetModificationTime(
976 located_binary_modulespec.GetFileSpec());
977 if (file_spec_mod_time != llvm::sys::TimePoint<>()) {
978 if (file_spec_mod_time != module_sp->GetModificationTime()) {
979 if (old_modules)
980 old_modules->push_back(module_sp);
981 shared_module_list.Remove(module_sp);
982 module_sp.reset();
983 }
984 }
985 }
986 }
987
988 if (!module_sp) {
989 module_sp = std::make_shared<Module>(platform_module_spec);
990 // Make sure there are a module and an object file since we can specify a
991 // valid file path with an architecture that might not be in that file.
992 // By getting the object file we can guarantee that the architecture
993 // matches
994 if (module_sp && module_sp->GetObjectFile()) {
995 if (module_sp->GetObjectFile()->GetType() ==
997 module_sp.reset();
998 } else {
999 if (did_create_ptr)
1000 *did_create_ptr = true;
1001
1002 shared_module_list.ReplaceEquivalent(module_sp, old_modules);
1003 }
1004 } else {
1005 located_binary_modulespec.GetFileSpec().GetPath(path, sizeof(path));
1006
1007 if (located_binary_modulespec.GetFileSpec()) {
1008 if (arch.IsValid())
1009 error.SetErrorStringWithFormat(
1010 "unable to open %s architecture in '%s'",
1011 arch.GetArchitectureName(), path);
1012 else
1013 error.SetErrorStringWithFormat("unable to open '%s'", path);
1014 } else {
1015 std::string uuid_str;
1016 if (uuid_ptr && uuid_ptr->IsValid())
1017 uuid_str = uuid_ptr->GetAsString();
1018
1019 if (!uuid_str.empty())
1020 error.SetErrorStringWithFormat(
1021 "cannot locate a module for UUID '%s'", uuid_str.c_str());
1022 else
1023 error.SetErrorString("cannot locate a module");
1024 }
1025 }
1026 }
1027 }
1028
1029 return error;
1030}
1031
1033 return GetSharedModuleList().Remove(module_sp);
1034}
1035
1037 return GetSharedModuleList().RemoveIfOrphaned(module_ptr);
1038}
1039
1041 std::list<Status> &errors,
1042 Stream &feedback_stream,
1043 bool continue_on_error) {
1044 if (!target)
1045 return false;
1046 std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
1047 for (auto module : m_modules) {
1048 Status error;
1049 if (module) {
1050 if (!module->LoadScriptingResourceInTarget(target, error,
1051 feedback_stream)) {
1052 if (error.Fail() && error.AsCString()) {
1053 error.SetErrorStringWithFormat("unable to load scripting data for "
1054 "module %s - error reported was %s",
1055 module->GetFileSpec()
1056 .GetFileNameStrippingExtension()
1057 .GetCString(),
1058 error.AsCString());
1059 errors.push_back(error);
1060
1061 if (!continue_on_error)
1062 return false;
1063 }
1064 }
1065 }
1066 }
1067 return errors.empty();
1068}
1069
1071 std::function<bool(const ModuleSP &module_sp)> const &callback) const {
1072 std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
1073 for (const auto &module_sp : m_modules) {
1074 assert(module_sp != nullptr);
1075 // If the callback returns false, then stop iterating and break out
1076 if (!callback(module_sp))
1077 break;
1078 }
1079}
1080
1082 std::function<bool(lldb_private::Module &module_sp)> const &callback)
1083 const {
1084 std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
1085 for (const auto &module_sp : m_modules) {
1086 assert(module_sp != nullptr);
1087 if (callback(*module_sp))
1088 return true;
1089 }
1090
1091 return false;
1092}
1093
1094
1096 // scoped_lock locks both mutexes at once.
1097 std::scoped_lock<std::recursive_mutex, std::recursive_mutex> lock(
1099 m_modules.swap(other.m_modules);
1100}
static llvm::raw_ostream & error(Stream &strm)
#define lldbassert(x)
Definition: LLDBAssert.h:15
#define LLDB_LOGF(log,...)
Definition: Log.h:349
static SharedModuleListInfo & GetSharedModuleListInfo()
Definition: ModuleList.cpp:745
static ModuleList & GetSharedModuleList()
Definition: ModuleList.cpp:759
A section + offset based address class.
Definition: Address.h:62
lldb::ModuleSP GetModule() const
Get accessor for the module for this address.
Definition: Address.cpp:285
An architecture specification class.
Definition: ArchSpec.h:31
bool IsValid() const
Tests if this ArchSpec is valid.
Definition: ArchSpec.h:348
const char * GetArchitectureName() const
Returns a static string representing the current architecture.
Definition: ArchSpec.cpp:552
Represents a generic declaration context in a program.
A uniqued constant string class.
Definition: ConstString.h:40
llvm::StringRef GetStringRef() const
Get the string value as a llvm::StringRef.
Definition: ConstString.h:197
A file collection class.
Definition: FileSpecList.h:85
const FileSpec & GetFileSpecAtIndex(size_t idx) const
Get file at index.
size_t GetSize() const
Get the number of files in the file list.
A file utility class.
Definition: FileSpec.h:56
const ConstString & GetFilename() const
Filename string const get accessor.
Definition: FileSpec.h:240
size_t GetPath(char *path, size_t max_path_length, bool denormalize=true) const
Extract the full path to the file.
Definition: FileSpec.cpp:367
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.
Definition: Function.h:399
bool SetClangModulesCachePath(const FileSpec &path)
Definition: ModuleList.cpp:123
lldb::SymbolDownload GetSymbolAutoDownload() const
Definition: ModuleList.cpp:107
bool SetLLDBIndexCachePath(const FileSpec &path)
Definition: ModuleList.cpp:133
bool SetEnableExternalLookup(bool new_value)
Definition: ModuleList.cpp:103
FileSpec GetLLDBIndexCachePath() const
Definition: ModuleList.cpp:128
PathMappingList GetSymlinkMappings() const
Definition: ModuleList.cpp:180
FileSpec GetClangModulesCachePath() const
Definition: ModuleList.cpp:118
llvm::sys::RWMutex m_symlink_paths_mutex
Definition: ModuleList.h:71
bool SetEnableLLDBIndexCache(bool new_value)
Definition: ModuleList.cpp:144
virtual void NotifyModuleAdded(const ModuleList &module_list, const lldb::ModuleSP &module_sp)=0
virtual void NotifyModuleUpdated(const ModuleList &module_list, const lldb::ModuleSP &old_module_sp, const lldb::ModuleSP &new_module_sp)=0
virtual void NotifyModuleRemoved(const ModuleList &module_list, const lldb::ModuleSP &module_sp)=0
virtual void NotifyWillClearList(const ModuleList &module_list)=0
virtual void NotifyModulesRemoved(lldb_private::ModuleList &module_list)=0
A collection class for Module objects.
Definition: ModuleList.h:103
bool ReplaceModule(const lldb::ModuleSP &old_module_sp, const lldb::ModuleSP &new_module_sp)
Definition: ModuleList.cpp:338
collection m_modules
The collection of modules.
Definition: ModuleList.h:518
void ClearImpl(bool use_notifier=true)
Definition: ModuleList.cpp:415
void ForEach(std::function< bool(const lldb::ModuleSP &module_sp)> const &callback) const
Applies 'callback' to each module in this ModuleList.
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&,...
Definition: ModuleList.cpp:713
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
Definition: ModuleList.cpp:604
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.
static bool ModuleIsInCache(const Module *module_ptr)
Definition: ModuleList.cpp:767
void FindGlobalVariables(ConstString name, size_t max_matches, VariableList &variable_list) const
Find global and static variables by name.
Definition: ModuleList.cpp:510
void Swap(ModuleList &other)
Atomically swaps the contents of this module list with other.
size_t GetIndexForModule(const Module *module) const
Definition: ModuleList.cpp:725
bool RemoveImpl(const lldb::ModuleSP &module_sp, bool use_notifier=true)
Definition: ModuleList.cpp:308
lldb::ModuleSP FindFirstModule(const ModuleSpec &module_spec) const
Definition: ModuleList.cpp:626
void Clear()
Clear the object's state.
Definition: ModuleList.cpp:411
ModuleList()
Default constructor.
Definition: ModuleList.cpp:191
void Dump(Stream *s) const
Dump the description of each module contained in this list.
Definition: ModuleList.cpp:647
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.
Definition: ModuleList.cpp:587
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,...
Definition: ModuleList.cpp:705
static bool RemoveSharedModuleIfOrphaned(const Module *module_ptr)
lldb::ModuleSP GetModuleAtIndexUnlocked(size_t idx) const
Get the module shared pointer for the module at index idx without acquiring the ModuleList mutex.
Definition: ModuleList.cpp:434
void FindCompileUnits(const FileSpec &path, SymbolContextList &sc_list) const
Find compile units by partial or full path.
Definition: ModuleList.cpp:503
const ModuleList & operator=(const ModuleList &rhs)
Assignment operator.
Definition: ModuleList.cpp:202
std::recursive_mutex m_modules_mutex
Definition: ModuleList.h:519
bool AppendIfNeeded(const lldb::ModuleSP &new_module, bool notify=true)
Append a module to the module list, if it is not already there.
Definition: ModuleList.cpp:280
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)
Definition: ModuleList.cpp:789
Module * GetModulePointerAtIndex(size_t idx) const
Get the module pointer for the module at index idx.
Definition: ModuleList.cpp:422
void FindSymbolsWithNameAndType(ConstString name, lldb::SymbolType symbol_type, SymbolContextList &sc_list) const
Definition: ModuleList.cpp:527
static lldb::ModuleSP FindSharedModule(const UUID &uuid)
Definition: ModuleList.cpp:780
lldb::ModuleSP FindModule(const Module *module_ptr) const
Definition: ModuleList.cpp:552
static ModuleListProperties & GetGlobalModuleListProperties()
Definition: ModuleList.cpp:763
void FindModules(const ModuleSpec &module_spec, ModuleList &matching_module_list) const
Finds the first module whose file specification matches file_spec.
Definition: ModuleList.cpp:543
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.
Definition: ModuleList.cpp:614
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&)
Definition: ModuleList.cpp:682
bool Remove(const lldb::ModuleSP &module_sp, bool notify=true)
Remove a module from the module list.
Definition: ModuleList.cpp:334
size_t RemoveOrphans(bool mandatory)
Definition: ModuleList.cpp:365
lldb::ModuleSP GetModuleAtIndex(size_t idx) const
Get the module shared pointer for the module at index idx.
Definition: ModuleList.cpp:429
void Append(const lldb::ModuleSP &module_sp, bool notify=true)
Append a module to the module list.
Definition: ModuleList.cpp:247
static size_t RemoveOrphanSharedModules(bool mandatory)
Definition: ModuleList.cpp:784
void Destroy()
Clear the object's state.
Definition: ModuleList.cpp:413
bool RemoveIfOrphaned(const Module *module_ptr)
Definition: ModuleList.cpp:348
void AppendImpl(const lldb::ModuleSP &module_sp, bool use_notifier=true)
Definition: ModuleList.cpp:216
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.
Definition: ModuleList.cpp:251
void FindFunctionSymbols(ConstString name, lldb::FunctionNameType name_type_mask, SymbolContextList &sc_list)
Definition: ModuleList.cpp:469
static void FindSharedModules(const ModuleSpec &module_spec, ModuleList &matching_module_list)
Definition: ModuleList.cpp:775
void FindSymbolsMatchingRegExAndType(const RegularExpression &regex, lldb::SymbolType symbol_type, SymbolContextList &sc_list) const
Definition: ModuleList.cpp:535
bool ResolveFileAddress(lldb::addr_t vm_addr, Address &so_addr) const
Definition: ModuleList.cpp:670
size_t GetSize() const
Gets the size of the module list.
Definition: ModuleList.cpp:638
void LogUUIDAndPaths(Log *log, const char *prefix_cstr)
Definition: ModuleList.cpp:653
FileSpec & GetPlatformFileSpec()
Definition: ModuleSpec.h:65
FileSpec & GetFileSpec()
Definition: ModuleSpec.h:53
ArchSpec & GetArchitecture()
Definition: ModuleSpec.h:89
FileSpec & GetSymbolFileSpec()
Definition: ModuleSpec.h:77
A class that encapsulates name lookup information.
Definition: Module.h:904
lldb::FunctionNameType GetNameTypeMask() const
Definition: Module.h:919
ConstString GetLookupName() const
Definition: Module.h:915
void Prune(SymbolContextList &sc_list, size_t start_idx) const
Definition: Module.cpp:765
A class that describes an executable image and its associated object and symbol files.
Definition: Module.h:88
const lldb_private::UUID & GetUUID()
Get a reference to the UUID value contained in this object.
Definition: Module.cpp:340
const ArchSpec & GetArchitecture() const
Get const accessor for the module architecture.
Definition: Module.cpp:1035
const FileSpec & GetFileSpec() const
Get const accessor for the module file specification.
Definition: Module.h:452
void FindTypes(const TypeQuery &query, TypeResults &results)
Find types using a type-matching object that contains all search parameters.
Definition: Module.cpp:969
A plug-in interface definition class for object file parsers.
Definition: ObjectFile.h:44
@ eTypeExecutable
A normal executable.
Definition: ObjectFile.h:53
@ eTypeStubLibrary
A library that can be linked against but not used for execution.
Definition: ObjectFile.h:63
void Append(llvm::StringRef path, llvm::StringRef replacement, bool notify)
static ModuleSpec LocateExecutableObjectFile(const ModuleSpec &module_spec)
lldb::OptionValuePropertiesSP m_collection_sp
bool SetPropertyAtIndex(uint32_t idx, T t, const ExecutionContext *exe_ctx=nullptr) const
An error handling class.
Definition: Status.h:44
bool Success() const
Test for success condition.
Definition: Status.cpp:279
A stream class that can stream formatted output to a file.
Definition: Stream.h:28
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.
Definition: SymbolContext.h:34
Provides public interface for all SymbolFiles.
Definition: SymbolFile.h:50
A class that contains all state required for type lookups.
Definition: Type.h:96
This class tracks the state and results of a TypeQuery.
Definition: Type.h:304
bool Done(const TypeQuery &query) const
Check if the type matching has found all of the matches that it needs.
Definition: Type.cpp:186
std::string GetAsString(llvm::StringRef separator="-") const
Definition: UUID.cpp:49
bool IsValid() const
Definition: UUID.h:69
#define LLDB_INVALID_INDEX32
Definition: lldb-defines.h:83
A class that represents a running process on the host machine.
Definition: SBAttachInfo.h:14
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
Definition: Log.h:314
Definition: SBAddress.h:15
@ eLanguageTypeUnknown
Unknown or invalid language value.
SymbolType
Symbol types.
uint64_t addr_t
Definition: lldb-types.h:79
std::shared_ptr< lldb_private::Target > TargetSP
Definition: lldb-forward.h:436
@ eSymbolDownloadBackground
std::shared_ptr< lldb_private::Module > ModuleSP
Definition: lldb-forward.h:365
Options used by Module::FindFunctions.
Definition: Module.h:65
#define PATH_MAX