diff options
Diffstat (limited to 'lldb/source/API/SBModule.cpp')
-rw-r--r-- | lldb/source/API/SBModule.cpp | 191 |
1 files changed, 157 insertions, 34 deletions
diff --git a/lldb/source/API/SBModule.cpp b/lldb/source/API/SBModule.cpp index a7886b034bd..ed80449b7cb 100644 --- a/lldb/source/API/SBModule.cpp +++ b/lldb/source/API/SBModule.cpp @@ -7,6 +7,7 @@ //===----------------------------------------------------------------------===// #include "lldb/API/SBModule.h" +#include "SBReproducerPrivate.h" #include "lldb/API/SBAddress.h" #include "lldb/API/SBFileSpec.h" #include "lldb/API/SBModuleSpec.h" @@ -30,11 +31,15 @@ using namespace lldb; using namespace lldb_private; -SBModule::SBModule() : m_opaque_sp() {} +SBModule::SBModule() : m_opaque_sp() { + LLDB_RECORD_CONSTRUCTOR_NO_ARGS(SBModule); +} SBModule::SBModule(const lldb::ModuleSP &module_sp) : m_opaque_sp(module_sp) {} SBModule::SBModule(const SBModuleSpec &module_spec) : m_opaque_sp() { + LLDB_RECORD_CONSTRUCTOR(SBModule, (const lldb::SBModuleSpec &), module_spec); + ModuleSP module_sp; Status error = ModuleList::GetSharedModule(*module_spec.m_opaque_up, module_sp, NULL, NULL, NULL); @@ -42,10 +47,15 @@ SBModule::SBModule(const SBModuleSpec &module_spec) : m_opaque_sp() { SetSP(module_sp); } -SBModule::SBModule(const SBModule &rhs) : m_opaque_sp(rhs.m_opaque_sp) {} +SBModule::SBModule(const SBModule &rhs) : m_opaque_sp(rhs.m_opaque_sp) { + LLDB_RECORD_CONSTRUCTOR(SBModule, (const lldb::SBModule &), rhs); +} SBModule::SBModule(lldb::SBProcess &process, lldb::addr_t header_addr) : m_opaque_sp() { + LLDB_RECORD_CONSTRUCTOR(SBModule, (lldb::SBProcess &, lldb::addr_t), process, + header_addr); + ProcessSP process_sp(process.GetSP()); if (process_sp) { m_opaque_sp = process_sp->ReadModuleFromMemory(FileSpec(), header_addr); @@ -59,6 +69,9 @@ SBModule::SBModule(lldb::SBProcess &process, lldb::addr_t header_addr) } const SBModule &SBModule::operator=(const SBModule &rhs) { + LLDB_RECORD_METHOD(const lldb::SBModule &, + SBModule, operator=,(const lldb::SBModule &), rhs); + if (this != &rhs) m_opaque_sp = rhs.m_opaque_sp; return *this; @@ -66,11 +79,21 @@ const SBModule &SBModule::operator=(const SBModule &rhs) { SBModule::~SBModule() {} -bool SBModule::IsValid() const { return m_opaque_sp.get() != NULL; } +bool SBModule::IsValid() const { + LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBModule, IsValid); + + return m_opaque_sp.get() != NULL; +} + +void SBModule::Clear() { + LLDB_RECORD_METHOD_NO_ARGS(void, SBModule, Clear); -void SBModule::Clear() { m_opaque_sp.reset(); } + m_opaque_sp.reset(); +} SBFileSpec SBModule::GetFileSpec() const { + LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::SBFileSpec, SBModule, GetFileSpec); + Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API)); SBFileSpec file_spec; @@ -83,10 +106,13 @@ SBFileSpec SBModule::GetFileSpec() const { static_cast<void *>(module_sp.get()), static_cast<const void *>(file_spec.get())); - return file_spec; + return LLDB_RECORD_RESULT(file_spec); } lldb::SBFileSpec SBModule::GetPlatformFileSpec() const { + LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::SBFileSpec, SBModule, + GetPlatformFileSpec); + Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API)); SBFileSpec file_spec; @@ -99,10 +125,13 @@ lldb::SBFileSpec SBModule::GetPlatformFileSpec() const { static_cast<void *>(module_sp.get()), static_cast<const void *>(file_spec.get())); - return file_spec; + return LLDB_RECORD_RESULT(file_spec); } bool SBModule::SetPlatformFileSpec(const lldb::SBFileSpec &platform_file) { + LLDB_RECORD_METHOD(bool, SBModule, SetPlatformFileSpec, + (const lldb::SBFileSpec &), platform_file); + bool result = false; Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API)); @@ -121,14 +150,20 @@ bool SBModule::SetPlatformFileSpec(const lldb::SBFileSpec &platform_file) { } lldb::SBFileSpec SBModule::GetRemoteInstallFileSpec() { + LLDB_RECORD_METHOD_NO_ARGS(lldb::SBFileSpec, SBModule, + GetRemoteInstallFileSpec); + SBFileSpec sb_file_spec; ModuleSP module_sp(GetSP()); if (module_sp) sb_file_spec.SetFileSpec(module_sp->GetRemoteInstallFileSpec()); - return sb_file_spec; + return LLDB_RECORD_RESULT(sb_file_spec); } bool SBModule::SetRemoteInstallFileSpec(lldb::SBFileSpec &file) { + LLDB_RECORD_METHOD(bool, SBModule, SetRemoteInstallFileSpec, + (lldb::SBFileSpec &), file); + ModuleSP module_sp(GetSP()); if (module_sp) { module_sp->SetRemoteInstallFileSpec(file.ref()); @@ -138,6 +173,8 @@ bool SBModule::SetRemoteInstallFileSpec(lldb::SBFileSpec &file) { } const uint8_t *SBModule::GetUUIDBytes() const { + LLDB_RECORD_METHOD_CONST_NO_ARGS(const uint8_t *, SBModule, GetUUIDBytes); + Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API)); const uint8_t *uuid_bytes = NULL; @@ -159,6 +196,8 @@ const uint8_t *SBModule::GetUUIDBytes() const { } const char *SBModule::GetUUIDString() const { + LLDB_RECORD_METHOD_CONST_NO_ARGS(const char *, SBModule, GetUUIDString); + Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API)); const char *uuid_cstr = NULL; @@ -185,12 +224,18 @@ const char *SBModule::GetUUIDString() const { } bool SBModule::operator==(const SBModule &rhs) const { + LLDB_RECORD_METHOD_CONST(bool, SBModule, operator==,(const lldb::SBModule &), + rhs); + if (m_opaque_sp) return m_opaque_sp.get() == rhs.m_opaque_sp.get(); return false; } bool SBModule::operator!=(const SBModule &rhs) const { + LLDB_RECORD_METHOD_CONST(bool, SBModule, operator!=,(const lldb::SBModule &), + rhs); + if (m_opaque_sp) return m_opaque_sp.get() != rhs.m_opaque_sp.get(); return false; @@ -201,6 +246,9 @@ ModuleSP SBModule::GetSP() const { return m_opaque_sp; } void SBModule::SetSP(const ModuleSP &module_sp) { m_opaque_sp = module_sp; } SBAddress SBModule::ResolveFileAddress(lldb::addr_t vm_addr) { + LLDB_RECORD_METHOD(lldb::SBAddress, SBModule, ResolveFileAddress, + (lldb::addr_t), vm_addr); + lldb::SBAddress sb_addr; ModuleSP module_sp(GetSP()); if (module_sp) { @@ -208,21 +256,28 @@ SBAddress SBModule::ResolveFileAddress(lldb::addr_t vm_addr) { if (module_sp->ResolveFileAddress(vm_addr, addr)) sb_addr.ref() = addr; } - return sb_addr; + return LLDB_RECORD_RESULT(sb_addr); } SBSymbolContext SBModule::ResolveSymbolContextForAddress(const SBAddress &addr, uint32_t resolve_scope) { + LLDB_RECORD_METHOD(lldb::SBSymbolContext, SBModule, + ResolveSymbolContextForAddress, + (const lldb::SBAddress &, uint32_t), addr, resolve_scope); + SBSymbolContext sb_sc; ModuleSP module_sp(GetSP()); SymbolContextItem scope = static_cast<SymbolContextItem>(resolve_scope); if (module_sp && addr.IsValid()) module_sp->ResolveSymbolContextForAddress(addr.ref(), scope, *sb_sc); - return sb_sc; + return LLDB_RECORD_RESULT(sb_sc); } bool SBModule::GetDescription(SBStream &description) { + LLDB_RECORD_METHOD(bool, SBModule, GetDescription, (lldb::SBStream &), + description); + Stream &strm = description.ref(); ModuleSP module_sp(GetSP()); @@ -235,6 +290,8 @@ bool SBModule::GetDescription(SBStream &description) { } uint32_t SBModule::GetNumCompileUnits() { + LLDB_RECORD_METHOD_NO_ARGS(uint32_t, SBModule, GetNumCompileUnits); + ModuleSP module_sp(GetSP()); if (module_sp) { return module_sp->GetNumCompileUnits(); @@ -243,24 +300,29 @@ uint32_t SBModule::GetNumCompileUnits() { } SBCompileUnit SBModule::GetCompileUnitAtIndex(uint32_t index) { + LLDB_RECORD_METHOD(lldb::SBCompileUnit, SBModule, GetCompileUnitAtIndex, + (uint32_t), index); + SBCompileUnit sb_cu; ModuleSP module_sp(GetSP()); if (module_sp) { CompUnitSP cu_sp = module_sp->GetCompileUnitAtIndex(index); sb_cu.reset(cu_sp.get()); } - return sb_cu; + return LLDB_RECORD_RESULT(sb_cu); } -SBSymbolContextList -SBModule::FindCompileUnits(const SBFileSpec &sb_file_spec) { +SBSymbolContextList SBModule::FindCompileUnits(const SBFileSpec &sb_file_spec) { + LLDB_RECORD_METHOD(lldb::SBSymbolContextList, SBModule, FindCompileUnits, + (const lldb::SBFileSpec &), sb_file_spec); + SBSymbolContextList sb_sc_list; const ModuleSP module_sp(GetSP()); if (sb_file_spec.IsValid() && module_sp) { const bool append = true; module_sp->FindCompileUnits(*sb_file_spec, append, *sb_sc_list); } - return sb_sc_list; + return LLDB_RECORD_RESULT(sb_sc_list); } static Symtab *GetUnifiedSymbolTable(const lldb::ModuleSP &module_sp) { @@ -273,6 +335,8 @@ static Symtab *GetUnifiedSymbolTable(const lldb::ModuleSP &module_sp) { } size_t SBModule::GetNumSymbols() { + LLDB_RECORD_METHOD_NO_ARGS(size_t, SBModule, GetNumSymbols); + ModuleSP module_sp(GetSP()); if (module_sp) { Symtab *symtab = GetUnifiedSymbolTable(module_sp); @@ -283,16 +347,21 @@ size_t SBModule::GetNumSymbols() { } SBSymbol SBModule::GetSymbolAtIndex(size_t idx) { + LLDB_RECORD_METHOD(lldb::SBSymbol, SBModule, GetSymbolAtIndex, (size_t), idx); + SBSymbol sb_symbol; ModuleSP module_sp(GetSP()); Symtab *symtab = GetUnifiedSymbolTable(module_sp); if (symtab) sb_symbol.SetSymbol(symtab->SymbolAtIndex(idx)); - return sb_symbol; + return LLDB_RECORD_RESULT(sb_symbol); } lldb::SBSymbol SBModule::FindSymbol(const char *name, lldb::SymbolType symbol_type) { + LLDB_RECORD_METHOD(lldb::SBSymbol, SBModule, FindSymbol, + (const char *, lldb::SymbolType), name, symbol_type); + SBSymbol sb_symbol; if (name && name[0]) { ModuleSP module_sp(GetSP()); @@ -302,11 +371,14 @@ lldb::SBSymbol SBModule::FindSymbol(const char *name, ConstString(name), symbol_type, Symtab::eDebugAny, Symtab::eVisibilityAny)); } - return sb_symbol; + return LLDB_RECORD_RESULT(sb_symbol); } lldb::SBSymbolContextList SBModule::FindSymbols(const char *name, lldb::SymbolType symbol_type) { + LLDB_RECORD_METHOD(lldb::SBSymbolContextList, SBModule, FindSymbols, + (const char *, lldb::SymbolType), name, symbol_type); + SBSymbolContextList sb_sc_list; if (name && name[0]) { ModuleSP module_sp(GetSP()); @@ -327,10 +399,12 @@ lldb::SBSymbolContextList SBModule::FindSymbols(const char *name, } } } - return sb_sc_list; + return LLDB_RECORD_RESULT(sb_sc_list); } size_t SBModule::GetNumSections() { + LLDB_RECORD_METHOD_NO_ARGS(size_t, SBModule, GetNumSections); + ModuleSP module_sp(GetSP()); if (module_sp) { // Give the symbol vendor a chance to add to the unified section list. @@ -343,6 +417,9 @@ size_t SBModule::GetNumSections() { } SBSection SBModule::GetSectionAtIndex(size_t idx) { + LLDB_RECORD_METHOD(lldb::SBSection, SBModule, GetSectionAtIndex, (size_t), + idx); + SBSection sb_section; ModuleSP module_sp(GetSP()); if (module_sp) { @@ -353,11 +430,14 @@ SBSection SBModule::GetSectionAtIndex(size_t idx) { if (section_list) sb_section.SetSP(section_list->GetSectionAtIndex(idx)); } - return sb_section; + return LLDB_RECORD_RESULT(sb_section); } lldb::SBSymbolContextList SBModule::FindFunctions(const char *name, uint32_t name_type_mask) { + LLDB_RECORD_METHOD(lldb::SBSymbolContextList, SBModule, FindFunctions, + (const char *, uint32_t), name, name_type_mask); + lldb::SBSymbolContextList sb_sc_list; ModuleSP module_sp(GetSP()); if (name && module_sp) { @@ -368,11 +448,15 @@ lldb::SBSymbolContextList SBModule::FindFunctions(const char *name, module_sp->FindFunctions(ConstString(name), NULL, type, symbols_ok, inlines_ok, append, *sb_sc_list); } - return sb_sc_list; + return LLDB_RECORD_RESULT(sb_sc_list); } SBValueList SBModule::FindGlobalVariables(SBTarget &target, const char *name, uint32_t max_matches) { + LLDB_RECORD_METHOD(lldb::SBValueList, SBModule, FindGlobalVariables, + (lldb::SBTarget &, const char *, uint32_t), target, name, + max_matches); + SBValueList sb_value_list; ModuleSP module_sp(GetSP()); if (name && module_sp) { @@ -392,18 +476,24 @@ SBValueList SBModule::FindGlobalVariables(SBTarget &target, const char *name, } } - return sb_value_list; + return LLDB_RECORD_RESULT(sb_value_list); } lldb::SBValue SBModule::FindFirstGlobalVariable(lldb::SBTarget &target, const char *name) { + LLDB_RECORD_METHOD(lldb::SBValue, SBModule, FindFirstGlobalVariable, + (lldb::SBTarget &, const char *), target, name); + SBValueList sb_value_list(FindGlobalVariables(target, name, 1)); if (sb_value_list.IsValid() && sb_value_list.GetSize() > 0) - return sb_value_list.GetValueAtIndex(0); - return SBValue(); + return LLDB_RECORD_RESULT(sb_value_list.GetValueAtIndex(0)); + return LLDB_RECORD_RESULT(SBValue()); } lldb::SBType SBModule::FindFirstType(const char *name_cstr) { + LLDB_RECORD_METHOD(lldb::SBType, SBModule, FindFirstType, (const char *), + name_cstr); + SBType sb_type; ModuleSP module_sp(GetSP()); if (name_cstr && module_sp) { @@ -420,21 +510,27 @@ lldb::SBType SBModule::FindFirstType(const char *name_cstr) { sb_type = SBType(type_system->GetBuiltinTypeByName(name)); } } - return sb_type; + return LLDB_RECORD_RESULT(sb_type); } lldb::SBType SBModule::GetBasicType(lldb::BasicType type) { + LLDB_RECORD_METHOD(lldb::SBType, SBModule, GetBasicType, (lldb::BasicType), + type); + ModuleSP module_sp(GetSP()); if (module_sp) { TypeSystem *type_system = module_sp->GetTypeSystemForLanguage(eLanguageTypeC); if (type_system) - return SBType(type_system->GetBasicTypeFromAST(type)); + return LLDB_RECORD_RESULT(SBType(type_system->GetBasicTypeFromAST(type))); } - return SBType(); + return LLDB_RECORD_RESULT(SBType()); } lldb::SBTypeList SBModule::FindTypes(const char *type) { + LLDB_RECORD_METHOD(lldb::SBTypeList, SBModule, FindTypes, (const char *), + type); + SBTypeList retval; ModuleSP module_sp(GetSP()); @@ -463,40 +559,49 @@ lldb::SBTypeList SBModule::FindTypes(const char *type) { } } - return retval; + return LLDB_RECORD_RESULT(retval); } lldb::SBType SBModule::GetTypeByID(lldb::user_id_t uid) { + LLDB_RECORD_METHOD(lldb::SBType, SBModule, GetTypeByID, (lldb::user_id_t), + uid); + ModuleSP module_sp(GetSP()); if (module_sp) { SymbolVendor *vendor = module_sp->GetSymbolVendor(); if (vendor) { Type *type_ptr = vendor->ResolveTypeUID(uid); if (type_ptr) - return SBType(type_ptr->shared_from_this()); + return LLDB_RECORD_RESULT(SBType(type_ptr->shared_from_this())); } } - return SBType(); + return LLDB_RECORD_RESULT(SBType()); } lldb::SBTypeList SBModule::GetTypes(uint32_t type_mask) { + LLDB_RECORD_METHOD(lldb::SBTypeList, SBModule, GetTypes, (uint32_t), + type_mask); + SBTypeList sb_type_list; ModuleSP module_sp(GetSP()); if (!module_sp) - return sb_type_list; + return LLDB_RECORD_RESULT(sb_type_list); SymbolVendor *vendor = module_sp->GetSymbolVendor(); if (!vendor) - return sb_type_list; + return LLDB_RECORD_RESULT(sb_type_list); TypeClass type_class = static_cast<TypeClass>(type_mask); TypeList type_list; vendor->GetTypes(NULL, type_class, type_list); sb_type_list.m_opaque_up->Append(type_list); - return sb_type_list; + return LLDB_RECORD_RESULT(sb_type_list); } SBSection SBModule::FindSection(const char *sect_name) { + LLDB_RECORD_METHOD(lldb::SBSection, SBModule, FindSection, (const char *), + sect_name); + SBSection sb_section; ModuleSP module_sp(GetSP()); @@ -512,10 +617,12 @@ SBSection SBModule::FindSection(const char *sect_name) { } } } - return sb_section; + return LLDB_RECORD_RESULT(sb_section); } lldb::ByteOrder SBModule::GetByteOrder() { + LLDB_RECORD_METHOD_NO_ARGS(lldb::ByteOrder, SBModule, GetByteOrder); + ModuleSP module_sp(GetSP()); if (module_sp) return module_sp->GetArchitecture().GetByteOrder(); @@ -523,6 +630,8 @@ lldb::ByteOrder SBModule::GetByteOrder() { } const char *SBModule::GetTriple() { + LLDB_RECORD_METHOD_NO_ARGS(const char *, SBModule, GetTriple); + ModuleSP module_sp(GetSP()); if (module_sp) { std::string triple(module_sp->GetArchitecture().GetTriple().str()); @@ -536,6 +645,8 @@ const char *SBModule::GetTriple() { } uint32_t SBModule::GetAddressByteSize() { + LLDB_RECORD_METHOD_NO_ARGS(uint32_t, SBModule, GetAddressByteSize); + ModuleSP module_sp(GetSP()); if (module_sp) return module_sp->GetArchitecture().GetAddressByteSize(); @@ -543,6 +654,9 @@ uint32_t SBModule::GetAddressByteSize() { } uint32_t SBModule::GetVersion(uint32_t *versions, uint32_t num_versions) { + LLDB_RECORD_METHOD(uint32_t, SBModule, GetVersion, (uint32_t *, uint32_t), + versions, num_versions); + llvm::VersionTuple version; if (ModuleSP module_sp = GetSP()) version = module_sp->GetVersion(); @@ -569,6 +683,9 @@ uint32_t SBModule::GetVersion(uint32_t *versions, uint32_t num_versions) { } lldb::SBFileSpec SBModule::GetSymbolFileSpec() const { + LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::SBFileSpec, SBModule, + GetSymbolFileSpec); + lldb::SBFileSpec sb_file_spec; ModuleSP module_sp(GetSP()); if (module_sp) { @@ -576,10 +693,13 @@ lldb::SBFileSpec SBModule::GetSymbolFileSpec() const { if (symbol_vendor_ptr) sb_file_spec.SetFileSpec(symbol_vendor_ptr->GetMainFileSpec()); } - return sb_file_spec; + return LLDB_RECORD_RESULT(sb_file_spec); } lldb::SBAddress SBModule::GetObjectFileHeaderAddress() const { + LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::SBAddress, SBModule, + GetObjectFileHeaderAddress); + lldb::SBAddress sb_addr; ModuleSP module_sp(GetSP()); if (module_sp) { @@ -587,10 +707,13 @@ lldb::SBAddress SBModule::GetObjectFileHeaderAddress() const { if (objfile_ptr) sb_addr.ref() = objfile_ptr->GetBaseAddress(); } - return sb_addr; + return LLDB_RECORD_RESULT(sb_addr); } lldb::SBAddress SBModule::GetObjectFileEntryPointAddress() const { + LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::SBAddress, SBModule, + GetObjectFileEntryPointAddress); + lldb::SBAddress sb_addr; ModuleSP module_sp(GetSP()); if (module_sp) { @@ -598,5 +721,5 @@ lldb::SBAddress SBModule::GetObjectFileEntryPointAddress() const { if (objfile_ptr) sb_addr.ref() = objfile_ptr->GetEntryPointAddress(); } - return sb_addr; + return LLDB_RECORD_RESULT(sb_addr); } |