1 //===-- SBModule.cpp --------------------------------------------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
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"
16 #include "lldb/API/SBSymbolContextList.h"
17 #include "lldb/Core/Module.h"
18 #include "lldb/Core/Section.h"
19 #include "lldb/Core/ValueObjectList.h"
20 #include "lldb/Core/ValueObjectVariable.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"
25 #include "lldb/Symbol/VariableList.h"
26 #include "lldb/Target/Target.h"
27 #include "lldb/Utility/StreamString.h"
30 using namespace lldb_private
;
32 SBModule::SBModule() : m_opaque_sp() {
33 LLDB_RECORD_CONSTRUCTOR_NO_ARGS(SBModule
);
36 SBModule::SBModule(const lldb::ModuleSP
&module_sp
) : m_opaque_sp(module_sp
) {}
38 SBModule::SBModule(const SBModuleSpec
&module_spec
) : m_opaque_sp() {
39 LLDB_RECORD_CONSTRUCTOR(SBModule
, (const lldb::SBModuleSpec
&), module_spec
);
42 Status error
= ModuleList::GetSharedModule(
43 *module_spec
.m_opaque_up
, module_sp
, nullptr, nullptr, nullptr);
48 SBModule::SBModule(const SBModule
&rhs
) : m_opaque_sp(rhs
.m_opaque_sp
) {
49 LLDB_RECORD_CONSTRUCTOR(SBModule
, (const lldb::SBModule
&), rhs
);
52 SBModule::SBModule(lldb::SBProcess
&process
, lldb::addr_t header_addr
)
54 LLDB_RECORD_CONSTRUCTOR(SBModule
, (lldb::SBProcess
&, lldb::addr_t
), process
,
57 ProcessSP
process_sp(process
.GetSP());
59 m_opaque_sp
= process_sp
->ReadModuleFromMemory(FileSpec(), header_addr
);
61 Target
&target
= process_sp
->GetTarget();
63 m_opaque_sp
->SetLoadAddress(target
, 0, true, changed
);
64 target
.GetImages().Append(m_opaque_sp
);
69 const SBModule
&SBModule::operator=(const SBModule
&rhs
) {
70 LLDB_RECORD_METHOD(const lldb::SBModule
&,
71 SBModule
, operator=,(const lldb::SBModule
&), rhs
);
74 m_opaque_sp
= rhs
.m_opaque_sp
;
75 return LLDB_RECORD_RESULT(*this);
78 SBModule::~SBModule() {}
80 bool SBModule::IsValid() const {
81 LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBModule
, IsValid
);
82 return this->operator bool();
84 SBModule::operator bool() const {
85 LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBModule
, operator bool);
87 return m_opaque_sp
.get() != nullptr;
90 void SBModule::Clear() {
91 LLDB_RECORD_METHOD_NO_ARGS(void, SBModule
, Clear
);
96 SBFileSpec
SBModule::GetFileSpec() const {
97 LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::SBFileSpec
, SBModule
, GetFileSpec
);
100 ModuleSP
module_sp(GetSP());
102 file_spec
.SetFileSpec(module_sp
->GetFileSpec());
104 return LLDB_RECORD_RESULT(file_spec
);
107 lldb::SBFileSpec
SBModule::GetPlatformFileSpec() const {
108 LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::SBFileSpec
, SBModule
,
109 GetPlatformFileSpec
);
112 SBFileSpec file_spec
;
113 ModuleSP
module_sp(GetSP());
115 file_spec
.SetFileSpec(module_sp
->GetPlatformFileSpec());
117 return LLDB_RECORD_RESULT(file_spec
);
120 bool SBModule::SetPlatformFileSpec(const lldb::SBFileSpec
&platform_file
) {
121 LLDB_RECORD_METHOD(bool, SBModule
, SetPlatformFileSpec
,
122 (const lldb::SBFileSpec
&), platform_file
);
126 ModuleSP
module_sp(GetSP());
128 module_sp
->SetPlatformFileSpec(*platform_file
);
135 lldb::SBFileSpec
SBModule::GetRemoteInstallFileSpec() {
136 LLDB_RECORD_METHOD_NO_ARGS(lldb::SBFileSpec
, SBModule
,
137 GetRemoteInstallFileSpec
);
139 SBFileSpec sb_file_spec
;
140 ModuleSP
module_sp(GetSP());
142 sb_file_spec
.SetFileSpec(module_sp
->GetRemoteInstallFileSpec());
143 return LLDB_RECORD_RESULT(sb_file_spec
);
146 bool SBModule::SetRemoteInstallFileSpec(lldb::SBFileSpec
&file
) {
147 LLDB_RECORD_METHOD(bool, SBModule
, SetRemoteInstallFileSpec
,
148 (lldb::SBFileSpec
&), file
);
150 ModuleSP
module_sp(GetSP());
152 module_sp
->SetRemoteInstallFileSpec(file
.ref());
158 const uint8_t *SBModule::GetUUIDBytes() const {
159 LLDB_RECORD_METHOD_CONST_NO_ARGS(const uint8_t *, SBModule
, GetUUIDBytes
);
161 const uint8_t *uuid_bytes
= nullptr;
162 ModuleSP
module_sp(GetSP());
164 uuid_bytes
= module_sp
->GetUUID().GetBytes().data();
169 const char *SBModule::GetUUIDString() const {
170 LLDB_RECORD_METHOD_CONST_NO_ARGS(const char *, SBModule
, GetUUIDString
);
172 const char *uuid_cstr
= nullptr;
173 ModuleSP
module_sp(GetSP());
175 // We are going to return a "const char *" value through the public API, so
176 // we need to constify it so it gets added permanently the string pool and
177 // then we don't need to worry about the lifetime of the string as it will
178 // never go away once it has been put into the ConstString string pool
179 uuid_cstr
= ConstString(module_sp
->GetUUID().GetAsString()).GetCString();
182 if (uuid_cstr
&& uuid_cstr
[0]) {
189 bool SBModule::operator==(const SBModule
&rhs
) const {
190 LLDB_RECORD_METHOD_CONST(bool, SBModule
, operator==,(const lldb::SBModule
&),
194 return m_opaque_sp
.get() == rhs
.m_opaque_sp
.get();
198 bool SBModule::operator!=(const SBModule
&rhs
) const {
199 LLDB_RECORD_METHOD_CONST(bool, SBModule
, operator!=,(const lldb::SBModule
&),
203 return m_opaque_sp
.get() != rhs
.m_opaque_sp
.get();
207 ModuleSP
SBModule::GetSP() const { return m_opaque_sp
; }
209 void SBModule::SetSP(const ModuleSP
&module_sp
) { m_opaque_sp
= module_sp
; }
211 SBAddress
SBModule::ResolveFileAddress(lldb::addr_t vm_addr
) {
212 LLDB_RECORD_METHOD(lldb::SBAddress
, SBModule
, ResolveFileAddress
,
213 (lldb::addr_t
), vm_addr
);
215 lldb::SBAddress sb_addr
;
216 ModuleSP
module_sp(GetSP());
219 if (module_sp
->ResolveFileAddress(vm_addr
, addr
))
220 sb_addr
.ref() = addr
;
222 return LLDB_RECORD_RESULT(sb_addr
);
226 SBModule::ResolveSymbolContextForAddress(const SBAddress
&addr
,
227 uint32_t resolve_scope
) {
228 LLDB_RECORD_METHOD(lldb::SBSymbolContext
, SBModule
,
229 ResolveSymbolContextForAddress
,
230 (const lldb::SBAddress
&, uint32_t), addr
, resolve_scope
);
232 SBSymbolContext sb_sc
;
233 ModuleSP
module_sp(GetSP());
234 SymbolContextItem scope
= static_cast<SymbolContextItem
>(resolve_scope
);
235 if (module_sp
&& addr
.IsValid())
236 module_sp
->ResolveSymbolContextForAddress(addr
.ref(), scope
, *sb_sc
);
237 return LLDB_RECORD_RESULT(sb_sc
);
240 bool SBModule::GetDescription(SBStream
&description
) {
241 LLDB_RECORD_METHOD(bool, SBModule
, GetDescription
, (lldb::SBStream
&),
244 Stream
&strm
= description
.ref();
246 ModuleSP
module_sp(GetSP());
248 module_sp
->GetDescription(strm
.AsRawOstream());
250 strm
.PutCString("No value");
255 uint32_t SBModule::GetNumCompileUnits() {
256 LLDB_RECORD_METHOD_NO_ARGS(uint32_t, SBModule
, GetNumCompileUnits
);
258 ModuleSP
module_sp(GetSP());
260 return module_sp
->GetNumCompileUnits();
265 SBCompileUnit
SBModule::GetCompileUnitAtIndex(uint32_t index
) {
266 LLDB_RECORD_METHOD(lldb::SBCompileUnit
, SBModule
, GetCompileUnitAtIndex
,
270 ModuleSP
module_sp(GetSP());
272 CompUnitSP cu_sp
= module_sp
->GetCompileUnitAtIndex(index
);
273 sb_cu
.reset(cu_sp
.get());
275 return LLDB_RECORD_RESULT(sb_cu
);
278 SBSymbolContextList
SBModule::FindCompileUnits(const SBFileSpec
&sb_file_spec
) {
279 LLDB_RECORD_METHOD(lldb::SBSymbolContextList
, SBModule
, FindCompileUnits
,
280 (const lldb::SBFileSpec
&), sb_file_spec
);
282 SBSymbolContextList sb_sc_list
;
283 const ModuleSP
module_sp(GetSP());
284 if (sb_file_spec
.IsValid() && module_sp
) {
285 module_sp
->FindCompileUnits(*sb_file_spec
, *sb_sc_list
);
287 return LLDB_RECORD_RESULT(sb_sc_list
);
290 static Symtab
*GetUnifiedSymbolTable(const lldb::ModuleSP
&module_sp
) {
292 return module_sp
->GetSymtab();
296 size_t SBModule::GetNumSymbols() {
297 LLDB_RECORD_METHOD_NO_ARGS(size_t, SBModule
, GetNumSymbols
);
299 ModuleSP
module_sp(GetSP());
300 if (Symtab
*symtab
= GetUnifiedSymbolTable(module_sp
))
301 return symtab
->GetNumSymbols();
305 SBSymbol
SBModule::GetSymbolAtIndex(size_t idx
) {
306 LLDB_RECORD_METHOD(lldb::SBSymbol
, SBModule
, GetSymbolAtIndex
, (size_t), idx
);
309 ModuleSP
module_sp(GetSP());
310 Symtab
*symtab
= GetUnifiedSymbolTable(module_sp
);
312 sb_symbol
.SetSymbol(symtab
->SymbolAtIndex(idx
));
313 return LLDB_RECORD_RESULT(sb_symbol
);
316 lldb::SBSymbol
SBModule::FindSymbol(const char *name
,
317 lldb::SymbolType symbol_type
) {
318 LLDB_RECORD_METHOD(lldb::SBSymbol
, SBModule
, FindSymbol
,
319 (const char *, lldb::SymbolType
), name
, symbol_type
);
322 if (name
&& name
[0]) {
323 ModuleSP
module_sp(GetSP());
324 Symtab
*symtab
= GetUnifiedSymbolTable(module_sp
);
326 sb_symbol
.SetSymbol(symtab
->FindFirstSymbolWithNameAndType(
327 ConstString(name
), symbol_type
, Symtab::eDebugAny
,
328 Symtab::eVisibilityAny
));
330 return LLDB_RECORD_RESULT(sb_symbol
);
333 lldb::SBSymbolContextList
SBModule::FindSymbols(const char *name
,
334 lldb::SymbolType symbol_type
) {
335 LLDB_RECORD_METHOD(lldb::SBSymbolContextList
, SBModule
, FindSymbols
,
336 (const char *, lldb::SymbolType
), name
, symbol_type
);
338 SBSymbolContextList sb_sc_list
;
339 if (name
&& name
[0]) {
340 ModuleSP
module_sp(GetSP());
341 Symtab
*symtab
= GetUnifiedSymbolTable(module_sp
);
343 std::vector
<uint32_t> matching_symbol_indexes
;
344 symtab
->FindAllSymbolsWithNameAndType(ConstString(name
), symbol_type
,
345 matching_symbol_indexes
);
346 const size_t num_matches
= matching_symbol_indexes
.size();
349 sc
.module_sp
= module_sp
;
350 SymbolContextList
&sc_list
= *sb_sc_list
;
351 for (size_t i
= 0; i
< num_matches
; ++i
) {
352 sc
.symbol
= symtab
->SymbolAtIndex(matching_symbol_indexes
[i
]);
359 return LLDB_RECORD_RESULT(sb_sc_list
);
362 size_t SBModule::GetNumSections() {
363 LLDB_RECORD_METHOD_NO_ARGS(size_t, SBModule
, GetNumSections
);
365 ModuleSP
module_sp(GetSP());
367 // Give the symbol vendor a chance to add to the unified section list.
368 module_sp
->GetSymbolFile();
369 SectionList
*section_list
= module_sp
->GetSectionList();
371 return section_list
->GetSize();
376 SBSection
SBModule::GetSectionAtIndex(size_t idx
) {
377 LLDB_RECORD_METHOD(lldb::SBSection
, SBModule
, GetSectionAtIndex
, (size_t),
380 SBSection sb_section
;
381 ModuleSP
module_sp(GetSP());
383 // Give the symbol vendor a chance to add to the unified section list.
384 module_sp
->GetSymbolFile();
385 SectionList
*section_list
= module_sp
->GetSectionList();
388 sb_section
.SetSP(section_list
->GetSectionAtIndex(idx
));
390 return LLDB_RECORD_RESULT(sb_section
);
393 lldb::SBSymbolContextList
SBModule::FindFunctions(const char *name
,
394 uint32_t name_type_mask
) {
395 LLDB_RECORD_METHOD(lldb::SBSymbolContextList
, SBModule
, FindFunctions
,
396 (const char *, uint32_t), name
, name_type_mask
);
398 lldb::SBSymbolContextList sb_sc_list
;
399 ModuleSP
module_sp(GetSP());
400 if (name
&& module_sp
) {
401 const bool symbols_ok
= true;
402 const bool inlines_ok
= true;
403 FunctionNameType type
= static_cast<FunctionNameType
>(name_type_mask
);
404 module_sp
->FindFunctions(ConstString(name
), nullptr, type
, symbols_ok
,
405 inlines_ok
, *sb_sc_list
);
407 return LLDB_RECORD_RESULT(sb_sc_list
);
410 SBValueList
SBModule::FindGlobalVariables(SBTarget
&target
, const char *name
,
411 uint32_t max_matches
) {
412 LLDB_RECORD_METHOD(lldb::SBValueList
, SBModule
, FindGlobalVariables
,
413 (lldb::SBTarget
&, const char *, uint32_t), target
, name
,
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
), nullptr, max_matches
,
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
);
427 sb_value_list
.Append(SBValue(valobj_sp
));
431 return LLDB_RECORD_RESULT(sb_value_list
);
434 lldb::SBValue
SBModule::FindFirstGlobalVariable(lldb::SBTarget
&target
,
436 LLDB_RECORD_METHOD(lldb::SBValue
, SBModule
, FindFirstGlobalVariable
,
437 (lldb::SBTarget
&, const char *), target
, name
);
439 SBValueList
sb_value_list(FindGlobalVariables(target
, name
, 1));
440 if (sb_value_list
.IsValid() && sb_value_list
.GetSize() > 0)
441 return LLDB_RECORD_RESULT(sb_value_list
.GetValueAtIndex(0));
442 return LLDB_RECORD_RESULT(SBValue());
445 lldb::SBType
SBModule::FindFirstType(const char *name_cstr
) {
446 LLDB_RECORD_METHOD(lldb::SBType
, SBModule
, FindFirstType
, (const char *),
450 ModuleSP
module_sp(GetSP());
451 if (name_cstr
&& module_sp
) {
453 const bool exact_match
= false;
454 ConstString
name(name_cstr
);
456 sb_type
= SBType(module_sp
->FindFirstType(sc
, name
, exact_match
));
458 if (!sb_type
.IsValid()) {
459 auto type_system_or_err
=
460 module_sp
->GetTypeSystemForLanguage(eLanguageTypeC
);
461 if (auto err
= type_system_or_err
.takeError()) {
462 llvm::consumeError(std::move(err
));
463 return LLDB_RECORD_RESULT(SBType());
465 sb_type
= SBType(type_system_or_err
->GetBuiltinTypeByName(name
));
468 return LLDB_RECORD_RESULT(sb_type
);
471 lldb::SBType
SBModule::GetBasicType(lldb::BasicType type
) {
472 LLDB_RECORD_METHOD(lldb::SBType
, SBModule
, GetBasicType
, (lldb::BasicType
),
475 ModuleSP
module_sp(GetSP());
477 auto type_system_or_err
=
478 module_sp
->GetTypeSystemForLanguage(eLanguageTypeC
);
479 if (auto err
= type_system_or_err
.takeError()) {
480 llvm::consumeError(std::move(err
));
482 return LLDB_RECORD_RESULT(
483 SBType(type_system_or_err
->GetBasicTypeFromAST(type
)));
486 return LLDB_RECORD_RESULT(SBType());
489 lldb::SBTypeList
SBModule::FindTypes(const char *type
) {
490 LLDB_RECORD_METHOD(lldb::SBTypeList
, SBModule
, FindTypes
, (const char *),
495 ModuleSP
module_sp(GetSP());
496 if (type
&& module_sp
) {
498 const bool exact_match
= false;
499 ConstString
name(type
);
500 llvm::DenseSet
<SymbolFile
*> searched_symbol_files
;
501 module_sp
->FindTypes(name
, exact_match
, UINT32_MAX
, searched_symbol_files
,
504 if (type_list
.Empty()) {
505 auto type_system_or_err
=
506 module_sp
->GetTypeSystemForLanguage(eLanguageTypeC
);
507 if (auto err
= type_system_or_err
.takeError()) {
508 llvm::consumeError(std::move(err
));
510 CompilerType compiler_type
=
511 type_system_or_err
->GetBuiltinTypeByName(name
);
513 retval
.Append(SBType(compiler_type
));
516 for (size_t idx
= 0; idx
< type_list
.GetSize(); idx
++) {
517 TypeSP
type_sp(type_list
.GetTypeAtIndex(idx
));
519 retval
.Append(SBType(type_sp
));
523 return LLDB_RECORD_RESULT(retval
);
526 lldb::SBType
SBModule::GetTypeByID(lldb::user_id_t uid
) {
527 LLDB_RECORD_METHOD(lldb::SBType
, SBModule
, GetTypeByID
, (lldb::user_id_t
),
530 ModuleSP
module_sp(GetSP());
532 if (SymbolFile
*symfile
= module_sp
->GetSymbolFile()) {
533 Type
*type_ptr
= symfile
->ResolveTypeUID(uid
);
535 return LLDB_RECORD_RESULT(SBType(type_ptr
->shared_from_this()));
538 return LLDB_RECORD_RESULT(SBType());
541 lldb::SBTypeList
SBModule::GetTypes(uint32_t type_mask
) {
542 LLDB_RECORD_METHOD(lldb::SBTypeList
, SBModule
, GetTypes
, (uint32_t),
545 SBTypeList sb_type_list
;
547 ModuleSP
module_sp(GetSP());
549 return LLDB_RECORD_RESULT(sb_type_list
);
550 SymbolFile
*symfile
= module_sp
->GetSymbolFile();
552 return LLDB_RECORD_RESULT(sb_type_list
);
554 TypeClass type_class
= static_cast<TypeClass
>(type_mask
);
556 symfile
->GetTypes(nullptr, type_class
, type_list
);
557 sb_type_list
.m_opaque_up
->Append(type_list
);
558 return LLDB_RECORD_RESULT(sb_type_list
);
561 SBSection
SBModule::FindSection(const char *sect_name
) {
562 LLDB_RECORD_METHOD(lldb::SBSection
, SBModule
, FindSection
, (const char *),
565 SBSection sb_section
;
567 ModuleSP
module_sp(GetSP());
568 if (sect_name
&& module_sp
) {
569 // Give the symbol vendor a chance to add to the unified section list.
570 module_sp
->GetSymbolFile();
571 SectionList
*section_list
= module_sp
->GetSectionList();
573 ConstString
const_sect_name(sect_name
);
574 SectionSP
section_sp(section_list
->FindSectionByName(const_sect_name
));
576 sb_section
.SetSP(section_sp
);
580 return LLDB_RECORD_RESULT(sb_section
);
583 lldb::ByteOrder
SBModule::GetByteOrder() {
584 LLDB_RECORD_METHOD_NO_ARGS(lldb::ByteOrder
, SBModule
, GetByteOrder
);
586 ModuleSP
module_sp(GetSP());
588 return module_sp
->GetArchitecture().GetByteOrder();
589 return eByteOrderInvalid
;
592 const char *SBModule::GetTriple() {
593 LLDB_RECORD_METHOD_NO_ARGS(const char *, SBModule
, GetTriple
);
595 ModuleSP
module_sp(GetSP());
597 std::string
triple(module_sp
->GetArchitecture().GetTriple().str());
598 // Unique the string so we don't run into ownership issues since the const
599 // strings put the string into the string pool once and the strings never
601 ConstString
const_triple(triple
.c_str());
602 return const_triple
.GetCString();
607 uint32_t SBModule::GetAddressByteSize() {
608 LLDB_RECORD_METHOD_NO_ARGS(uint32_t, SBModule
, GetAddressByteSize
);
610 ModuleSP
module_sp(GetSP());
612 return module_sp
->GetArchitecture().GetAddressByteSize();
613 return sizeof(void *);
616 uint32_t SBModule::GetVersion(uint32_t *versions
, uint32_t num_versions
) {
617 LLDB_RECORD_METHOD(uint32_t, SBModule
, GetVersion
, (uint32_t *, uint32_t),
618 versions
, num_versions
);
620 llvm::VersionTuple version
;
621 if (ModuleSP module_sp
= GetSP())
622 version
= module_sp
->GetVersion();
624 if (!version
.empty())
626 if (version
.getMinor())
628 if(version
.getSubminor())
634 if (num_versions
> 0)
635 versions
[0] = version
.empty() ? UINT32_MAX
: version
.getMajor();
636 if (num_versions
> 1)
637 versions
[1] = version
.getMinor().getValueOr(UINT32_MAX
);
638 if (num_versions
> 2)
639 versions
[2] = version
.getSubminor().getValueOr(UINT32_MAX
);
640 for (uint32_t i
= 3; i
< num_versions
; ++i
)
641 versions
[i
] = UINT32_MAX
;
645 lldb::SBFileSpec
SBModule::GetSymbolFileSpec() const {
646 LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::SBFileSpec
, SBModule
,
649 lldb::SBFileSpec sb_file_spec
;
650 ModuleSP
module_sp(GetSP());
652 if (SymbolFile
*symfile
= module_sp
->GetSymbolFile())
653 sb_file_spec
.SetFileSpec(symfile
->GetObjectFile()->GetFileSpec());
655 return LLDB_RECORD_RESULT(sb_file_spec
);
658 lldb::SBAddress
SBModule::GetObjectFileHeaderAddress() const {
659 LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::SBAddress
, SBModule
,
660 GetObjectFileHeaderAddress
);
662 lldb::SBAddress sb_addr
;
663 ModuleSP
module_sp(GetSP());
665 ObjectFile
*objfile_ptr
= module_sp
->GetObjectFile();
667 sb_addr
.ref() = objfile_ptr
->GetBaseAddress();
669 return LLDB_RECORD_RESULT(sb_addr
);
672 lldb::SBAddress
SBModule::GetObjectFileEntryPointAddress() const {
673 LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::SBAddress
, SBModule
,
674 GetObjectFileEntryPointAddress
);
676 lldb::SBAddress sb_addr
;
677 ModuleSP
module_sp(GetSP());
679 ObjectFile
*objfile_ptr
= module_sp
->GetObjectFile();
681 sb_addr
.ref() = objfile_ptr
->GetEntryPointAddress();
683 return LLDB_RECORD_RESULT(sb_addr
);
686 namespace lldb_private
{
690 void RegisterMethods
<SBModule
>(Registry
&R
) {
691 LLDB_REGISTER_CONSTRUCTOR(SBModule
, ());
692 LLDB_REGISTER_CONSTRUCTOR(SBModule
, (const lldb::SBModuleSpec
&));
693 LLDB_REGISTER_CONSTRUCTOR(SBModule
, (const lldb::SBModule
&));
694 LLDB_REGISTER_CONSTRUCTOR(SBModule
, (lldb::SBProcess
&, lldb::addr_t
));
695 LLDB_REGISTER_METHOD(const lldb::SBModule
&,
696 SBModule
, operator=,(const lldb::SBModule
&));
697 LLDB_REGISTER_METHOD_CONST(bool, SBModule
, IsValid
, ());
698 LLDB_REGISTER_METHOD_CONST(bool, SBModule
, operator bool, ());
699 LLDB_REGISTER_METHOD(void, SBModule
, Clear
, ());
700 LLDB_REGISTER_METHOD_CONST(lldb::SBFileSpec
, SBModule
, GetFileSpec
, ());
701 LLDB_REGISTER_METHOD_CONST(lldb::SBFileSpec
, SBModule
, GetPlatformFileSpec
,
703 LLDB_REGISTER_METHOD(bool, SBModule
, SetPlatformFileSpec
,
704 (const lldb::SBFileSpec
&));
705 LLDB_REGISTER_METHOD(lldb::SBFileSpec
, SBModule
, GetRemoteInstallFileSpec
,
707 LLDB_REGISTER_METHOD(bool, SBModule
, SetRemoteInstallFileSpec
,
708 (lldb::SBFileSpec
&));
709 LLDB_REGISTER_METHOD_CONST(const char *, SBModule
, GetUUIDString
, ());
710 LLDB_REGISTER_METHOD_CONST(bool,
711 SBModule
, operator==,(const lldb::SBModule
&));
712 LLDB_REGISTER_METHOD_CONST(bool,
713 SBModule
, operator!=,(const lldb::SBModule
&));
714 LLDB_REGISTER_METHOD(lldb::SBAddress
, SBModule
, ResolveFileAddress
,
716 LLDB_REGISTER_METHOD(lldb::SBSymbolContext
, SBModule
,
717 ResolveSymbolContextForAddress
,
718 (const lldb::SBAddress
&, uint32_t));
719 LLDB_REGISTER_METHOD(bool, SBModule
, GetDescription
, (lldb::SBStream
&));
720 LLDB_REGISTER_METHOD(uint32_t, SBModule
, GetNumCompileUnits
, ());
721 LLDB_REGISTER_METHOD(lldb::SBCompileUnit
, SBModule
, GetCompileUnitAtIndex
,
723 LLDB_REGISTER_METHOD(lldb::SBSymbolContextList
, SBModule
, FindCompileUnits
,
724 (const lldb::SBFileSpec
&));
725 LLDB_REGISTER_METHOD(size_t, SBModule
, GetNumSymbols
, ());
726 LLDB_REGISTER_METHOD(lldb::SBSymbol
, SBModule
, GetSymbolAtIndex
, (size_t));
727 LLDB_REGISTER_METHOD(lldb::SBSymbol
, SBModule
, FindSymbol
,
728 (const char *, lldb::SymbolType
));
729 LLDB_REGISTER_METHOD(lldb::SBSymbolContextList
, SBModule
, FindSymbols
,
730 (const char *, lldb::SymbolType
));
731 LLDB_REGISTER_METHOD(size_t, SBModule
, GetNumSections
, ());
732 LLDB_REGISTER_METHOD(lldb::SBSection
, SBModule
, GetSectionAtIndex
,
734 LLDB_REGISTER_METHOD(lldb::SBSymbolContextList
, SBModule
, FindFunctions
,
735 (const char *, uint32_t));
736 LLDB_REGISTER_METHOD(lldb::SBValueList
, SBModule
, FindGlobalVariables
,
737 (lldb::SBTarget
&, const char *, uint32_t));
738 LLDB_REGISTER_METHOD(lldb::SBValue
, SBModule
, FindFirstGlobalVariable
,
739 (lldb::SBTarget
&, const char *));
740 LLDB_REGISTER_METHOD(lldb::SBType
, SBModule
, FindFirstType
, (const char *));
741 LLDB_REGISTER_METHOD(lldb::SBType
, SBModule
, GetBasicType
,
743 LLDB_REGISTER_METHOD(lldb::SBTypeList
, SBModule
, FindTypes
, (const char *));
744 LLDB_REGISTER_METHOD(lldb::SBType
, SBModule
, GetTypeByID
,
746 LLDB_REGISTER_METHOD(lldb::SBTypeList
, SBModule
, GetTypes
, (uint32_t));
747 LLDB_REGISTER_METHOD(lldb::SBSection
, SBModule
, FindSection
,
749 LLDB_REGISTER_METHOD(lldb::ByteOrder
, SBModule
, GetByteOrder
, ());
750 LLDB_REGISTER_METHOD(const char *, SBModule
, GetTriple
, ());
751 LLDB_REGISTER_METHOD(uint32_t, SBModule
, GetAddressByteSize
, ());
752 LLDB_REGISTER_METHOD(uint32_t, SBModule
, GetVersion
,
753 (uint32_t *, uint32_t));
754 LLDB_REGISTER_METHOD_CONST(lldb::SBFileSpec
, SBModule
, GetSymbolFileSpec
,
756 LLDB_REGISTER_METHOD_CONST(lldb::SBAddress
, SBModule
,
757 GetObjectFileHeaderAddress
, ());
758 LLDB_REGISTER_METHOD_CONST(lldb::SBAddress
, SBModule
,
759 GetObjectFileEntryPointAddress
, ());