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
309uint32_t SBModule::GetSymtabState() const {
310 LLDB_INSTRUMENT_VA(this);
311
312 if (ModuleSP module_sp = GetSP())
313 return module_sp->GetSymtabState();
314 return eSymtabStateNone;
315}
316
318 LLDB_INSTRUMENT_VA(this, idx);
319
320 SBSymbol sb_symbol;
321 ModuleSP module_sp(GetSP());
322 Symtab *symtab = GetUnifiedSymbolTable(module_sp);
323 if (symtab)
324 sb_symbol.SetSymbol(symtab->SymbolAtIndex(idx));
325 return sb_symbol;
326}
327
329 lldb::SymbolType symbol_type) {
330 LLDB_INSTRUMENT_VA(this, name, symbol_type);
331
332 SBSymbol sb_symbol;
333 if (name && name[0]) {
334 ModuleSP module_sp(GetSP());
335 Symtab *symtab = GetUnifiedSymbolTable(module_sp);
336 if (symtab)
338 ConstString(name), symbol_type, Symtab::eDebugAny,
340 }
341 return sb_symbol;
342}
343
345 lldb::SymbolType symbol_type) {
346 LLDB_INSTRUMENT_VA(this, name, symbol_type);
347
348 SBSymbolContextList sb_sc_list;
349 if (name && name[0]) {
350 ModuleSP module_sp(GetSP());
351 Symtab *symtab = GetUnifiedSymbolTable(module_sp);
352 if (symtab) {
353 std::vector<uint32_t> matching_symbol_indexes;
354 symtab->FindAllSymbolsWithNameAndType(ConstString(name), symbol_type,
355 matching_symbol_indexes);
356 const size_t num_matches = matching_symbol_indexes.size();
357 if (num_matches) {
358 SymbolContext sc;
359 sc.module_sp = module_sp;
360 SymbolContextList &sc_list = *sb_sc_list;
361 for (size_t i = 0; i < num_matches; ++i) {
362 sc.symbol = symtab->SymbolAtIndex(matching_symbol_indexes[i]);
363 if (sc.symbol)
364 sc_list.Append(sc);
365 }
366 }
367 }
368 }
369 return sb_sc_list;
370}
371
373 LLDB_INSTRUMENT_VA(this);
374
375 ModuleSP module_sp(GetSP());
376 if (module_sp) {
377 // Give the symbol vendor a chance to add to the unified section list.
378 module_sp->GetSymbolFile();
379 SectionList *section_list = module_sp->GetSectionList();
380 if (section_list)
381 return section_list->GetSize();
382 }
383 return 0;
384}
385
387 LLDB_INSTRUMENT_VA(this, idx);
388
389 SBSection sb_section;
390 ModuleSP module_sp(GetSP());
391 if (module_sp) {
392 // Give the symbol vendor a chance to add to the unified section list.
393 module_sp->GetSymbolFile();
394 SectionList *section_list = module_sp->GetSectionList();
395
396 if (section_list)
397 sb_section.SetSP(section_list->GetSectionAtIndex(idx));
398 }
399 return sb_section;
400}
401
403 uint32_t name_type_mask) {
404 LLDB_INSTRUMENT_VA(this, name, name_type_mask);
405
406 lldb::SBSymbolContextList sb_sc_list;
407 ModuleSP module_sp(GetSP());
408 if (name && module_sp) {
409
410 ModuleFunctionSearchOptions function_options;
411 function_options.include_symbols = true;
412 function_options.include_inlines = true;
413 FunctionNameType type = static_cast<FunctionNameType>(name_type_mask);
414 module_sp->FindFunctions(ConstString(name), CompilerDeclContext(), type,
415 function_options, *sb_sc_list);
416 }
417 return sb_sc_list;
418}
419
421 uint32_t max_matches) {
422 LLDB_INSTRUMENT_VA(this, target, name, max_matches);
423
424 SBValueList sb_value_list;
425 ModuleSP module_sp(GetSP());
426 if (name && module_sp) {
427 VariableList variable_list;
428 module_sp->FindGlobalVariables(ConstString(name), CompilerDeclContext(),
429 max_matches, variable_list);
430 for (const VariableSP &var_sp : variable_list) {
431 lldb::ValueObjectSP valobj_sp;
432 TargetSP target_sp(target.GetSP());
433 valobj_sp = ValueObjectVariable::Create(target_sp.get(), var_sp);
434 if (valobj_sp)
435 sb_value_list.Append(SBValue(valobj_sp));
436 }
437 }
438
439 return sb_value_list;
440}
441
443 const char *name) {
444 LLDB_INSTRUMENT_VA(this, target, name);
445
446 SBValueList sb_value_list(FindGlobalVariables(target, name, 1));
447 if (sb_value_list.IsValid() && sb_value_list.GetSize() > 0)
448 return sb_value_list.GetValueAtIndex(0);
449 return SBValue();
450}
451
452lldb::SBType SBModule::FindFirstType(const char *name_cstr) {
453 LLDB_INSTRUMENT_VA(this, name_cstr);
454
455 ModuleSP module_sp(GetSP());
456 if (name_cstr && module_sp) {
457 ConstString name(name_cstr);
458 TypeQuery query(name.GetStringRef(), TypeQueryOptions::e_find_one);
459 TypeResults results;
460 module_sp->FindTypes(query, results);
461 TypeSP type_sp = results.GetFirstType();
462 if (type_sp)
463 return SBType(type_sp);
464
465 auto type_system_or_err =
466 module_sp->GetTypeSystemForLanguage(eLanguageTypeC);
467 if (auto err = type_system_or_err.takeError()) {
468 llvm::consumeError(std::move(err));
469 return {};
470 }
471
472 if (auto ts = *type_system_or_err)
473 return SBType(ts->GetBuiltinTypeByName(name));
474 }
475 return {};
476}
477
479 LLDB_INSTRUMENT_VA(this, type);
480
481 ModuleSP module_sp(GetSP());
482 if (module_sp) {
483 auto type_system_or_err =
484 module_sp->GetTypeSystemForLanguage(eLanguageTypeC);
485 if (auto err = type_system_or_err.takeError()) {
486 llvm::consumeError(std::move(err));
487 } else {
488 if (auto ts = *type_system_or_err)
489 return SBType(ts->GetBasicTypeFromAST(type));
490 }
491 }
492 return SBType();
493}
494
496 LLDB_INSTRUMENT_VA(this, type);
497
498 SBTypeList retval;
499
500 ModuleSP module_sp(GetSP());
501 if (type && module_sp) {
502 TypeList type_list;
503 TypeQuery query(type);
504 TypeResults results;
505 module_sp->FindTypes(query, results);
506 if (results.GetTypeMap().Empty()) {
507 ConstString name(type);
508 auto type_system_or_err =
509 module_sp->GetTypeSystemForLanguage(eLanguageTypeC);
510 if (auto err = type_system_or_err.takeError()) {
511 llvm::consumeError(std::move(err));
512 } else {
513 if (auto ts = *type_system_or_err)
514 if (CompilerType compiler_type = ts->GetBuiltinTypeByName(name))
515 retval.Append(SBType(compiler_type));
516 }
517 } else {
518 for (const TypeSP &type_sp : results.GetTypeMap().Types())
519 retval.Append(SBType(type_sp));
520 }
521 }
522 return retval;
523}
524
526 LLDB_INSTRUMENT_VA(this, uid);
527
528 ModuleSP module_sp(GetSP());
529 if (module_sp) {
530 if (SymbolFile *symfile = module_sp->GetSymbolFile()) {
531 Type *type_ptr = symfile->ResolveTypeUID(uid);
532 if (type_ptr)
533 return SBType(type_ptr->shared_from_this());
534 }
535 }
536 return SBType();
537}
538
540 LLDB_INSTRUMENT_VA(this, type_mask);
541
542 SBTypeList sb_type_list;
543
544 ModuleSP module_sp(GetSP());
545 if (!module_sp)
546 return sb_type_list;
547 SymbolFile *symfile = module_sp->GetSymbolFile();
548 if (!symfile)
549 return sb_type_list;
550
551 TypeClass type_class = static_cast<TypeClass>(type_mask);
552 TypeList type_list;
553 symfile->GetTypes(nullptr, type_class, type_list);
554 sb_type_list.m_opaque_up->Append(type_list);
555 return sb_type_list;
556}
557
558SBSection SBModule::FindSection(const char *sect_name) {
559 LLDB_INSTRUMENT_VA(this, sect_name);
560
561 SBSection sb_section;
562
563 ModuleSP module_sp(GetSP());
564 if (sect_name && module_sp) {
565 // Give the symbol vendor a chance to add to the unified section list.
566 module_sp->GetSymbolFile();
567 SectionList *section_list = module_sp->GetSectionList();
568 if (section_list) {
569 SectionSP section_sp(section_list->FindSectionByName(sect_name));
570 if (section_sp) {
571 sb_section.SetSP(section_sp);
572 }
573 }
574 }
575 return sb_section;
576}
577
579 LLDB_INSTRUMENT_VA(this);
580
581 ModuleSP module_sp(GetSP());
582 if (module_sp)
583 return module_sp->GetArchitecture().GetByteOrder();
584 return eByteOrderInvalid;
585}
586
587const char *SBModule::GetTriple() {
588 LLDB_INSTRUMENT_VA(this);
589
590 ModuleSP module_sp(GetSP());
591 if (!module_sp)
592 return nullptr;
593
594 std::string triple(module_sp->GetArchitecture().GetTriple().str());
595 // Unique the string so we don't run into ownership issues since the const
596 // strings put the string into the string pool once and the strings never
597 // comes out
598 ConstString const_triple(triple);
599 return const_triple.GetCString();
600}
601
603 LLDB_INSTRUMENT_VA(this);
604
605 ModuleSP module_sp(GetSP());
606 if (module_sp)
607 return module_sp->GetArchitecture().GetAddressByteSize();
608 return sizeof(void *);
609}
610
611uint32_t SBModule::GetVersion(uint32_t *versions, uint32_t num_versions) {
612 LLDB_INSTRUMENT_VA(this, versions, num_versions);
613
614 llvm::VersionTuple version;
615 if (ModuleSP module_sp = GetSP())
616 version = module_sp->GetVersion();
617 uint32_t result = 0;
618 if (!version.empty())
619 ++result;
620 if (version.getMinor())
621 ++result;
622 if (version.getSubminor())
623 ++result;
624
625 if (!versions)
626 return result;
627
628 if (num_versions > 0)
629 versions[0] = version.empty() ? UINT32_MAX : version.getMajor();
630 if (num_versions > 1)
631 versions[1] = version.getMinor().value_or(UINT32_MAX);
632 if (num_versions > 2)
633 versions[2] = version.getSubminor().value_or(UINT32_MAX);
634 for (uint32_t i = 3; i < num_versions; ++i)
635 versions[i] = UINT32_MAX;
636 return result;
637}
638
640 LLDB_INSTRUMENT_VA(this);
641
642 lldb::SBFileSpec sb_file_spec;
643 ModuleSP module_sp(GetSP());
644 if (module_sp) {
645 if (SymbolFile *symfile = module_sp->GetSymbolFile())
646 sb_file_spec.SetFileSpec(symfile->GetObjectFile()->GetFileSpec());
647 }
648 return sb_file_spec;
649}
650
652 LLDB_INSTRUMENT_VA(this);
653 ModuleSP module_sp(GetSP());
654 if (module_sp)
655 return lldb::SBModuleSpecList(module_sp->GetSeparateDebugInfoFiles());
656
657 return lldb::SBModuleSpecList();
658}
659
661 LLDB_INSTRUMENT_VA(this);
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 sb_addr;
671}
672
674 LLDB_INSTRUMENT_VA(this);
675
676 lldb::SBAddress sb_addr;
677 ModuleSP module_sp(GetSP());
678 if (module_sp) {
679 ObjectFile *objfile_ptr = module_sp->GetObjectFile();
680 if (objfile_ptr)
681 sb_addr.ref() = objfile_ptr->GetEntryPointAddress();
682 }
683 return sb_addr;
684}
685
691
694
695 const bool mandatory = false;
697}
698
699const char *SBModule::GetObjectName() const {
700 LLDB_INSTRUMENT_VA(this);
701
702 if (!m_opaque_sp)
703 return nullptr;
704 return ConstString(m_opaque_sp->GetObjectName()).AsCString(nullptr);
705}
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:587
lldb::SBTypeList GetTypes(uint32_t type_mask=lldb::eTypeClassAny)
Get all types matching type_mask from debug info in this module.
Definition SBModule.cpp:539
size_t GetNumSections()
Definition SBModule.cpp:372
lldb::SBValue FindFirstGlobalVariable(lldb::SBTarget &target, const char *name)
Find the first global (or static) variable by name.
Definition SBModule.cpp:442
void SetSP(const ModuleSP &module_sp)
Definition SBModule.cpp:219
lldb::SBType FindFirstType(const char *name)
Definition SBModule.cpp:452
lldb::SBAddress GetObjectFileEntryPointAddress() const
Definition SBModule.cpp:673
uint32_t GetAddressByteSize()
Definition SBModule.cpp:602
uint32_t GetNumCompileUnits()
Definition SBModule.cpp:261
lldb::SBTypeList FindTypes(const char *type)
Definition SBModule.cpp:495
lldb::SBValueList FindGlobalVariables(lldb::SBTarget &target, const char *name, uint32_t max_matches)
Find global and static variables by name.
Definition SBModule.cpp:420
static void GarbageCollectAllocatedModules()
Remove any global modules which are no longer needed.
Definition SBModule.cpp:692
static uint32_t GetNumberAllocatedModules()
Get the number of global modules.
Definition SBModule.cpp:686
uint32_t GetSymtabState() const
Get a bitmask of lldb::SymtabState flags describing the state of this module's symbol table.
Definition SBModule.cpp:309
lldb::SBFileSpec GetSymbolFileSpec() const
Get accessor for the symbol file specification.
Definition SBModule.cpp:639
friend class SBTarget
Definition SBModule.h:338
lldb::SBSymbol GetSymbolAtIndex(size_t idx)
Definition SBModule.cpp:317
lldb::ModuleSP m_opaque_sp
Definition SBModule.h:349
lldb::SBSymbol FindSymbol(const char *name, lldb::SymbolType type=eSymbolTypeAny)
Definition SBModule.cpp:328
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:336
friend class SBAddress
Definition SBModule.h:333
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:651
uint32_t GetVersion(uint32_t *versions, uint32_t num_versions)
Get the module version numbers.
Definition SBModule.cpp:611
lldb::SBType GetTypeByID(lldb::user_id_t uid)
Get a type using its type ID.
Definition SBModule.cpp:525
lldb::SBSection FindSection(const char *sect_name)
Definition SBModule.cpp:558
lldb::SBCompileUnit GetCompileUnitAtIndex(uint32_t)
Definition SBModule.cpp:271
lldb::SBSection GetSectionAtIndex(size_t idx)
Definition SBModule.cpp:386
lldb::SBSymbolContextList FindSymbols(const char *name, lldb::SymbolType type=eSymbolTypeAny)
Definition SBModule.cpp:344
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:699
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:402
lldb::SBAddress GetObjectFileHeaderAddress() const
Definition SBModule.cpp:660
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:578
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:335
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:339
lldb::SBType GetBasicType(lldb::BasicType type)
Definition SBModule.cpp:478
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:597
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.
const char * AsCString(const char *value_if_empty) 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:115
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:462
bool IsInMemory() const
Returns true if the object file exists only in memory.
Definition ObjectFile.h:695
virtual lldb_private::Address GetBaseAddress()
Returns base address of this object file.
Definition ObjectFile.h:472
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:226
Symbol * FindFirstSymbolWithNameAndType(ConstString name, lldb::SymbolType symbol_type, Debug symbol_debug_type, Visibility symbol_visibility)
Definition Symtab.cpp:842
void FindAllSymbolsWithNameAndType(ConstString name, lldb::SymbolType symbol_type, std::vector< uint32_t > &symbol_indexes)
Definition Symtab.cpp:796
const ModuleList & GetImages() const
Get accessor for the images for this process.
Definition Target.h:1283
TypeIterable Types() const
Definition TypeMap.h:47
bool Empty() const
Definition TypeMap.cpp:53
A class that contains all state required for type lookups.
This class tracks the state and results of a TypeQuery.
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:68
bool include_inlines
Include inlined functions.
Definition Module.h:72
bool include_symbols
Include the symbol table.
Definition Module.h:70