apolyakov created this revision. apolyakov added reviewers: aprantl, clayborg.
The new API allows to find a list of compile units related to target/module. https://reviews.llvm.org/D48801 Files: include/lldb/API/SBModule.h include/lldb/API/SBTarget.h scripts/interface/SBModule.i scripts/interface/SBTarget.i source/API/SBModule.cpp source/API/SBTarget.cpp
Index: source/API/SBTarget.cpp =================================================================== --- source/API/SBTarget.cpp +++ source/API/SBTarget.cpp @@ -1548,6 +1548,18 @@ return sb_module; } +SBSymbolContextList +SBTarget::FindCompileUnits(const SBFileSpec &sb_file_spec) { + SBSymbolContextList sb_sc_list; + const TargetSP target_sp(GetSP()); + if (target_sp && sb_file_spec.IsValid()) { + const bool append = true; + target_sp->GetImages().FindCompileUnits(*sb_file_spec, + append, *sb_sc_list); + } + return sb_sc_list; +} + lldb::ByteOrder SBTarget::GetByteOrder() { TargetSP target_sp(GetSP()); if (target_sp) Index: source/API/SBModule.cpp =================================================================== --- source/API/SBModule.cpp +++ source/API/SBModule.cpp @@ -253,6 +253,17 @@ return sb_cu; } +SBSymbolContextList +SBModule::FindCompileUnits(const 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; +} + static Symtab *GetUnifiedSymbolTable(const lldb::ModuleSP &module_sp) { if (module_sp) { SymbolVendor *symbols = module_sp->GetSymbolVendor(); Index: scripts/interface/SBTarget.i =================================================================== --- scripts/interface/SBTarget.i +++ scripts/interface/SBTarget.i @@ -410,6 +410,9 @@ lldb::SBModule FindModule (const lldb::SBFileSpec &file_spec); + lldb::SBSymbolContextList + FindCompileUnits (const lldb::SBFileSpec &sb_file_spec); + lldb::ByteOrder GetByteOrder (); Index: scripts/interface/SBModule.i =================================================================== --- scripts/interface/SBModule.i +++ scripts/interface/SBModule.i @@ -179,6 +179,9 @@ lldb::SBCompileUnit GetCompileUnitAtIndex (uint32_t); + lldb::SBSymbolContextList + FindCompileUnits (const lldb::SBFileSpec &sb_file_spec); + size_t GetNumSymbols (); Index: include/lldb/API/SBTarget.h =================================================================== --- include/lldb/API/SBTarget.h +++ include/lldb/API/SBTarget.h @@ -295,6 +295,9 @@ lldb::SBModule FindModule(const lldb::SBFileSpec &file_spec); + lldb::SBSymbolContextList + FindCompileUnits(const lldb::SBFileSpec &sb_file_spec); + lldb::ByteOrder GetByteOrder(); uint32_t GetAddressByteSize(); Index: include/lldb/API/SBModule.h =================================================================== --- include/lldb/API/SBModule.h +++ include/lldb/API/SBModule.h @@ -129,6 +129,9 @@ lldb::SBCompileUnit GetCompileUnitAtIndex(uint32_t); + lldb::SBSymbolContextList + FindCompileUnits(const lldb::SBFileSpec &sb_file_spec); + size_t GetNumSymbols(); lldb::SBSymbol GetSymbolAtIndex(size_t idx);
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits