LLDB  mainline
SBModule.cpp
Go to the documentation of this file.
1 //===-- SBModule.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 
9 #include "lldb/API/SBModule.h"
10 #include "SBReproducerPrivate.h"
11 #include "lldb/API/SBAddress.h"
12 #include "lldb/API/SBFileSpec.h"
13 #include "lldb/API/SBModuleSpec.h"
14 #include "lldb/API/SBProcess.h"
15 #include "lldb/API/SBStream.h"
17 #include "lldb/Core/Module.h"
18 #include "lldb/Core/Section.h"
21 #include "lldb/Symbol/ObjectFile.h"
22 #include "lldb/Symbol/SymbolFile.h"
23 #include "lldb/Symbol/Symtab.h"
24 #include "lldb/Symbol/TypeSystem.h"
26 #include "lldb/Target/Target.h"
28 
29 using namespace lldb;
30 using namespace lldb_private;
31 
32 SBModule::SBModule() : m_opaque_sp() {
34 }
35 
36 SBModule::SBModule(const lldb::ModuleSP &module_sp) : m_opaque_sp(module_sp) {}
37 
38 SBModule::SBModule(const SBModuleSpec &module_spec) : m_opaque_sp() {
39  LLDB_RECORD_CONSTRUCTOR(SBModule, (const lldb::SBModuleSpec &), module_spec);
40 
41  ModuleSP module_sp;
42  Status error = ModuleList::GetSharedModule(
43  *module_spec.m_opaque_up, module_sp, nullptr, nullptr, nullptr);
44  if (module_sp)
45  SetSP(module_sp);
46 }
47 
48 SBModule::SBModule(const SBModule &rhs) : m_opaque_sp(rhs.m_opaque_sp) {
50 }
51 
53  : m_opaque_sp() {
55  header_addr);
56 
57  ProcessSP process_sp(process.GetSP());
58  if (process_sp) {
59  m_opaque_sp = process_sp->ReadModuleFromMemory(FileSpec(), header_addr);
60  if (m_opaque_sp) {
61  Target &target = process_sp->GetTarget();
62  bool changed = false;
63  m_opaque_sp->SetLoadAddress(target, 0, true, changed);
64  target.GetImages().Append(m_opaque_sp);
65  }
66  }
67 }
68 
70  LLDB_RECORD_METHOD(const lldb::SBModule &, SBModule, operator=,
71  (const lldb::SBModule &), rhs);
72 
73  if (this != &rhs)
75  return LLDB_RECORD_RESULT(*this);
76 }
77 
78 SBModule::~SBModule() = default;
79 
80 bool SBModule::IsValid() const {
82  return this->operator bool();
83 }
84 SBModule::operator bool() const {
85  LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBModule, operator bool);
86 
87  return m_opaque_sp.get() != nullptr;
88 }
89 
92 
93  m_opaque_sp.reset();
94 }
95 
98 
99  SBFileSpec file_spec;
100  ModuleSP module_sp(GetSP());
101  if (module_sp)
102  file_spec.SetFileSpec(module_sp->GetFileSpec());
103 
104  return LLDB_RECORD_RESULT(file_spec);
105 }
106 
110 
111  SBFileSpec file_spec;
112  ModuleSP module_sp(GetSP());
113  if (module_sp)
114  file_spec.SetFileSpec(module_sp->GetPlatformFileSpec());
115 
116  return LLDB_RECORD_RESULT(file_spec);
117 }
118 
121  (const lldb::SBFileSpec &), platform_file);
122 
123  bool result = false;
124 
125  ModuleSP module_sp(GetSP());
126  if (module_sp) {
127  module_sp->SetPlatformFileSpec(*platform_file);
128  result = true;
129  }
130 
131  return result;
132 }
133 
137 
138  SBFileSpec sb_file_spec;
139  ModuleSP module_sp(GetSP());
140  if (module_sp)
141  sb_file_spec.SetFileSpec(module_sp->GetRemoteInstallFileSpec());
142  return LLDB_RECORD_RESULT(sb_file_spec);
143 }
144 
147  (lldb::SBFileSpec &), file);
148 
149  ModuleSP module_sp(GetSP());
150  if (module_sp) {
151  module_sp->SetRemoteInstallFileSpec(file.ref());
152  return true;
153  }
154  return false;
155 }
156 
157 const uint8_t *SBModule::GetUUIDBytes() const {
159 
160  const uint8_t *uuid_bytes = nullptr;
161  ModuleSP module_sp(GetSP());
162  if (module_sp)
163  uuid_bytes = module_sp->GetUUID().GetBytes().data();
164 
165  return uuid_bytes;
166 }
167 
168 const char *SBModule::GetUUIDString() const {
170 
171  const char *uuid_cstr = nullptr;
172  ModuleSP module_sp(GetSP());
173  if (module_sp) {
174  // We are going to return a "const char *" value through the public API, so
175  // we need to constify it so it gets added permanently the string pool and
176  // then we don't need to worry about the lifetime of the string as it will
177  // never go away once it has been put into the ConstString string pool
178  uuid_cstr = ConstString(module_sp->GetUUID().GetAsString()).GetCString();
179  }
180 
181  if (uuid_cstr && uuid_cstr[0]) {
182  return uuid_cstr;
183  }
184 
185  return nullptr;
186 }
187 
188 bool SBModule::operator==(const SBModule &rhs) const {
189  LLDB_RECORD_METHOD_CONST(bool, SBModule, operator==, (const lldb::SBModule &),
190  rhs);
191 
192  if (m_opaque_sp)
193  return m_opaque_sp.get() == rhs.m_opaque_sp.get();
194  return false;
195 }
196 
197 bool SBModule::operator!=(const SBModule &rhs) const {
198  LLDB_RECORD_METHOD_CONST(bool, SBModule, operator!=, (const lldb::SBModule &),
199  rhs);
200 
201  if (m_opaque_sp)
202  return m_opaque_sp.get() != rhs.m_opaque_sp.get();
203  return false;
204 }
205 
206 ModuleSP SBModule::GetSP() const { return m_opaque_sp; }
207 
208 void SBModule::SetSP(const ModuleSP &module_sp) { m_opaque_sp = module_sp; }
209 
212  (lldb::addr_t), vm_addr);
213 
214  lldb::SBAddress sb_addr;
215  ModuleSP module_sp(GetSP());
216  if (module_sp) {
217  Address addr;
218  if (module_sp->ResolveFileAddress(vm_addr, addr))
219  sb_addr.ref() = addr;
220  }
221  return LLDB_RECORD_RESULT(sb_addr);
222 }
223 
226  uint32_t resolve_scope) {
229  (const lldb::SBAddress &, uint32_t), addr, resolve_scope);
230 
231  SBSymbolContext sb_sc;
232  ModuleSP module_sp(GetSP());
233  SymbolContextItem scope = static_cast<SymbolContextItem>(resolve_scope);
234  if (module_sp && addr.IsValid())
235  module_sp->ResolveSymbolContextForAddress(addr.ref(), scope, *sb_sc);
236  return LLDB_RECORD_RESULT(sb_sc);
237 }
238 
239 bool SBModule::GetDescription(SBStream &description) {
241  description);
242 
243  Stream &strm = description.ref();
244 
245  ModuleSP module_sp(GetSP());
246  if (module_sp) {
247  module_sp->GetDescription(strm.AsRawOstream());
248  } else
249  strm.PutCString("No value");
250 
251  return true;
252 }
253 
256 
257  ModuleSP module_sp(GetSP());
258  if (module_sp) {
259  return module_sp->GetNumCompileUnits();
260  }
261  return 0;
262 }
263 
266  (uint32_t), index);
267 
268  SBCompileUnit sb_cu;
269  ModuleSP module_sp(GetSP());
270  if (module_sp) {
271  CompUnitSP cu_sp = module_sp->GetCompileUnitAtIndex(index);
272  sb_cu.reset(cu_sp.get());
273  }
274  return LLDB_RECORD_RESULT(sb_cu);
275 }
276 
279  (const lldb::SBFileSpec &), sb_file_spec);
280 
281  SBSymbolContextList sb_sc_list;
282  const ModuleSP module_sp(GetSP());
283  if (sb_file_spec.IsValid() && module_sp) {
284  module_sp->FindCompileUnits(*sb_file_spec, *sb_sc_list);
285  }
286  return LLDB_RECORD_RESULT(sb_sc_list);
287 }
288 
289 static Symtab *GetUnifiedSymbolTable(const lldb::ModuleSP &module_sp) {
290  if (module_sp)
291  return module_sp->GetSymtab();
292  return nullptr;
293 }
294 
297 
298  ModuleSP module_sp(GetSP());
299  if (Symtab *symtab = GetUnifiedSymbolTable(module_sp))
300  return symtab->GetNumSymbols();
301  return 0;
302 }
303 
306 
307  SBSymbol sb_symbol;
308  ModuleSP module_sp(GetSP());
309  Symtab *symtab = GetUnifiedSymbolTable(module_sp);
310  if (symtab)
311  sb_symbol.SetSymbol(symtab->SymbolAtIndex(idx));
312  return LLDB_RECORD_RESULT(sb_symbol);
313 }
314 
316  lldb::SymbolType symbol_type) {
318  (const char *, lldb::SymbolType), name, symbol_type);
319 
320  SBSymbol sb_symbol;
321  if (name && name[0]) {
322  ModuleSP module_sp(GetSP());
323  Symtab *symtab = GetUnifiedSymbolTable(module_sp);
324  if (symtab)
325  sb_symbol.SetSymbol(symtab->FindFirstSymbolWithNameAndType(
326  ConstString(name), symbol_type, Symtab::eDebugAny,
327  Symtab::eVisibilityAny));
328  }
329  return LLDB_RECORD_RESULT(sb_symbol);
330 }
331 
333  lldb::SymbolType symbol_type) {
335  (const char *, lldb::SymbolType), name, symbol_type);
336 
337  SBSymbolContextList sb_sc_list;
338  if (name && name[0]) {
339  ModuleSP module_sp(GetSP());
340  Symtab *symtab = GetUnifiedSymbolTable(module_sp);
341  if (symtab) {
342  std::vector<uint32_t> matching_symbol_indexes;
343  symtab->FindAllSymbolsWithNameAndType(ConstString(name), symbol_type,
344  matching_symbol_indexes);
345  const size_t num_matches = matching_symbol_indexes.size();
346  if (num_matches) {
347  SymbolContext sc;
348  sc.module_sp = module_sp;
349  SymbolContextList &sc_list = *sb_sc_list;
350  for (size_t i = 0; i < num_matches; ++i) {
351  sc.symbol = symtab->SymbolAtIndex(matching_symbol_indexes[i]);
352  if (sc.symbol)
353  sc_list.Append(sc);
354  }
355  }
356  }
357  }
358  return LLDB_RECORD_RESULT(sb_sc_list);
359 }
360 
363 
364  ModuleSP module_sp(GetSP());
365  if (module_sp) {
366  // Give the symbol vendor a chance to add to the unified section list.
367  module_sp->GetSymbolFile();
368  SectionList *section_list = module_sp->GetSectionList();
369  if (section_list)
370  return section_list->GetSize();
371  }
372  return 0;
373 }
374 
377  idx);
378 
379  SBSection sb_section;
380  ModuleSP module_sp(GetSP());
381  if (module_sp) {
382  // Give the symbol vendor a chance to add to the unified section list.
383  module_sp->GetSymbolFile();
384  SectionList *section_list = module_sp->GetSectionList();
385 
386  if (section_list)
387  sb_section.SetSP(section_list->GetSectionAtIndex(idx));
388  }
389  return LLDB_RECORD_RESULT(sb_section);
390 }
391 
393  uint32_t name_type_mask) {
395  (const char *, uint32_t), name, name_type_mask);
396 
397  lldb::SBSymbolContextList sb_sc_list;
398  ModuleSP module_sp(GetSP());
399  if (name && module_sp) {
400 
401  ModuleFunctionSearchOptions function_options;
402  function_options.include_symbols = true;
403  function_options.include_inlines = true;
404  FunctionNameType type = static_cast<FunctionNameType>(name_type_mask);
405  module_sp->FindFunctions(ConstString(name), CompilerDeclContext(), type,
406  function_options, *sb_sc_list);
407  }
408  return LLDB_RECORD_RESULT(sb_sc_list);
409 }
410 
412  uint32_t max_matches) {
414  (lldb::SBTarget &, const char *, uint32_t), target, name,
415  max_matches);
416 
417  SBValueList sb_value_list;
418  ModuleSP module_sp(GetSP());
419  if (name && module_sp) {
420  VariableList variable_list;
421  module_sp->FindGlobalVariables(ConstString(name), CompilerDeclContext(),
422  max_matches, variable_list);
423  for (const VariableSP &var_sp : variable_list) {
424  lldb::ValueObjectSP valobj_sp;
425  TargetSP target_sp(target.GetSP());
426  valobj_sp = ValueObjectVariable::Create(target_sp.get(), var_sp);
427  if (valobj_sp)
428  sb_value_list.Append(SBValue(valobj_sp));
429  }
430  }
431 
432  return LLDB_RECORD_RESULT(sb_value_list);
433 }
434 
436  const char *name) {
438  (lldb::SBTarget &, const char *), target, name);
439 
440  SBValueList sb_value_list(FindGlobalVariables(target, name, 1));
441  if (sb_value_list.IsValid() && sb_value_list.GetSize() > 0)
442  return LLDB_RECORD_RESULT(sb_value_list.GetValueAtIndex(0));
443  return LLDB_RECORD_RESULT(SBValue());
444 }
445 
446 lldb::SBType SBModule::FindFirstType(const char *name_cstr) {
448  name_cstr);
449 
450  SBType sb_type;
451  ModuleSP module_sp(GetSP());
452  if (name_cstr && module_sp) {
453  SymbolContext sc;
454  const bool exact_match = false;
455  ConstString name(name_cstr);
456 
457  sb_type = SBType(module_sp->FindFirstType(sc, name, exact_match));
458 
459  if (!sb_type.IsValid()) {
460  auto type_system_or_err =
461  module_sp->GetTypeSystemForLanguage(eLanguageTypeC);
462  if (auto err = type_system_or_err.takeError()) {
463  llvm::consumeError(std::move(err));
464  return LLDB_RECORD_RESULT(SBType());
465  }
466  sb_type = SBType(type_system_or_err->GetBuiltinTypeByName(name));
467  }
468  }
469  return LLDB_RECORD_RESULT(sb_type);
470 }
471 
474  type);
475 
476  ModuleSP module_sp(GetSP());
477  if (module_sp) {
478  auto type_system_or_err =
479  module_sp->GetTypeSystemForLanguage(eLanguageTypeC);
480  if (auto err = type_system_or_err.takeError()) {
481  llvm::consumeError(std::move(err));
482  } else {
483  return LLDB_RECORD_RESULT(
484  SBType(type_system_or_err->GetBasicTypeFromAST(type)));
485  }
486  }
487  return LLDB_RECORD_RESULT(SBType());
488 }
489 
492  type);
493 
494  SBTypeList retval;
495 
496  ModuleSP module_sp(GetSP());
497  if (type && module_sp) {
498  TypeList type_list;
499  const bool exact_match = false;
500  ConstString name(type);
501  llvm::DenseSet<SymbolFile *> searched_symbol_files;
502  module_sp->FindTypes(name, exact_match, UINT32_MAX, searched_symbol_files,
503  type_list);
504 
505  if (type_list.Empty()) {
506  auto type_system_or_err =
507  module_sp->GetTypeSystemForLanguage(eLanguageTypeC);
508  if (auto err = type_system_or_err.takeError()) {
509  llvm::consumeError(std::move(err));
510  } else {
511  CompilerType compiler_type =
512  type_system_or_err->GetBuiltinTypeByName(name);
513  if (compiler_type)
514  retval.Append(SBType(compiler_type));
515  }
516  } else {
517  for (size_t idx = 0; idx < type_list.GetSize(); idx++) {
518  TypeSP type_sp(type_list.GetTypeAtIndex(idx));
519  if (type_sp)
520  retval.Append(SBType(type_sp));
521  }
522  }
523  }
524  return LLDB_RECORD_RESULT(retval);
525 }
526 
529  uid);
530 
531  ModuleSP module_sp(GetSP());
532  if (module_sp) {
533  if (SymbolFile *symfile = module_sp->GetSymbolFile()) {
534  Type *type_ptr = symfile->ResolveTypeUID(uid);
535  if (type_ptr)
536  return LLDB_RECORD_RESULT(SBType(type_ptr->shared_from_this()));
537  }
538  }
539  return LLDB_RECORD_RESULT(SBType());
540 }
541 
544  type_mask);
545 
546  SBTypeList sb_type_list;
547 
548  ModuleSP module_sp(GetSP());
549  if (!module_sp)
550  return LLDB_RECORD_RESULT(sb_type_list);
551  SymbolFile *symfile = module_sp->GetSymbolFile();
552  if (!symfile)
553  return LLDB_RECORD_RESULT(sb_type_list);
554 
555  TypeClass type_class = static_cast<TypeClass>(type_mask);
556  TypeList type_list;
557  symfile->GetTypes(nullptr, type_class, type_list);
558  sb_type_list.m_opaque_up->Append(type_list);
559  return LLDB_RECORD_RESULT(sb_type_list);
560 }
561 
562 SBSection SBModule::FindSection(const char *sect_name) {
564  sect_name);
565 
566  SBSection sb_section;
567 
568  ModuleSP module_sp(GetSP());
569  if (sect_name && module_sp) {
570  // Give the symbol vendor a chance to add to the unified section list.
571  module_sp->GetSymbolFile();
572  SectionList *section_list = module_sp->GetSectionList();
573  if (section_list) {
574  ConstString const_sect_name(sect_name);
575  SectionSP section_sp(section_list->FindSectionByName(const_sect_name));
576  if (section_sp) {
577  sb_section.SetSP(section_sp);
578  }
579  }
580  }
581  return LLDB_RECORD_RESULT(sb_section);
582 }
583 
586 
587  ModuleSP module_sp(GetSP());
588  if (module_sp)
589  return module_sp->GetArchitecture().GetByteOrder();
590  return eByteOrderInvalid;
591 }
592 
593 const char *SBModule::GetTriple() {
595 
596  ModuleSP module_sp(GetSP());
597  if (module_sp) {
598  std::string triple(module_sp->GetArchitecture().GetTriple().str());
599  // Unique the string so we don't run into ownership issues since the const
600  // strings put the string into the string pool once and the strings never
601  // comes out
602  ConstString const_triple(triple.c_str());
603  return const_triple.GetCString();
604  }
605  return nullptr;
606 }
607 
610 
611  ModuleSP module_sp(GetSP());
612  if (module_sp)
613  return module_sp->GetArchitecture().GetAddressByteSize();
614  return sizeof(void *);
615 }
616 
617 uint32_t SBModule::GetVersion(uint32_t *versions, uint32_t num_versions) {
619  versions, num_versions);
620 
621  llvm::VersionTuple version;
622  if (ModuleSP module_sp = GetSP())
623  version = module_sp->GetVersion();
624  uint32_t result = 0;
625  if (!version.empty())
626  ++result;
627  if (version.getMinor())
628  ++result;
629  if (version.getSubminor())
630  ++result;
631 
632  if (!versions)
633  return result;
634 
635  if (num_versions > 0)
636  versions[0] = version.empty() ? UINT32_MAX : version.getMajor();
637  if (num_versions > 1)
638  versions[1] = version.getMinor().getValueOr(UINT32_MAX);
639  if (num_versions > 2)
640  versions[2] = version.getSubminor().getValueOr(UINT32_MAX);
641  for (uint32_t i = 3; i < num_versions; ++i)
642  versions[i] = UINT32_MAX;
643  return result;
644 }
645 
649 
650  lldb::SBFileSpec sb_file_spec;
651  ModuleSP module_sp(GetSP());
652  if (module_sp) {
653  if (SymbolFile *symfile = module_sp->GetSymbolFile())
654  sb_file_spec.SetFileSpec(symfile->GetObjectFile()->GetFileSpec());
655  }
656  return LLDB_RECORD_RESULT(sb_file_spec);
657 }
658 
662 
663  lldb::SBAddress sb_addr;
664  ModuleSP module_sp(GetSP());
665  if (module_sp) {
666  ObjectFile *objfile_ptr = module_sp->GetObjectFile();
667  if (objfile_ptr)
668  sb_addr.ref() = objfile_ptr->GetBaseAddress();
669  }
670  return LLDB_RECORD_RESULT(sb_addr);
671 }
672 
676 
677  lldb::SBAddress sb_addr;
678  ModuleSP module_sp(GetSP());
679  if (module_sp) {
680  ObjectFile *objfile_ptr = module_sp->GetObjectFile();
681  if (objfile_ptr)
682  sb_addr.ref() = objfile_ptr->GetEntryPointAddress();
683  }
684  return LLDB_RECORD_RESULT(sb_addr);
685 }
686 
690 
691  return Module::GetNumberAllocatedModules();
692 }
693 
697 
698  const bool mandatory = false;
699  ModuleList::RemoveOrphanSharedModules(mandatory);
700 }
701 
702 namespace lldb_private {
703 namespace repro {
704 
705 template <> void RegisterMethods<SBModule>(Registry &R) {
710  LLDB_REGISTER_METHOD(const lldb::SBModule &, SBModule, operator=,
711  (const lldb::SBModule &));
712  LLDB_REGISTER_METHOD_CONST(bool, SBModule, IsValid, ());
713  LLDB_REGISTER_METHOD_CONST(bool, SBModule, operator bool, ());
714  LLDB_REGISTER_METHOD(void, SBModule, Clear, ());
717  ());
718  LLDB_REGISTER_METHOD(bool, SBModule, SetPlatformFileSpec,
719  (const lldb::SBFileSpec &));
720  LLDB_REGISTER_METHOD(lldb::SBFileSpec, SBModule, GetRemoteInstallFileSpec,
721  ());
722  LLDB_REGISTER_METHOD(bool, SBModule, SetRemoteInstallFileSpec,
723  (lldb::SBFileSpec &));
724  LLDB_REGISTER_METHOD_CONST(const char *, SBModule, GetUUIDString, ());
725  LLDB_REGISTER_METHOD_CONST(bool, SBModule, operator==,
726  (const lldb::SBModule &));
727  LLDB_REGISTER_METHOD_CONST(bool, SBModule, operator!=,
728  (const lldb::SBModule &));
729  LLDB_REGISTER_METHOD(lldb::SBAddress, SBModule, ResolveFileAddress,
730  (lldb::addr_t));
732  ResolveSymbolContextForAddress,
733  (const lldb::SBAddress &, uint32_t));
734  LLDB_REGISTER_METHOD(bool, SBModule, GetDescription, (lldb::SBStream &));
735  LLDB_REGISTER_METHOD(uint32_t, SBModule, GetNumCompileUnits, ());
736  LLDB_REGISTER_METHOD(lldb::SBCompileUnit, SBModule, GetCompileUnitAtIndex,
737  (uint32_t));
739  (const lldb::SBFileSpec &));
740  LLDB_REGISTER_METHOD(size_t, SBModule, GetNumSymbols, ());
741  LLDB_REGISTER_METHOD(lldb::SBSymbol, SBModule, GetSymbolAtIndex, (size_t));
743  (const char *, lldb::SymbolType));
745  (const char *, lldb::SymbolType));
746  LLDB_REGISTER_METHOD(size_t, SBModule, GetNumSections, ());
747  LLDB_REGISTER_METHOD(lldb::SBSection, SBModule, GetSectionAtIndex, (size_t));
749  (const char *, uint32_t));
750  LLDB_REGISTER_METHOD(lldb::SBValueList, SBModule, FindGlobalVariables,
751  (lldb::SBTarget &, const char *, uint32_t));
752  LLDB_REGISTER_METHOD(lldb::SBValue, SBModule, FindFirstGlobalVariable,
753  (lldb::SBTarget &, const char *));
754  LLDB_REGISTER_METHOD(lldb::SBType, SBModule, FindFirstType, (const char *));
756  LLDB_REGISTER_METHOD(lldb::SBTypeList, SBModule, FindTypes, (const char *));
759  LLDB_REGISTER_METHOD(lldb::SBSection, SBModule, FindSection, (const char *));
760  LLDB_REGISTER_METHOD(lldb::ByteOrder, SBModule, GetByteOrder, ());
761  LLDB_REGISTER_METHOD(const char *, SBModule, GetTriple, ());
762  LLDB_REGISTER_METHOD(uint32_t, SBModule, GetAddressByteSize, ());
764  LLDB_REGISTER_METHOD_CONST(lldb::SBFileSpec, SBModule, GetSymbolFileSpec, ());
766  GetObjectFileHeaderAddress, ());
768  GetObjectFileEntryPointAddress, ());
769  LLDB_REGISTER_STATIC_METHOD(uint32_t, SBModule, GetNumberAllocatedModules,
770  ());
771  LLDB_REGISTER_STATIC_METHOD(void, SBModule, GarbageCollectAllocatedModules,
772  ());
773 }
774 
775 } // namespace repro
776 } // namespace lldb_private
lldb::SBValueList
Definition: SBValueList.h:18
LLDB_RECORD_STATIC_METHOD_NO_ARGS
#define LLDB_RECORD_STATIC_METHOD_NO_ARGS(Result, Class, Method)
Definition: ReproducerInstrumentation.h:174
lldb_private::SymbolFile
Definition: SymbolFile.h:37
lldb_private::SectionList::FindSectionByName
lldb::SectionSP FindSectionByName(ConstString section_dstr) const
Definition: Section.cpp:484
lldb::SBModuleSpec
Definition: SBModuleSpec.h:17
lldb::SBStream::ref
lldb_private::Stream & ref()
Definition: SBStream.cpp:178
lldb::SBModule::~SBModule
~SBModule()
lldb::SBModule::GetCompileUnitAtIndex
lldb::SBCompileUnit GetCompileUnitAtIndex(uint32_t)
Definition: SBModule.cpp:264
lldb::SBModule::FindFirstType
lldb::SBType FindFirstType(const char *name)
Definition: SBModule.cpp:446
lldb::SBModule::operator!=
bool operator!=(const lldb::SBModule &rhs) const
Definition: SBModule.cpp:197
lldb::SBModule::GetTriple
const char * GetTriple()
Definition: SBModule.cpp:593
SBModule.h
lldb::SBModule::GetByteOrder
lldb::ByteOrder GetByteOrder()
Definition: SBModule.cpp:584
lldb::SBCompileUnit
Definition: SBCompileUnit.h:17
lldb::SBModuleSpec::m_opaque_up
std::unique_ptr< lldb_private::ModuleSpec > m_opaque_up
Definition: SBModuleSpec.h:87
lldb::SBModule::GetTypes
lldb::SBTypeList GetTypes(uint32_t type_mask=lldb::eTypeClassAny)
Get all types matching type_mask from debug info in this module.
Definition: SBModule.cpp:542
LLDB_RECORD_RESULT
#define LLDB_RECORD_RESULT(Result)
Definition: ReproducerInstrumentation.h:211
lldb::SBModule::GetAddressByteSize
uint32_t GetAddressByteSize()
Definition: SBModule.cpp:608
LLDB_RECORD_METHOD_CONST_NO_ARGS
#define LLDB_RECORD_METHOD_CONST_NO_ARGS(Result, Class, Method)
Definition: ReproducerInstrumentation.h:168
SBModuleSpec.h
lldb::SBModule::SBModule
SBModule()
Definition: SBModule.cpp:32
lldb_private::SymbolContextList::Append
void Append(const SymbolContext &sc)
Append a new symbol context to the list.
Definition: SymbolContext.cpp:1188
lldb::SBModule::FindFirstGlobalVariable
lldb::SBValue FindFirstGlobalVariable(lldb::SBTarget &target, const char *name)
Find the first global (or static) variable by name.
Definition: SBModule.cpp:435
lldb_private::SectionList::GetSize
size_t GetSize() const
Definition: Section.h:74
LLDB_RECORD_METHOD_NO_ARGS
#define LLDB_RECORD_METHOD_NO_ARGS(Result, Class, Method)
Definition: ReproducerInstrumentation.h:165
lldb::SBModule::GetSymbolAtIndex
lldb::SBSymbol GetSymbolAtIndex(size_t idx)
Definition: SBModule.cpp:304
lldb::SBValue
Definition: SBValue.h:21
lldb::SBModule::FindSection
lldb::SBSection FindSection(const char *sect_name)
Definition: SBModule.cpp:562
Module.h
lldb::SBSymbol
Definition: SBSymbol.h:19
lldb::SBModule::Clear
void Clear()
Definition: SBModule.cpp:90
lldb::SBSymbolContextList
Definition: SBSymbolContextList.h:17
lldb::SBModule::GetPlatformFileSpec
lldb::SBFileSpec GetPlatformFileSpec() const
Get accessor for the module platform file specification.
Definition: SBModule.cpp:107
LLDB_RECORD_CONSTRUCTOR_NO_ARGS
#define LLDB_RECORD_CONSTRUCTOR_NO_ARGS(Class)
Definition: ReproducerInstrumentation.h:136
lldb_private::SymbolContextList
Definition: SymbolContext.h:379
LLDB_REGISTER_METHOD_CONST
#define LLDB_REGISTER_METHOD_CONST(Result, Class, Method, Signature)
Definition: ReproducerInstrumentation.h:98
lldb_private::SectionList
Definition: Section.h:34
lldb::SBModule::GetBasicType
lldb::SBType GetBasicType(lldb::BasicType type)
Definition: SBModule.cpp:472
lldb::SBProcess
Definition: SBProcess.h:23
lldb_private::Stream
Definition: Stream.h:28
lldb_private::TypeList::GetTypeAtIndex
lldb::TypeSP GetTypeAtIndex(uint32_t idx)
Definition: TypeList.cpp:66
lldb::addr_t
uint64_t addr_t
Definition: lldb-types.h:83
lldb_private::Symtab::SymbolAtIndex
Symbol * SymbolAtIndex(size_t idx)
Definition: Symtab.cpp:210
SBReproducerPrivate.h
lldb::BasicType
BasicType
Basic types enumeration for the public API SBType::GetBasicType().
Definition: lldb-enumerations.h:741
lldb_private::ModuleFunctionSearchOptions::include_symbols
bool include_symbols
Include the symbol table.
Definition: Module.h:64
lldb::SBModule::FindCompileUnits
lldb::SBSymbolContextList FindCompileUnits(const lldb::SBFileSpec &sb_file_spec)
Find compile units related to *this module and passed source file.
Definition: SBModule.cpp:277
LLDB_REGISTER_CONSTRUCTOR
#define LLDB_REGISTER_CONSTRUCTOR(Class, Signature)
Definition: ReproducerInstrumentation.h:89
lldb_private::SymbolContext
Definition: SymbolContext.h:33
lldb_private::Target
Definition: Target.h:451
Section.h
SBSymbolContextList.h
lldb::SBFileSpec::SetFileSpec
void SetFileSpec(const lldb_private::FileSpec &fspec)
Definition: SBFileSpec.cpp:170
lldb::SBModule::GetNumSections
size_t GetNumSections()
Definition: SBModule.cpp:361
lldb_private::Target::GetImages
const ModuleList & GetImages() const
Get accessor for the images for this process.
Definition: Target.h:925
lldb::SBModule::IsValid
bool IsValid() const
Definition: SBModule.cpp:80
lldb_private::VariableList
Definition: VariableList.h:18
lldb_private::ModuleFunctionSearchOptions::include_inlines
bool include_inlines
Include inlined functions.
Definition: Module.h:66
lldb::SBValueList::GetValueAtIndex
lldb::SBValue GetValueAtIndex(uint32_t idx) const
Definition: SBValueList.cpp:152
Target.h
lldb::SBModule::GarbageCollectAllocatedModules
static void GarbageCollectAllocatedModules()
Remove any global modules which are no longer needed.
Definition: SBModule.cpp:694
lldb::SBValueList::IsValid
bool IsValid() const
Definition: SBValueList.cpp:88
lldb::SBTarget
Definition: SBTarget.h:29
lldb_private::Symtab::FindFirstSymbolWithNameAndType
Symbol * FindFirstSymbolWithNameAndType(ConstString name, lldb::SymbolType symbol_type, Debug symbol_debug_type, Visibility symbol_visibility)
Definition: Symtab.cpp:854
lldb_private::FileSpec
Definition: FileSpec.h:56
error
static llvm::raw_ostream & error(Stream &strm)
Definition: CommandReturnObject.cpp:17
lldb_private::SymbolContext::symbol
Symbol * symbol
The Symbol for a given query.
Definition: SymbolContext.h:323
SBStream.h
lldb::SBModule::GetUUIDString
const char * GetUUIDString() const
Definition: SBModule.cpp:168
LLDB_RECORD_METHOD
#define LLDB_RECORD_METHOD(Result, Class, Method, Signature,...)
Definition: ReproducerInstrumentation.h:158
lldb_private::TypeList::Empty
bool Empty() const
Definition: TypeList.h:37
lldb::SBModule::GetRemoteInstallFileSpec
lldb::SBFileSpec GetRemoteInstallFileSpec()
Get accessor for the remote install path for a module.
Definition: SBModule.cpp:134
SBFileSpec.h
lldb::SBModule::SetSP
void SetSP(const ModuleSP &module_sp)
Definition: SBModule.cpp:208
lldb::SBModule::m_opaque_sp
lldb::ModuleSP m_opaque_sp
Definition: SBModule.h:311
GetUnifiedSymbolTable
static Symtab * GetUnifiedSymbolTable(const lldb::ModuleSP &module_sp)
Definition: SBModule.cpp:289
lldb_private::ObjectFile::GetBaseAddress
virtual lldb_private::Address GetBaseAddress()
Returns base address of this object file.
Definition: ObjectFile.h:481
StreamString.h
lldb::SBModule::GetVersion
uint32_t GetVersion(uint32_t *versions, uint32_t num_versions)
Get the module version numbers.
Definition: SBModule.cpp:617
lldb_private::TypeList::GetSize
uint32_t GetSize() const
Definition: TypeList.cpp:60
lldb_private::ConstString
Definition: ConstString.h:40
lldb::SBValueList::Append
void Append(const lldb::SBValue &val_obj)
Definition: SBValueList.cpp:127
lldb::SBFileSpec::ref
const lldb_private::FileSpec & ref() const
Definition: SBFileSpec.cpp:168
lldb::SBFileSpec::IsValid
bool IsValid() const
Definition: SBFileSpec.cpp:79
lldb::SBAddress::IsValid
bool IsValid() const
Definition: SBAddress.cpp:76
lldb::SBModule::GetNumCompileUnits
uint32_t GetNumCompileUnits()
Definition: SBModule.cpp:254
lldb::SBModule::GetNumberAllocatedModules
static uint32_t GetNumberAllocatedModules()
Get the number of global modules.
Definition: SBModule.cpp:687
lldb_private::SectionList::GetSectionAtIndex
lldb::SectionSP GetSectionAtIndex(size_t idx) const
Definition: Section.cpp:476
lldb::SBSection
Definition: SBSection.h:17
LLDB_REGISTER_STATIC_METHOD
#define LLDB_REGISTER_STATIC_METHOD(Result, Class, Method, Signature)
Definition: ReproducerInstrumentation.h:103
string
string(SUBSTRING ${p} 10 -1 pStripped) if($
Definition: Plugins/CMakeLists.txt:40
lldb::SBModule::SBType
friend class SBType
Definition: SBModule.h:303
lldb::SBModule::ResolveSymbolContextForAddress
lldb::SBSymbolContext ResolveSymbolContextForAddress(const lldb::SBAddress &addr, uint32_t resolve_scope)
Definition: SBModule.cpp:225
TypeSystem.h
lldb::SymbolType
SymbolType
Symbol types.
Definition: lldb-enumerations.h:612
lldb::SBTypeList::m_opaque_up
std::unique_ptr< lldb_private::TypeListImpl > m_opaque_up
Definition: SBType.h:262
VariableList.h
lldb_private::CompilerDeclContext
Represents a generic declaration context in a program.
Definition: CompilerDeclContext.h:30
SBAddress.h
lldb::SBModule::GetObjectFileHeaderAddress
lldb::SBAddress GetObjectFileHeaderAddress() const
Definition: SBModule.cpp:659
ObjectFile.h
lldb::SBType
Definition: SBType.h:104
lldb_private::ModuleFunctionSearchOptions
Options used by Module::FindFunctions.
Definition: Module.h:62
lldb::SBModule::GetSectionAtIndex
lldb::SBSection GetSectionAtIndex(size_t idx)
Definition: SBModule.cpp:375
lldb::SBTypeList
Definition: SBType.h:241
LLDB_RECORD_CONSTRUCTOR
#define LLDB_RECORD_CONSTRUCTOR(Class, Signature,...)
Definition: ReproducerInstrumentation.h:133
lldb_private::repro::Registry
The registry contains a unique mapping between functions and their ID.
Definition: ReproducerInstrumentation.h:517
lldb::SBModule::GetObjectFileEntryPointAddress
lldb::SBAddress GetObjectFileEntryPointAddress() const
Definition: SBModule.cpp:673
lldb_private::Status
Definition: Status.h:44
lldb::SBModule::FindSymbols
lldb::SBSymbolContextList FindSymbols(const char *name, lldb::SymbolType type=eSymbolTypeAny)
Definition: SBModule.cpp:332
lldb::SBSymbolContext
Definition: SBSymbolContext.h:22
lldb::SBModule::SetRemoteInstallFileSpec
bool SetRemoteInstallFileSpec(lldb::SBFileSpec &file)
Set accessor for the remote install path for a module.
Definition: SBModule.cpp:145
lldb::eByteOrderInvalid
@ eByteOrderInvalid
Definition: lldb-enumerations.h:139
lldb_private::Symtab
Definition: Symtab.h:22
lldb::SBModule::FindSymbol
lldb::SBSymbol FindSymbol(const char *name, lldb::SymbolType type=eSymbolTypeAny)
Definition: SBModule.cpp:315
uint32_t
lldb::SBProcess::GetSP
lldb::ProcessSP GetSP() const
Definition: SBProcess.cpp:106
lldb::SBModule::ResolveFileAddress
lldb::SBAddress ResolveFileAddress(lldb::addr_t vm_addr)
Definition: SBModule.cpp:210
lldb_private::Address
Definition: Address.h:59
lldb_private::repro::RegisterMethods< SBModule >
void RegisterMethods< SBModule >(Registry &R)
Definition: SBModule.cpp:705
lldb_private::Type
Definition: Type.h:66
lldb::SBModule
Definition: SBModule.h:20
Symtab.h
lldb::SBModule::GetTypeByID
lldb::SBType GetTypeByID(lldb::user_id_t uid)
Get a type using its type ID.
Definition: SBModule.cpp:527
lldb_private::Stream::AsRawOstream
llvm::raw_ostream & AsRawOstream()
Returns a raw_ostream that forwards the data to this Stream object.
Definition: Stream.h:357
UINT32_MAX
#define UINT32_MAX
Definition: lldb-defines.h:31
lldb::SBCompileUnit::reset
void reset(lldb_private::CompileUnit *lldb_object_ptr)
Definition: SBCompileUnit.cpp:223
lldb::SBValue
class LLDB_API SBValue
Definition: SBDefines.h:91
lldb_private::SymbolContext::module_sp
lldb::ModuleSP module_sp
The Module for a given query.
Definition: SymbolContext.h:318
lldb_private::ConstString::GetCString
const char * GetCString() const
Get the string value as a C string.
Definition: ConstString.h:216
lldb::SBModule::GetSP
ModuleSP GetSP() const
Definition: SBModule.cpp:206
lldb::SBFileSpec
Definition: SBFileSpec.h:16
lldb_private::CompilerType
Generic representation of a type in a programming language.
Definition: CompilerType.h:33
lldb::SBAddress
Definition: SBAddress.h:17
lldb::user_id_t
uint64_t user_id_t
Definition: lldb-types.h:84
lldb::SBModule::FindGlobalVariables
lldb::SBValueList FindGlobalVariables(lldb::SBTarget &target, const char *name, uint32_t max_matches)
Find global and static variables by name.
Definition: SBModule.cpp:411
lldb::eLanguageTypeC
@ eLanguageTypeC
Non-standardized C, such as K&R.
Definition: lldb-enumerations.h:439
lldb::SBAddress::ref
lldb_private::Address & ref()
Definition: SBAddress.cpp:180
lldb::SBModule::GetUUIDBytes
const uint8_t * GetUUIDBytes() const
Definition: SBModule.cpp:157
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb::SBModule::FindFunctions
lldb::SBSymbolContextList FindFunctions(const char *name, uint32_t name_type_mask=lldb::eFunctionNameTypeAny)
Find functions by name.
Definition: SBModule.cpp:392
lldb_private::TypeList
Definition: TypeList.h:20
lldb_private::Symtab::FindAllSymbolsWithNameAndType
void FindAllSymbolsWithNameAndType(ConstString name, lldb::SymbolType symbol_type, std::vector< uint32_t > &symbol_indexes)
Definition: Symtab.cpp:807
lldb::SBTarget::GetSP
lldb::TargetSP GetSP() const
Definition: SBTarget.cpp:605
lldb::SBSymbol::SetSymbol
void SetSymbol(lldb_private::Symbol *lldb_object_ptr)
Definition: SBSymbol.cpp:40
SBProcess.h
lldb::SBModule::operator=
const SBModule & operator=(const SBModule &rhs)
Definition: SBModule.cpp:69
ValueObjectVariable.h
lldb_private::SymbolFile::GetTypes
virtual void GetTypes(lldb_private::SymbolContextScope *sc_scope, lldb::TypeClass type_mask, lldb_private::TypeList &type_list)=0
lldb::SBTypeList::Append
void Append(lldb::SBType type)
Definition: SBType.cpp:628
lldb_private::Stream::PutCString
size_t PutCString(llvm::StringRef cstr)
Output a C string to the stream.
Definition: Stream.cpp:63
lldb::SBType::IsValid
bool IsValid() const
Definition: SBType.cpp:109
lldb::SBStream
Definition: SBStream.h:18
lldb::SBModule::GetDescription
bool GetDescription(lldb::SBStream &description)
Definition: SBModule.cpp:239
LLDB_RECORD_METHOD_CONST
#define LLDB_RECORD_METHOD_CONST(Result, Class, Method, Signature,...)
Definition: ReproducerInstrumentation.h:161
lldb::SBValueList::GetSize
uint32_t GetSize() const
Definition: SBValueList.cpp:164
lldb
Definition: SBAddress.h:15
lldb::SBModule::GetSymbolFileSpec
lldb::SBFileSpec GetSymbolFileSpec() const
Get accessor for the symbol file specification.
Definition: SBModule.cpp:646
lldb::SBSection::SetSP
void SetSP(const lldb::SectionSP &section_sp)
Definition: SBSection.cpp:120
ValueObjectList.h
lldb::SBModule::GetNumSymbols
size_t GetNumSymbols()
Definition: SBModule.cpp:295
lldb::SBModule::operator==
bool operator==(const lldb::SBModule &rhs) const
Definition: SBModule.cpp:188
lldb::SBModule::FindTypes
lldb::SBTypeList FindTypes(const char *type)
Definition: SBModule.cpp:490
SymbolFile.h
lldb::SBModule::SetPlatformFileSpec
bool SetPlatformFileSpec(const lldb::SBFileSpec &platform_file)
Definition: SBModule.cpp:119
lldb_private::ObjectFile::GetEntryPointAddress
virtual lldb_private::Address GetEntryPointAddress()
Returns the address of the Entry Point in this object file - if the object file doesn't have an entry...
Definition: ObjectFile.h:471
lldb_private::ObjectFile
Definition: ObjectFile.h:58
lldb_private::ModuleList::Append
void Append(const lldb::ModuleSP &module_sp, bool notify=true)
Append a module to the module list.
lldb::SBModule::GetFileSpec
lldb::SBFileSpec GetFileSpec() const
Get const accessor for the module file specification.
Definition: SBModule.cpp:96
lldb::ByteOrder
ByteOrder
Byte ordering definitions.
Definition: lldb-enumerations.h:138
LLDB_REGISTER_METHOD
#define LLDB_REGISTER_METHOD(Result, Class, Method, Signature)
Definition: ReproducerInstrumentation.h:93