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 "lldb/API/SBAddress.h"
11#include "lldb/API/SBFileSpec.h"
13#include "lldb/API/SBProcess.h"
14#include "lldb/API/SBStream.h"
16#include "lldb/Core/Module.h"
17#include "lldb/Core/Section.h"
20#include "lldb/Symbol/Symtab.h"
23#include "lldb/Target/Target.h"
29
30using namespace lldb;
31using namespace lldb_private;
32
34
35SBModule::SBModule(const lldb::ModuleSP &module_sp) : m_opaque_sp(module_sp) {}
36
37SBModule::SBModule(const SBModuleSpec &module_spec) {
38 LLDB_INSTRUMENT_VA(this, module_spec);
39
40 ModuleSP module_sp;
42 module_sp, nullptr, nullptr);
43 if (module_sp)
44 SetSP(module_sp);
45}
46
50
52 LLDB_INSTRUMENT_VA(this, process, header_addr);
53
54 ProcessSP process_sp(process.GetSP());
55 if (process_sp) {
56 llvm::Expected<ModuleSP> module_sp_or_err =
57 process_sp->ReadModuleFromMemory(FileSpec(), header_addr);
58 if (auto err = module_sp_or_err.takeError()) {
59 llvm::consumeError(std::move(err));
60 return;
61 }
62
63 m_opaque_sp = *module_sp_or_err;
64 if (m_opaque_sp) {
65 Target &target = process_sp->GetTarget();
66 bool changed = false;
67 m_opaque_sp->SetLoadAddress(target, 0, true, changed);
69 }
70 }
71}
72
74 LLDB_INSTRUMENT_VA(this, rhs);
75
76 if (this != &rhs)
78 return *this;
79}
80
81SBModule::~SBModule() = default;
82
83bool SBModule::IsValid() const {
85 return this->operator bool();
86}
87SBModule::operator bool() const {
89
90 return m_opaque_sp.get() != nullptr;
91}
92
95
96 m_opaque_sp.reset();
97}
98
100 LLDB_INSTRUMENT_VA(this);
101
102 ModuleSP module_sp(GetSP());
103 if (!module_sp)
104 return false;
105
106 ObjectFile *obj_file = module_sp->GetObjectFile();
107 if (!obj_file)
108 return false;
109
110 return !obj_file->IsInMemory();
111}
112
114 LLDB_INSTRUMENT_VA(this);
115
116 SBFileSpec file_spec;
117 ModuleSP module_sp(GetSP());
118 if (module_sp)
119 file_spec.SetFileSpec(module_sp->GetFileSpec());
120
121 return file_spec;
122}
123
125 LLDB_INSTRUMENT_VA(this);
126
127 SBFileSpec file_spec;
128 ModuleSP module_sp(GetSP());
129 if (module_sp)
130 file_spec.SetFileSpec(module_sp->GetPlatformFileSpec());
131
132 return file_spec;
133}
134
136 LLDB_INSTRUMENT_VA(this, platform_file);
137
138 bool result = false;
139
140 ModuleSP module_sp(GetSP());
141 if (module_sp) {
142 module_sp->SetPlatformFileSpec(*platform_file);
143 result = true;
144 }
145
146 return result;
147}
148
150 LLDB_INSTRUMENT_VA(this);
151
152 SBFileSpec sb_file_spec;
153 ModuleSP module_sp(GetSP());
154 if (module_sp)
155 sb_file_spec.SetFileSpec(module_sp->GetRemoteInstallFileSpec());
156 return sb_file_spec;
157}
158
160 LLDB_INSTRUMENT_VA(this, file);
161
162 ModuleSP module_sp(GetSP());
163 if (module_sp) {
164 module_sp->SetRemoteInstallFileSpec(file.ref());
165 return true;
166 }
167 return false;
168}
169
170const uint8_t *SBModule::GetUUIDBytes() const {
171 LLDB_INSTRUMENT_VA(this);
172
173 const uint8_t *uuid_bytes = nullptr;
174 ModuleSP module_sp(GetSP());
175 if (module_sp)
176 uuid_bytes = module_sp->GetUUID().GetBytes().data();
177
178 return uuid_bytes;
179}
180
181const char *SBModule::GetUUIDString() const {
182 LLDB_INSTRUMENT_VA(this);
183
184 ModuleSP module_sp(GetSP());
185 if (!module_sp)
186 return nullptr;
187
188 // We are going to return a "const char *" value through the public API, so
189 // we need to constify it so it gets added permanently the string pool and
190 // then we don't need to worry about the lifetime of the string as it will
191 // never go away once it has been put into the ConstString string pool
192 const char *uuid_cstr =
193 StringPool::GetSystemPool().Intern(module_sp->GetUUID().GetAsString());
194 // Note: SBModule::GetUUIDString's expected behavior is to return nullptr if
195 // the string we get is empty, so we must perform this check before returning.
196 if (uuid_cstr && uuid_cstr[0])
197 return uuid_cstr;
198 return nullptr;
199}
200
201bool SBModule::operator==(const SBModule &rhs) const {
202 LLDB_INSTRUMENT_VA(this, rhs);
203
204 if (m_opaque_sp)
205 return m_opaque_sp.get() == rhs.m_opaque_sp.get();
206 return false;
207}
208
209bool SBModule::operator!=(const SBModule &rhs) const {
210 LLDB_INSTRUMENT_VA(this, rhs);
211
212 if (m_opaque_sp)
213 return m_opaque_sp.get() != rhs.m_opaque_sp.get();
214 return false;
215}
216
218
219void SBModule::SetSP(const ModuleSP &module_sp) { m_opaque_sp = module_sp; }
220
222 LLDB_INSTRUMENT_VA(this, vm_addr);
223
224 lldb::SBAddress sb_addr;
225 ModuleSP module_sp(GetSP());
226 if (module_sp) {
227 Address addr;
228 if (module_sp->ResolveFileAddress(vm_addr, addr))
229 sb_addr.ref() = addr;
230 }
231 return sb_addr;
232}
233
236 uint32_t resolve_scope) {
237 LLDB_INSTRUMENT_VA(this, addr, resolve_scope);
238
239 SBSymbolContext sb_sc;
240 ModuleSP module_sp(GetSP());
241 SymbolContextItem scope = static_cast<SymbolContextItem>(resolve_scope);
242 if (module_sp && addr.IsValid())
243 module_sp->ResolveSymbolContextForAddress(addr.ref(), scope, *sb_sc);
244 return sb_sc;
245}
246
248 LLDB_INSTRUMENT_VA(this, description);
249
250 Stream &strm = description.ref();
251
252 ModuleSP module_sp(GetSP());
253 if (module_sp) {
254 module_sp->GetDescription(strm.AsRawOstream());
255 } else
256 strm.PutCString("No value");
257
258 return true;
259}
260
262 LLDB_INSTRUMENT_VA(this);
263
264 ModuleSP module_sp(GetSP());
265 if (module_sp) {
266 return module_sp->GetNumCompileUnits();
267 }
268 return 0;
269}
270
272 LLDB_INSTRUMENT_VA(this, index);
273
274 SBCompileUnit sb_cu;
275 ModuleSP module_sp(GetSP());
276 if (module_sp) {
277 CompUnitSP cu_sp = module_sp->GetCompileUnitAtIndex(index);
278 sb_cu.reset(cu_sp.get());
279 }
280 return sb_cu;
281}
282
284 LLDB_INSTRUMENT_VA(this, sb_file_spec);
285
286 SBSymbolContextList sb_sc_list;
287 const ModuleSP module_sp(GetSP());
288 if (sb_file_spec.IsValid() && module_sp) {
289 module_sp->FindCompileUnits(*sb_file_spec, *sb_sc_list);
290 }
291 return sb_sc_list;
292}
293
294static Symtab *GetUnifiedSymbolTable(const lldb::ModuleSP &module_sp) {
295 if (module_sp)
296 return module_sp->GetSymtab();
297 return nullptr;
298}
299
301 LLDB_INSTRUMENT_VA(this);
302
303 ModuleSP module_sp(GetSP());
304 if (Symtab *symtab = GetUnifiedSymbolTable(module_sp))
305 return symtab->GetNumSymbols();
306 return 0;
307}
308
310 LLDB_INSTRUMENT_VA(this, idx);
311
312 SBSymbol sb_symbol;
313 ModuleSP module_sp(GetSP());
314 Symtab *symtab = GetUnifiedSymbolTable(module_sp);
315 if (symtab)
316 sb_symbol.SetSymbol(symtab->SymbolAtIndex(idx));
317 return sb_symbol;
318}
319
321 lldb::SymbolType symbol_type) {
322 LLDB_INSTRUMENT_VA(this, name, symbol_type);
323
324 SBSymbol sb_symbol;
325 if (name && name[0]) {
326 ModuleSP module_sp(GetSP());
327 Symtab *symtab = GetUnifiedSymbolTable(module_sp);
328 if (symtab)
330 ConstString(name), symbol_type, Symtab::eDebugAny,
332 }
333 return sb_symbol;
334}
335
337 lldb::SymbolType symbol_type) {
338 LLDB_INSTRUMENT_VA(this, name, symbol_type);
339
340 SBSymbolContextList sb_sc_list;
341 if (name && name[0]) {
342 ModuleSP module_sp(GetSP());
343 Symtab *symtab = GetUnifiedSymbolTable(module_sp);
344 if (symtab) {
345 std::vector<uint32_t> matching_symbol_indexes;
346 symtab->FindAllSymbolsWithNameAndType(ConstString(name), symbol_type,
347 matching_symbol_indexes);
348 const size_t num_matches = matching_symbol_indexes.size();
349 if (num_matches) {
350 SymbolContext sc;
351 sc.module_sp = module_sp;
352 SymbolContextList &sc_list = *sb_sc_list;
353 for (size_t i = 0; i < num_matches; ++i) {
354 sc.symbol = symtab->SymbolAtIndex(matching_symbol_indexes[i]);
355 if (sc.symbol)
356 sc_list.Append(sc);
357 }
358 }
359 }
360 }
361 return sb_sc_list;
362}
363
365 LLDB_INSTRUMENT_VA(this);
366
367 ModuleSP module_sp(GetSP());
368 if (module_sp) {
369 // Give the symbol vendor a chance to add to the unified section list.
370 module_sp->GetSymbolFile();
371 SectionList *section_list = module_sp->GetSectionList();
372 if (section_list)
373 return section_list->GetSize();
374 }
375 return 0;
376}
377
379 LLDB_INSTRUMENT_VA(this, idx);
380
381 SBSection sb_section;
382 ModuleSP module_sp(GetSP());
383 if (module_sp) {
384 // Give the symbol vendor a chance to add to the unified section list.
385 module_sp->GetSymbolFile();
386 SectionList *section_list = module_sp->GetSectionList();
387
388 if (section_list)
389 sb_section.SetSP(section_list->GetSectionAtIndex(idx));
390 }
391 return sb_section;
392}
393
395 uint32_t name_type_mask) {
396 LLDB_INSTRUMENT_VA(this, name, name_type_mask);
397
398 lldb::SBSymbolContextList sb_sc_list;
399 ModuleSP module_sp(GetSP());
400 if (name && module_sp) {
401
402 ModuleFunctionSearchOptions function_options;
403 function_options.include_symbols = true;
404 function_options.include_inlines = true;
405 FunctionNameType type = static_cast<FunctionNameType>(name_type_mask);
406 module_sp->FindFunctions(ConstString(name), CompilerDeclContext(), type,
407 function_options, *sb_sc_list);
408 }
409 return sb_sc_list;
410}
411
413 uint32_t max_matches) {
414 LLDB_INSTRUMENT_VA(this, target, name, max_matches);
415
416 SBValueList sb_value_list;
417 ModuleSP module_sp(GetSP());
418 if (name && module_sp) {
419 VariableList variable_list;
420 module_sp->FindGlobalVariables(ConstString(name), CompilerDeclContext(),
421 max_matches, variable_list);
422 for (const VariableSP &var_sp : variable_list) {
423 lldb::ValueObjectSP valobj_sp;
424 TargetSP target_sp(target.GetSP());
425 valobj_sp = ValueObjectVariable::Create(target_sp.get(), var_sp);
426 if (valobj_sp)
427 sb_value_list.Append(SBValue(valobj_sp));
428 }
429 }
430
431 return sb_value_list;
432}
433
435 const char *name) {
436 LLDB_INSTRUMENT_VA(this, target, name);
437
438 SBValueList sb_value_list(FindGlobalVariables(target, name, 1));
439 if (sb_value_list.IsValid() && sb_value_list.GetSize() > 0)
440 return sb_value_list.GetValueAtIndex(0);
441 return SBValue();
442}
443
444lldb::SBType SBModule::FindFirstType(const char *name_cstr) {
445 LLDB_INSTRUMENT_VA(this, name_cstr);
446
447 ModuleSP module_sp(GetSP());
448 if (name_cstr && module_sp) {
449 ConstString name(name_cstr);
450 TypeQuery query(name.GetStringRef(), TypeQueryOptions::e_find_one);
451 TypeResults results;
452 module_sp->FindTypes(query, results);
453 TypeSP type_sp = results.GetFirstType();
454 if (type_sp)
455 return SBType(type_sp);
456
457 auto type_system_or_err =
458 module_sp->GetTypeSystemForLanguage(eLanguageTypeC);
459 if (auto err = type_system_or_err.takeError()) {
460 llvm::consumeError(std::move(err));
461 return {};
462 }
463
464 if (auto ts = *type_system_or_err)
465 return SBType(ts->GetBuiltinTypeByName(name));
466 }
467 return {};
468}
469
471 LLDB_INSTRUMENT_VA(this, type);
472
473 ModuleSP module_sp(GetSP());
474 if (module_sp) {
475 auto type_system_or_err =
476 module_sp->GetTypeSystemForLanguage(eLanguageTypeC);
477 if (auto err = type_system_or_err.takeError()) {
478 llvm::consumeError(std::move(err));
479 } else {
480 if (auto ts = *type_system_or_err)
481 return SBType(ts->GetBasicTypeFromAST(type));
482 }
483 }
484 return SBType();
485}
486
488 LLDB_INSTRUMENT_VA(this, type);
489
490 SBTypeList retval;
491
492 ModuleSP module_sp(GetSP());
493 if (type && module_sp) {
494 TypeList type_list;
495 TypeQuery query(type);
496 TypeResults results;
497 module_sp->FindTypes(query, results);
498 if (results.GetTypeMap().Empty()) {
499 ConstString name(type);
500 auto type_system_or_err =
501 module_sp->GetTypeSystemForLanguage(eLanguageTypeC);
502 if (auto err = type_system_or_err.takeError()) {
503 llvm::consumeError(std::move(err));
504 } else {
505 if (auto ts = *type_system_or_err)
506 if (CompilerType compiler_type = ts->GetBuiltinTypeByName(name))
507 retval.Append(SBType(compiler_type));
508 }
509 } else {
510 for (const TypeSP &type_sp : results.GetTypeMap().Types())
511 retval.Append(SBType(type_sp));
512 }
513 }
514 return retval;
515}
516
518 LLDB_INSTRUMENT_VA(this, uid);
519
520 ModuleSP module_sp(GetSP());
521 if (module_sp) {
522 if (SymbolFile *symfile = module_sp->GetSymbolFile()) {
523 Type *type_ptr = symfile->ResolveTypeUID(uid);
524 if (type_ptr)
525 return SBType(type_ptr->shared_from_this());
526 }
527 }
528 return SBType();
529}
530
532 LLDB_INSTRUMENT_VA(this, type_mask);
533
534 SBTypeList sb_type_list;
535
536 ModuleSP module_sp(GetSP());
537 if (!module_sp)
538 return sb_type_list;
539 SymbolFile *symfile = module_sp->GetSymbolFile();
540 if (!symfile)
541 return sb_type_list;
542
543 TypeClass type_class = static_cast<TypeClass>(type_mask);
544 TypeList type_list;
545 symfile->GetTypes(nullptr, type_class, type_list);
546 sb_type_list.m_opaque_up->Append(type_list);
547 return sb_type_list;
548}
549
550SBSection SBModule::FindSection(const char *sect_name) {
551 LLDB_INSTRUMENT_VA(this, sect_name);
552
553 SBSection sb_section;
554
555 ModuleSP module_sp(GetSP());
556 if (sect_name && module_sp) {
557 // Give the symbol vendor a chance to add to the unified section list.
558 module_sp->GetSymbolFile();
559 SectionList *section_list = module_sp->GetSectionList();
560 if (section_list) {
561 SectionSP section_sp(section_list->FindSectionByName(sect_name));
562 if (section_sp) {
563 sb_section.SetSP(section_sp);
564 }
565 }
566 }
567 return sb_section;
568}
569
571 LLDB_INSTRUMENT_VA(this);
572
573 ModuleSP module_sp(GetSP());
574 if (module_sp)
575 return module_sp->GetArchitecture().GetByteOrder();
576 return eByteOrderInvalid;
577}
578
579const char *SBModule::GetTriple() {
580 LLDB_INSTRUMENT_VA(this);
581
582 ModuleSP module_sp(GetSP());
583 if (!module_sp)
584 return nullptr;
585
586 std::string triple(module_sp->GetArchitecture().GetTriple().str());
587 // Unique the string so we don't run into ownership issues since the const
588 // strings put the string into the string pool once and the strings never
589 // comes out
590 ConstString const_triple(triple);
591 return const_triple.GetCString();
592}
593
595 LLDB_INSTRUMENT_VA(this);
596
597 ModuleSP module_sp(GetSP());
598 if (module_sp)
599 return module_sp->GetArchitecture().GetAddressByteSize();
600 return sizeof(void *);
601}
602
603uint32_t SBModule::GetVersion(uint32_t *versions, uint32_t num_versions) {
604 LLDB_INSTRUMENT_VA(this, versions, num_versions);
605
606 llvm::VersionTuple version;
607 if (ModuleSP module_sp = GetSP())
608 version = module_sp->GetVersion();
609 uint32_t result = 0;
610 if (!version.empty())
611 ++result;
612 if (version.getMinor())
613 ++result;
614 if (version.getSubminor())
615 ++result;
616
617 if (!versions)
618 return result;
619
620 if (num_versions > 0)
621 versions[0] = version.empty() ? UINT32_MAX : version.getMajor();
622 if (num_versions > 1)
623 versions[1] = version.getMinor().value_or(UINT32_MAX);
624 if (num_versions > 2)
625 versions[2] = version.getSubminor().value_or(UINT32_MAX);
626 for (uint32_t i = 3; i < num_versions; ++i)
627 versions[i] = UINT32_MAX;
628 return result;
629}
630
632 LLDB_INSTRUMENT_VA(this);
633
634 lldb::SBFileSpec sb_file_spec;
635 ModuleSP module_sp(GetSP());
636 if (module_sp) {
637 if (SymbolFile *symfile = module_sp->GetSymbolFile())
638 sb_file_spec.SetFileSpec(symfile->GetObjectFile()->GetFileSpec());
639 }
640 return sb_file_spec;
641}
642
644 LLDB_INSTRUMENT_VA(this);
645 ModuleSP module_sp(GetSP());
646 if (module_sp)
647 return lldb::SBModuleSpecList(module_sp->GetSeparateDebugInfoFiles());
648
649 return lldb::SBModuleSpecList();
650}
651
653 LLDB_INSTRUMENT_VA(this);
654
655 lldb::SBAddress sb_addr;
656 ModuleSP module_sp(GetSP());
657 if (module_sp) {
658 ObjectFile *objfile_ptr = module_sp->GetObjectFile();
659 if (objfile_ptr)
660 sb_addr.ref() = objfile_ptr->GetBaseAddress();
661 }
662 return sb_addr;
663}
664
666 LLDB_INSTRUMENT_VA(this);
667
668 lldb::SBAddress sb_addr;
669 ModuleSP module_sp(GetSP());
670 if (module_sp) {
671 ObjectFile *objfile_ptr = module_sp->GetObjectFile();
672 if (objfile_ptr)
673 sb_addr.ref() = objfile_ptr->GetEntryPointAddress();
674 }
675 return sb_addr;
676}
677
683
686
687 const bool mandatory = false;
689}
690
691const char *SBModule::GetObjectName() const {
692 LLDB_INSTRUMENT_VA(this);
693
694 if (!m_opaque_sp)
695 return nullptr;
696 return m_opaque_sp->GetObjectName().AsCString(nullptr);
697}
static llvm::raw_ostream & error(Stream &strm)
#define LLDB_INSTRUMENT()
#define LLDB_INSTRUMENT_VA(...)
static Symtab * GetUnifiedSymbolTable(const lldb::ModuleSP &module_sp)
Definition SBModule.cpp:294
lldb_private::Address & ref()
bool IsValid() const
Definition SBAddress.cpp:74
void reset(lldb_private::CompileUnit *lldb_object_ptr)
void SetFileSpec(const lldb_private::FileSpec &fspec)
bool IsValid() const
const lldb_private::FileSpec & ref() const
std::unique_ptr< lldb_private::ModuleSpec > m_opaque_up
bool GetDescription(lldb::SBStream &description)
Definition SBModule.cpp:247
const char * GetTriple()
Definition SBModule.cpp:579
lldb::SBTypeList GetTypes(uint32_t type_mask=lldb::eTypeClassAny)
Get all types matching type_mask from debug info in this module.
Definition SBModule.cpp:531
size_t GetNumSections()
Definition SBModule.cpp:364
lldb::SBValue FindFirstGlobalVariable(lldb::SBTarget &target, const char *name)
Find the first global (or static) variable by name.
Definition SBModule.cpp:434
void SetSP(const ModuleSP &module_sp)
Definition SBModule.cpp:219
lldb::SBType FindFirstType(const char *name)
Definition SBModule.cpp:444
lldb::SBAddress GetObjectFileEntryPointAddress() const
Definition SBModule.cpp:665
uint32_t GetAddressByteSize()
Definition SBModule.cpp:594
uint32_t GetNumCompileUnits()
Definition SBModule.cpp:261
lldb::SBTypeList FindTypes(const char *type)
Definition SBModule.cpp:487
lldb::SBValueList FindGlobalVariables(lldb::SBTarget &target, const char *name, uint32_t max_matches)
Find global and static variables by name.
Definition SBModule.cpp:412
static void GarbageCollectAllocatedModules()
Remove any global modules which are no longer needed.
Definition SBModule.cpp:684
static uint32_t GetNumberAllocatedModules()
Get the number of global modules.
Definition SBModule.cpp:678
lldb::SBFileSpec GetSymbolFileSpec() const
Get accessor for the symbol file specification.
Definition SBModule.cpp:631
friend class SBTarget
Definition SBModule.h:330
lldb::SBSymbol GetSymbolAtIndex(size_t idx)
Definition SBModule.cpp:309
lldb::ModuleSP m_opaque_sp
Definition SBModule.h:341
lldb::SBSymbol FindSymbol(const char *name, lldb::SymbolType type=eSymbolTypeAny)
Definition SBModule.cpp:320
lldb::SBAddress ResolveFileAddress(lldb::addr_t vm_addr)
Definition SBModule.cpp:221
bool IsFileBacked() const
Definition SBModule.cpp:99
friend class SBSymbolContext
Definition SBModule.h:328
friend class SBAddress
Definition SBModule.h:325
const uint8_t * GetUUIDBytes() const
Definition SBModule.cpp:170
lldb::SBFileSpec GetRemoteInstallFileSpec()
Get accessor for the remote install path for a module.
Definition SBModule.cpp:149
lldb::SBModuleSpecList GetSeparateDebugInfoFiles()
Get the separate debug info files for this module.
Definition SBModule.cpp:643
uint32_t GetVersion(uint32_t *versions, uint32_t num_versions)
Get the module version numbers.
Definition SBModule.cpp:603
lldb::SBType GetTypeByID(lldb::user_id_t uid)
Get a type using its type ID.
Definition SBModule.cpp:517
lldb::SBSection FindSection(const char *sect_name)
Definition SBModule.cpp:550
lldb::SBCompileUnit GetCompileUnitAtIndex(uint32_t)
Definition SBModule.cpp:271
lldb::SBSection GetSectionAtIndex(size_t idx)
Definition SBModule.cpp:378
lldb::SBSymbolContextList FindSymbols(const char *name, lldb::SymbolType type=eSymbolTypeAny)
Definition SBModule.cpp:336
bool SetRemoteInstallFileSpec(lldb::SBFileSpec &file)
Set accessor for the remote install path for a module.
Definition SBModule.cpp:159
size_t GetNumSymbols()
Definition SBModule.cpp:300
const char * GetObjectName() const
If this Module represents a specific object or part within a larger file, returns the name of that ob...
Definition SBModule.cpp:691
bool operator==(const lldb::SBModule &rhs) const
Definition SBModule.cpp:201
lldb::SBSymbolContextList FindFunctions(const char *name, uint32_t name_type_mask=lldb::eFunctionNameTypeAny)
Find functions by name.
Definition SBModule.cpp:394
lldb::SBAddress GetObjectFileHeaderAddress() const
Definition SBModule.cpp:652
lldb::SBFileSpec GetFileSpec() const
Get const accessor for the module file specification.
Definition SBModule.cpp:113
lldb::SBSymbolContextList FindCompileUnits(const lldb::SBFileSpec &sb_file_spec)
Find compile units related to *this module and passed source file.
Definition SBModule.cpp:283
lldb::ByteOrder GetByteOrder()
Definition SBModule.cpp:570
const SBModule & operator=(const SBModule &rhs)
Definition SBModule.cpp:73
ModuleSP GetSP() const
Definition SBModule.cpp:217
bool operator!=(const lldb::SBModule &rhs) const
Definition SBModule.cpp:209
const char * GetUUIDString() const
Definition SBModule.cpp:181
friend class SBSection
Definition SBModule.h:327
lldb::SBFileSpec GetPlatformFileSpec() const
Get accessor for the module platform file specification.
Definition SBModule.cpp:124
bool IsValid() const
Definition SBModule.cpp:83
lldb::SBSymbolContext ResolveSymbolContextForAddress(const lldb::SBAddress &addr, uint32_t resolve_scope)
Definition SBModule.cpp:235
bool SetPlatformFileSpec(const lldb::SBFileSpec &platform_file)
Definition SBModule.cpp:135
friend class SBType
Definition SBModule.h:331
lldb::SBType GetBasicType(lldb::BasicType type)
Definition SBModule.cpp:470
lldb::ProcessSP GetSP() const
void SetSP(const lldb::SectionSP &section_sp)
lldb_private::Stream & ref()
Definition SBStream.cpp:179
void SetSymbol(lldb_private::Symbol *lldb_object_ptr)
Definition SBSymbol.cpp:39
lldb::TargetSP GetSP() const
Definition SBTarget.cpp:600
std::unique_ptr< lldb_private::TypeListImpl > m_opaque_up
Definition SBType.h:318
void Append(lldb::SBType type)
Definition SBType.cpp:768
bool IsValid() const
void Append(const lldb::SBValue &val_obj)
lldb::SBValue GetValueAtIndex(uint32_t idx) const
uint32_t GetSize() const
A section + offset based address class.
Definition Address.h:62
Represents a generic declaration context in a program.
Generic representation of a type in a programming language.
A uniqued constant string class.
Definition ConstString.h:40
llvm::StringRef GetStringRef() const
Get the string value as a llvm::StringRef.
const char * GetCString() const
Get the string value as a C string.
A file utility class.
Definition FileSpec.h:56
static Status GetSharedModule(const ModuleSpec &module_spec, lldb::ModuleSP &module_sp, llvm::SmallVectorImpl< lldb::ModuleSP > *old_modules, bool *did_create_ptr, bool invoke_locate_callback=true, bool invoke_symbol_locators=true)
void Append(const lldb::ModuleSP &module_sp, bool notify=true)
Append a module to the module list.
static size_t RemoveOrphanSharedModules(bool mandatory)
static size_t GetNumberAllocatedModules()
Definition Module.cpp:114
A plug-in interface definition class for object file parsers.
Definition ObjectFile.h:46
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:458
bool IsInMemory() const
Returns true if the object file exists only in memory.
Definition ObjectFile.h:691
virtual lldb_private::Address GetBaseAddress()
Returns base address of this object file.
Definition ObjectFile.h:468
size_t GetSize() const
Definition Section.h:76
lldb::SectionSP FindSectionByName(llvm::StringRef section_name) const
Definition Section.cpp:562
lldb::SectionSP GetSectionAtIndex(size_t idx) const
Definition Section.cpp:555
An error handling class.
Definition Status.h:118
A stream class that can stream formatted output to a file.
Definition Stream.h:28
llvm::raw_ostream & AsRawOstream()
Returns a raw_ostream that forwards the data to this Stream object.
Definition Stream.h:405
size_t PutCString(llvm::StringRef cstr)
Output a C string to the stream.
Definition Stream.cpp:63
const char * Intern(llvm::StringRef str) const
Definition StringPool.h:78
static StringPoolRef GetSystemPool()
The system pool. Only valid between Initialize and Terminate.
Defines a list of symbol context objects.
void Append(const SymbolContext &sc)
Append a new symbol context to the list.
Defines a symbol context baton that can be handed other debug core functions.
lldb::ModuleSP module_sp
The Module for a given query.
Symbol * symbol
The Symbol for a given query.
Provides public interface for all SymbolFiles.
Definition SymbolFile.h:51
virtual void GetTypes(lldb_private::SymbolContextScope *sc_scope, lldb::TypeClass type_mask, lldb_private::TypeList &type_list)=0
Symbol * SymbolAtIndex(size_t idx)
Definition Symtab.cpp:225
Symbol * FindFirstSymbolWithNameAndType(ConstString name, lldb::SymbolType symbol_type, Debug symbol_debug_type, Visibility symbol_visibility)
Definition Symtab.cpp:860
void FindAllSymbolsWithNameAndType(ConstString name, lldb::SymbolType symbol_type, std::vector< uint32_t > &symbol_indexes)
Definition Symtab.cpp:814
const ModuleList & GetImages() const
Get accessor for the images for this process.
Definition Target.h:1279
TypeIterable Types() const
Definition TypeMap.h:48
bool Empty() const
Definition TypeMap.cpp:53
A class that contains all state required for type lookups.
Definition Type.h:104
This class tracks the state and results of a TypeQuery.
Definition Type.h:344
TypeMap & GetTypeMap()
Definition Type.h:386
lldb::TypeSP GetFirstType() const
Definition Type.h:385
static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope, const lldb::VariableSP &var_sp)
#define UINT32_MAX
A class that represents a running process on the host machine.
BasicType
Basic types enumeration for the public API SBType::GetBasicType().
std::shared_ptr< lldb_private::ValueObject > ValueObjectSP
@ eLanguageTypeC
Non-standardized C, such as K&R.
class LLDB_API SBModuleSpecList
Definition SBDefines.h:93
std::shared_ptr< lldb_private::Type > TypeSP
std::shared_ptr< lldb_private::Process > ProcessSP
SymbolType
Symbol types.
ByteOrder
Byte ordering definitions.
std::shared_ptr< lldb_private::Variable > VariableSP
uint64_t user_id_t
Definition lldb-types.h:83
std::shared_ptr< lldb_private::Section > SectionSP
uint64_t addr_t
Definition lldb-types.h:80
std::shared_ptr< lldb_private::Target > TargetSP
class LLDB_API SBValue
Definition SBDefines.h:137
std::shared_ptr< lldb_private::Module > ModuleSP
std::shared_ptr< lldb_private::CompileUnit > CompUnitSP
Options used by Module::FindFunctions.
Definition Module.h:67
bool include_inlines
Include inlined functions.
Definition Module.h:71
bool include_symbols
Include the symbol table.
Definition Module.h:69