[Lldb-commits] [PATCH] D48782: LLDB Test Suite: Provide an Option to run all tests with Dwarf Package Format (DWP).
alexshap added inline comments. Comment at: packages/Python/lldbsuite/test/make/Makefile.rules:238 +ifneq (,$(wildcard $(LLVM_DWP))) + MAKE_DWP=YES aprantl wrote: > Is the fact this this is *llvm-*dwp critical, or are llvm-dwp and GNU dwp > interchangeable? In the latter case, I'd prefer to drop the LLVM part from > the variable. llvm-dwp and dwp should both work https://reviews.llvm.org/D48782 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D48782: LLDB Test Suite: Provide an Option to run all tests with Dwarf Package Format (DWP).
alexshap added a comment. @labath > I am not denying that there is value in running the dotest suite in all of > these modes. In fact, I think that (the fact that we can use the same tests > to exercise a lot of different scenarios) is one of the strengths ?>of our > test suite. However, I don't believe all of these modes should be inflicted > onto everyone running lldb tests or be our first and only line of defense > against regressions. for what it's worth - not sure how much you care about my opinion, but i think it's an important point but it doesn't actually contradict or prevent your second point regarding adding regression tests using lldb-test, however i think those should be added over time (sadly no tests were added when the support for .dwp was implemented / introduced) (not in this patch). I think that the approach of this patch is still useful, this mode can be off by default, but if smb needs to run all the tests with dwps - it's easy to do by passing or setting a variable (for example). https://reviews.llvm.org/D48782 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D39825: [lldb] Fix cu_offset for dwo/dwp used by DWARFCompileUnit::Index
alexshap created this revision. Herald added subscribers: JDevlieghere, aprantl. At the moment for DIERefs coming from DWO/DWP LLDB expects cu_offset to be equal to the offset of the original compilation unit. This invariant is ensured during the "indexing" of DIEs of the original SymbolFileDWARF and during the "retrieval" (see, for example, SymbolFileDWARFDwo::GetDIE(const DIERef &die_ref) ) as well. However any call of SymbolFileDWARFDwo::Index would violate this invariant since GetOffset() would return 0 in this case (and later the various asserts would fire). The diff addresses the issue. Repository: rL LLVM https://reviews.llvm.org/D39825 Files: source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h === --- source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h +++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h @@ -45,6 +45,10 @@ return nullptr; } + DWARFCompileUnit* GetBaseCompileUnit() override { +return m_base_dwarf_cu; + } + protected: void LoadSectionData(lldb::SectionType sect_type, lldb_private::DWARFDataExtractor &data) override; Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h === --- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h +++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h @@ -299,6 +299,11 @@ GetDwoSymbolFileForCompileUnit(DWARFCompileUnit &dwarf_cu, const DWARFDebugInfoEntry &cu_die); + // For regular SymbolFileDWARF instances the method returns nullptr, + // for the instances of the subclass SymbolFileDWARFDwo + // the method returns a pointer to the base compile unit. + virtual DWARFCompileUnit* GetBaseCompileUnit(); + protected: typedef llvm::DenseMap DIEToTypePtr; Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp === --- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -209,6 +209,10 @@ return nullptr; } +DWARFCompileUnit* SymbolFileDWARF::GetBaseCompileUnit() { + return nullptr; +} + void SymbolFileDWARF::Initialize() { LogChannelDWARF::Initialize(); PluginManager::RegisterPlugin(GetPluginNameStatic(), Index: source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp === --- source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp +++ source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp @@ -634,14 +634,23 @@ DWARFFormValue::GetFixedFormSizesForAddressSize(GetAddressByteSize(), m_is_dwarf64); - IndexPrivate(this, cu_language, fixed_form_sizes, GetOffset(), func_basenames, + dw_offset_t cu_offset = DW_INVALID_OFFSET; + // m_dwarf2Data->GetBaseCompileUnit() will return non null + // if m_dwarf2Data represents a DWO or DWP file. + // In this case the offset of the base compile unit should be used. + if (const DWARFCompileUnit *base_cu = m_dwarf2Data->GetBaseCompileUnit()) +cu_offset = base_cu->GetOffset(); + else +cu_offset = GetOffset(); + + IndexPrivate(this, cu_language, fixed_form_sizes, cu_offset, func_basenames, func_fullnames, func_methods, func_selectors, objc_class_selectors, globals, types, namespaces); SymbolFileDWARFDwo *dwo_symbol_file = GetDwoSymbolFile(); if (dwo_symbol_file) { IndexPrivate(dwo_symbol_file->GetCompileUnit(), cu_language, - fixed_form_sizes, GetOffset(), func_basenames, func_fullnames, + fixed_form_sizes, cu_offset, func_basenames, func_fullnames, func_methods, func_selectors, objc_class_selectors, globals, types, namespaces); } Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h === --- source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h +++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h @@ -45,6 +45,10 @@ return nullptr; } + DWARFCompileUnit* GetBaseCompileUnit() override { +return m_base_dwarf_cu; + } + protected: void LoadSectionData(lldb::SectionType sect_type, lldb_private::DWARFDataExtractor &data) override; Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h === --- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h +++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h @@ -299,6 +299,11 @@ GetDwoSymbolFileForCompileUnit(DWARFCompileUnit &dwarf_cu, con
[Lldb-commits] [PATCH] D39825: [lldb] Fix cu_offset for dwo/dwp used by DWARFCompileUnit::Index
alexshap added a comment. @tberghammer - for example, any call of SymbolFileDWARF::FindCompleteObjCDefinitionTypeForDIE (with an object of the type SymbolFileDWARFDwo) will trigger indexing of the dwo file. @labath - yeah, i will add a test & update this patch Repository: rL LLVM https://reviews.llvm.org/D39825 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D39825: [lldb] Fix cu_offset for dwo/dwp used by DWARFCompileUnit::Index
alexshap added a comment. @tberghammer, SymbolFileDWARF (the base class of SymbolFileDWARFDwo) calls Index() "lazily" in may places, so indexing of dwo happens almost inevitably (at the moment) (FindCompleteObjCDefinitionTypeForDIE is just one example). > because this way you will index the compile unit twice (once from the main > object file and once from the dwo), > then create 2 CompilerType for the 2 indexed version and will start hitting > random issues in > expression evaluation when clang will get confused by 2 declaration for the > same type. there are two separate CompileUnits here, not one, There is a compile unit represented by m_base_dwarf_cu (roughly speaking for .o) and and there is another one (which we can get, for example, via SymbolFileDWARFDwo::GetCompileUnit()) (roughly speaking for dwo). (please, correct me if i'm wrong). For the latter GetOffset() would typically return 0, for the former GetOffset() typically returns the higher 32 bits of Id. Repository: rL LLVM https://reviews.llvm.org/D39825 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D39825: [lldb] Fix cu_offset for dwo/dwp used by DWARFCompileUnit::Index
alexshap added a comment. i'd like to think about this problem a little bit more (maybe i'm missing smth) + as i said above - will add a test Repository: rL LLVM https://reviews.llvm.org/D39825 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D39825: [lldb] Fix cu_offset for dwo/dwp used by DWARFCompileUnit::Index
alexshap added a comment. > The main point is that you should almost always interact with the > SymbolFileDWARF instance belonging to the main object file and it > (actually DWARFCompileUnit) will know when to access data from the Dwo >file > instead. > The original goal was to not leak pointers to SymbolFileDWARFDwo instances > out from symbol file dwarf and the dwarf parsing logic. i see ur point, let me think a bit more about it. One thing which i have on my mind - with that approach it's not clear (not the right wording, but anyway) how would "recursive" queries work. Whenever the "owner" SymbolFileDWARF interacts with the SymbolFileDWARFDwo (obtained by cu->GetDwoSymbolFile()) the latter (SymbolFileDWARFDwo) may try to query itself (internally), and we will face some other issues again (if i am not mistaken). Repository: rL LLVM https://reviews.llvm.org/D39825 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D39825: [lldb] Fix cu_offset for dwo/dwp used by DWARFCompileUnit::Index
alexshap updated this revision to Diff 122389. alexshap added a comment. Change the approach: add assert to ensure we don't double index .dwo files, rerun the tests. @tberghammer - many thanks for the suggestions. p.s. didn't add new tests (in this commit) - standalone repo is not trivial (objc on linux) and requires more work - probably would prefer to do this later as a follow-up (i.e. at the moment dwps are not tested yet either) Repository: rL LLVM https://reviews.llvm.org/D39825 Files: source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h === --- source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h +++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h @@ -33,6 +33,9 @@ lldb_private::DWARFExpression::LocationListFormat GetLocationListFormat() const override; + size_t GetObjCMethodDIEOffsets(lldb_private::ConstString class_name, + DIEArray &method_die_offsets) override; + lldb_private::TypeSystem * GetTypeSystemForLanguage(lldb::LanguageType language) override; @@ -45,6 +48,8 @@ return nullptr; } + DWARFCompileUnit *GetBaseCompileUnit() override; + protected: void LoadSectionData(lldb::SectionType sect_type, lldb_private::DWARFDataExtractor &data) override; @@ -62,6 +67,10 @@ lldb::TypeSP FindDefinitionTypeForDWARFDeclContext( const DWARFDeclContext &die_decl_ctx) override; + lldb::TypeSP FindCompleteObjCDefinitionTypeForDIE( + const DWARFDIE &die, const lldb_private::ConstString &type_name, + bool must_be_implementation) override; + SymbolFileDWARF *GetBaseSymbolFile(); lldb::ObjectFileSP m_obj_file_sp; Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp === --- source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp +++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp @@ -99,6 +99,12 @@ return GetBaseSymbolFile()->GetForwardDeclClangTypeToDie(); } +size_t SymbolFileDWARFDwo::GetObjCMethodDIEOffsets( +lldb_private::ConstString class_name, DIEArray &method_die_offsets) { + return GetBaseSymbolFile()->GetObjCMethodDIEOffsets( + class_name, method_die_offsets); +} + UniqueDWARFASTTypeMap &SymbolFileDWARFDwo::GetUniqueDWARFASTTypeMap() { return GetBaseSymbolFile()->GetUniqueDWARFASTTypeMap(); } @@ -109,6 +115,17 @@ die_decl_ctx); } +lldb::TypeSP SymbolFileDWARFDwo::FindCompleteObjCDefinitionTypeForDIE( +const DWARFDIE &die, const lldb_private::ConstString &type_name, +bool must_be_implementation) { + return GetBaseSymbolFile()->FindCompleteObjCDefinitionTypeForDIE( + die, type_name, must_be_implementation); +} + +DWARFCompileUnit *SymbolFileDWARFDwo::GetBaseCompileUnit() { + return m_base_dwarf_cu; +} + SymbolFileDWARF *SymbolFileDWARFDwo::GetBaseSymbolFile() { return m_base_dwarf_cu->GetSymbolFileDWARF(); } Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h === --- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h +++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h @@ -276,8 +276,8 @@ GetCompUnitForDWARFCompUnit(DWARFCompileUnit *dwarf_cu, uint32_t cu_idx = UINT32_MAX); - size_t GetObjCMethodDIEOffsets(lldb_private::ConstString class_name, - DIEArray &method_die_offsets); + virtual size_t GetObjCMethodDIEOffsets(lldb_private::ConstString class_name, + DIEArray &method_die_offsets); bool Supports_DW_AT_APPLE_objc_complete_type(DWARFCompileUnit *cu); @@ -299,6 +299,11 @@ GetDwoSymbolFileForCompileUnit(DWARFCompileUnit &dwarf_cu, const DWARFDebugInfoEntry &cu_die); + // For regular SymbolFileDWARF instances the method returns nullptr, + // for the instances of the subclass SymbolFileDWARFDwo + // the method returns a pointer to the base compile unit. + virtual DWARFCompileUnit *GetBaseCompileUnit(); + protected: typedef llvm::DenseMap DIEToTypePtr; @@ -392,7 +397,7 @@ virtual lldb::TypeSP FindDefinitionTypeForDWARFDeclContext(const DWARFDeclContext &die_decl_ctx); - lldb::TypeSP FindCompleteObjCDefinitionTypeForDIE( + virtual lldb::TypeSP FindCompleteObjCDefinitionTypeForDIE( const DWARFDIE &die, const lldb_private::ConstString &type_name, bool must_be_implementation); Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp === --- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.c
[Lldb-commits] [PATCH] D39884: [lldb] Remove unused method declaration
This revision was automatically updated to reflect the committed changes. Closed by commit rL317919: [lldb] Remove unused method declaration (authored by alexshap). Changed prior to commit: https://reviews.llvm.org/D39884?vs=122379&id=122493#toc Repository: rL LLVM https://reviews.llvm.org/D39884 Files: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h === --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h @@ -396,10 +396,6 @@ const DWARFDIE &die, const lldb_private::ConstString &type_name, bool must_be_implementation); - lldb::TypeSP - FindCompleteObjCDefinitionType(const lldb_private::ConstString &type_name, - bool header_definition_ok); - lldb_private::Symbol * GetObjCClassSymbol(const lldb_private::ConstString &objc_class_name); Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h === --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h @@ -396,10 +396,6 @@ const DWARFDIE &die, const lldb_private::ConstString &type_name, bool must_be_implementation); - lldb::TypeSP - FindCompleteObjCDefinitionType(const lldb_private::ConstString &type_name, - bool header_definition_ok); - lldb_private::Symbol * GetObjCClassSymbol(const lldb_private::ConstString &objc_class_name); ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D39825: [lldb] Ensure that dwo/dwp are not double-indexed
This revision was automatically updated to reflect the committed changes. Closed by commit rL318554: [lldb] Ensure that dwo/dwp are not double-indexed (authored by alexshap). Changed prior to commit: https://reviews.llvm.org/D39825?vs=122389&id=123403#toc Repository: rL LLVM https://reviews.llvm.org/D39825 Files: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp === --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -209,6 +209,10 @@ return nullptr; } +DWARFCompileUnit *SymbolFileDWARF::GetBaseCompileUnit() { + return nullptr; +} + void SymbolFileDWARF::Initialize() { LogChannelDWARF::Initialize(); PluginManager::RegisterPlugin(GetPluginNameStatic(), Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp === --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp @@ -620,6 +620,10 @@ NameToDIE &objc_class_selectors, NameToDIE &globals, NameToDIE &types, NameToDIE &namespaces) { + assert(!m_dwarf2Data->GetBaseCompileUnit() && + "DWARFCompileUnit associated with .dwo or .dwp " + "should not be indexed directly"); + Log *log(LogChannelDWARF::GetLogIfAll(DWARF_LOG_LOOKUPS)); if (log) { Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h === --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h @@ -276,8 +276,8 @@ GetCompUnitForDWARFCompUnit(DWARFCompileUnit *dwarf_cu, uint32_t cu_idx = UINT32_MAX); - size_t GetObjCMethodDIEOffsets(lldb_private::ConstString class_name, - DIEArray &method_die_offsets); + virtual size_t GetObjCMethodDIEOffsets(lldb_private::ConstString class_name, + DIEArray &method_die_offsets); bool Supports_DW_AT_APPLE_objc_complete_type(DWARFCompileUnit *cu); @@ -299,6 +299,11 @@ GetDwoSymbolFileForCompileUnit(DWARFCompileUnit &dwarf_cu, const DWARFDebugInfoEntry &cu_die); + // For regular SymbolFileDWARF instances the method returns nullptr, + // for the instances of the subclass SymbolFileDWARFDwo + // the method returns a pointer to the base compile unit. + virtual DWARFCompileUnit *GetBaseCompileUnit(); + protected: typedef llvm::DenseMap DIEToTypePtr; @@ -392,7 +397,7 @@ virtual lldb::TypeSP FindDefinitionTypeForDWARFDeclContext(const DWARFDeclContext &die_decl_ctx); - lldb::TypeSP FindCompleteObjCDefinitionTypeForDIE( + virtual lldb::TypeSP FindCompleteObjCDefinitionTypeForDIE( const DWARFDIE &die, const lldb_private::ConstString &type_name, bool must_be_implementation); Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp === --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp @@ -99,6 +99,12 @@ return GetBaseSymbolFile()->GetForwardDeclClangTypeToDie(); } +size_t SymbolFileDWARFDwo::GetObjCMethodDIEOffsets( +lldb_private::ConstString class_name, DIEArray &method_die_offsets) { + return GetBaseSymbolFile()->GetObjCMethodDIEOffsets( + class_name, method_die_offsets); +} + UniqueDWARFASTTypeMap &SymbolFileDWARFDwo::GetUniqueDWARFASTTypeMap() { return GetBaseSymbolFile()->GetUniqueDWARFASTTypeMap(); } @@ -109,6 +115,17 @@ die_decl_ctx); } +lldb::TypeSP SymbolFileDWARFDwo::FindCompleteObjCDefinitionTypeForDIE( +const DWARFDIE &die, const lldb_private::ConstString &type_name, +bool must_be_implementation) { + return GetBaseSymbolFile()->FindCompleteObjCDefinitionTypeForDIE( + die, type_name, must_be_implementation); +} + +DWARFCompileUnit *SymbolFileDWARFDwo::GetBaseCompileUnit() { + return m_base_dwarf_cu; +} + SymbolFileDWARF *SymbolFileDWARFDwo::GetBaseSymbolFile() { return m_base_dwarf_cu->GetSymbolFileDWARF(); } Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h === --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h +++ lldb/trunk/source/Pl
[Lldb-commits] [PATCH] D40587: [lldb] Minor fixes for in TaskPool
alexshap created this revision. 1. Move everything into the namespace lldb_private 2. Add missing std::move in TaskPoolImpl::Worker 3. std::thread::hardware_concurrency may return 0, handle this case correctly Repository: rL LLVM https://reviews.llvm.org/D40587 Files: include/lldb/Host/TaskPool.h source/Host/common/TaskPool.cpp Index: source/Host/common/TaskPool.cpp === --- source/Host/common/TaskPool.cpp +++ source/Host/common/TaskPool.cpp @@ -14,6 +14,8 @@ #include// for queue #include // for thread +namespace lldb_private { + namespace { class TaskPoolImpl { public: @@ -46,13 +48,20 @@ TaskPoolImpl::TaskPoolImpl() : m_thread_count(0) {} +unsigned GetHardwareConcurrencyHint() { + // std::thread::hardware_concurrency may return 0 + // if the value is not well defined or not computable. + static const unsigned g_hardware_concurrency = +std::max(1u, std::thread::hardware_concurrency()); + return g_hardware_concurrency; +} + void TaskPoolImpl::AddTask(std::function &&task_fn) { - static const uint32_t max_threads = std::thread::hardware_concurrency(); const size_t min_stack_size = 8 * 1024 * 1024; std::unique_lock lock(m_tasks_mutex); m_tasks.emplace(std::move(task_fn)); - if (m_thread_count < max_threads) { + if (m_thread_count < GetHardwareConcurrencyHint()) { m_thread_count++; // Note that this detach call needs to happen with the m_tasks_mutex held. // This prevents the thread @@ -77,7 +86,7 @@ break; } -std::function f = pool->m_tasks.front(); +std::function f = std::move(pool->m_tasks.front()); pool->m_tasks.pop(); lock.unlock(); @@ -87,10 +96,9 @@ void TaskMapOverInt(size_t begin, size_t end, const llvm::function_ref &func) { + const size_t num_workers = std::min(end, GetHardwareConcurrencyHint()); std::atomic idx{begin}; - size_t num_workers = - std::min(end, std::thread::hardware_concurrency()); - + auto wrapper = [&idx, end, &func]() { while (true) { size_t i = idx.fetch_add(1); @@ -107,3 +115,6 @@ for (size_t i = 0; i < num_workers; i++) futures[i].wait(); } + +} // namespace lldb_private + Index: include/lldb/Host/TaskPool.h === --- include/lldb/Host/TaskPool.h +++ include/lldb/Host/TaskPool.h @@ -18,6 +18,8 @@ #include// for mutex, unique_lock, condition_variable #include // for forward, result_of, move +namespace lldb_private { + // Global TaskPool class for running tasks in parallel on a set of worker thread // created the first // time the task pool is used. The TaskPool provide no guarantee about the order @@ -89,4 +91,8 @@ void TaskMapOverInt(size_t begin, size_t end, const llvm::function_ref &func); +unsigned GetHardwareConcurrencyHint(); + +} // namespace lldb_private + #endif // #ifndef utility_TaskPool_h_ Index: source/Host/common/TaskPool.cpp === --- source/Host/common/TaskPool.cpp +++ source/Host/common/TaskPool.cpp @@ -14,6 +14,8 @@ #include// for queue #include // for thread +namespace lldb_private { + namespace { class TaskPoolImpl { public: @@ -46,13 +48,20 @@ TaskPoolImpl::TaskPoolImpl() : m_thread_count(0) {} +unsigned GetHardwareConcurrencyHint() { + // std::thread::hardware_concurrency may return 0 + // if the value is not well defined or not computable. + static const unsigned g_hardware_concurrency = +std::max(1u, std::thread::hardware_concurrency()); + return g_hardware_concurrency; +} + void TaskPoolImpl::AddTask(std::function &&task_fn) { - static const uint32_t max_threads = std::thread::hardware_concurrency(); const size_t min_stack_size = 8 * 1024 * 1024; std::unique_lock lock(m_tasks_mutex); m_tasks.emplace(std::move(task_fn)); - if (m_thread_count < max_threads) { + if (m_thread_count < GetHardwareConcurrencyHint()) { m_thread_count++; // Note that this detach call needs to happen with the m_tasks_mutex held. // This prevents the thread @@ -77,7 +86,7 @@ break; } -std::function f = pool->m_tasks.front(); +std::function f = std::move(pool->m_tasks.front()); pool->m_tasks.pop(); lock.unlock(); @@ -87,10 +96,9 @@ void TaskMapOverInt(size_t begin, size_t end, const llvm::function_ref &func) { + const size_t num_workers = std::min(end, GetHardwareConcurrencyHint()); std::atomic idx{begin}; - size_t num_workers = - std::min(end, std::thread::hardware_concurrency()); - + auto wrapper = [&idx, end, &func]() { while (true) { size_t i = idx.fetch_add(1); @@ -107,3 +115,6 @@ for (size_t i = 0; i < num_workers; i++) futures[i].wait(); } + +} // namespace lldb_private + Index: include/lldb/Host/TaskPool.h
[Lldb-commits] [PATCH] D40587: [lldb] Minor fixes for in TaskPool
alexshap updated this revision to Diff 124661. alexshap added a comment. fix the tests Repository: rL LLVM https://reviews.llvm.org/D40587 Files: include/lldb/Host/TaskPool.h source/Host/common/TaskPool.cpp unittests/Host/TaskPoolTest.cpp Index: unittests/Host/TaskPoolTest.cpp === --- unittests/Host/TaskPoolTest.cpp +++ unittests/Host/TaskPoolTest.cpp @@ -2,6 +2,8 @@ #include "lldb/Host/TaskPool.h" +using namespace lldb_private; + TEST(TaskPoolTest, AddTask) { auto fn = [](int x) { return x * x + 1; }; Index: source/Host/common/TaskPool.cpp === --- source/Host/common/TaskPool.cpp +++ source/Host/common/TaskPool.cpp @@ -14,6 +14,8 @@ #include// for queue #include // for thread +namespace lldb_private { + namespace { class TaskPoolImpl { public: @@ -46,13 +48,20 @@ TaskPoolImpl::TaskPoolImpl() : m_thread_count(0) {} +unsigned GetHardwareConcurrencyHint() { + // std::thread::hardware_concurrency may return 0 + // if the value is not well defined or not computable. + static const unsigned g_hardware_concurrency = +std::max(1u, std::thread::hardware_concurrency()); + return g_hardware_concurrency; +} + void TaskPoolImpl::AddTask(std::function &&task_fn) { - static const uint32_t max_threads = std::thread::hardware_concurrency(); const size_t min_stack_size = 8 * 1024 * 1024; std::unique_lock lock(m_tasks_mutex); m_tasks.emplace(std::move(task_fn)); - if (m_thread_count < max_threads) { + if (m_thread_count < GetHardwareConcurrencyHint()) { m_thread_count++; // Note that this detach call needs to happen with the m_tasks_mutex held. // This prevents the thread @@ -77,7 +86,7 @@ break; } -std::function f = pool->m_tasks.front(); +std::function f = std::move(pool->m_tasks.front()); pool->m_tasks.pop(); lock.unlock(); @@ -87,10 +96,9 @@ void TaskMapOverInt(size_t begin, size_t end, const llvm::function_ref &func) { + const size_t num_workers = std::min(end, GetHardwareConcurrencyHint()); std::atomic idx{begin}; - size_t num_workers = - std::min(end, std::thread::hardware_concurrency()); - + auto wrapper = [&idx, end, &func]() { while (true) { size_t i = idx.fetch_add(1); @@ -107,3 +115,6 @@ for (size_t i = 0; i < num_workers; i++) futures[i].wait(); } + +} // namespace lldb_private + Index: include/lldb/Host/TaskPool.h === --- include/lldb/Host/TaskPool.h +++ include/lldb/Host/TaskPool.h @@ -18,6 +18,8 @@ #include// for mutex, unique_lock, condition_variable #include // for forward, result_of, move +namespace lldb_private { + // Global TaskPool class for running tasks in parallel on a set of worker thread // created the first // time the task pool is used. The TaskPool provide no guarantee about the order @@ -89,4 +91,8 @@ void TaskMapOverInt(size_t begin, size_t end, const llvm::function_ref &func); +unsigned GetHardwareConcurrencyHint(); + +} // namespace lldb_private + #endif // #ifndef utility_TaskPool_h_ Index: unittests/Host/TaskPoolTest.cpp === --- unittests/Host/TaskPoolTest.cpp +++ unittests/Host/TaskPoolTest.cpp @@ -2,6 +2,8 @@ #include "lldb/Host/TaskPool.h" +using namespace lldb_private; + TEST(TaskPoolTest, AddTask) { auto fn = [](int x) { return x * x + 1; }; Index: source/Host/common/TaskPool.cpp === --- source/Host/common/TaskPool.cpp +++ source/Host/common/TaskPool.cpp @@ -14,6 +14,8 @@ #include// for queue #include // for thread +namespace lldb_private { + namespace { class TaskPoolImpl { public: @@ -46,13 +48,20 @@ TaskPoolImpl::TaskPoolImpl() : m_thread_count(0) {} +unsigned GetHardwareConcurrencyHint() { + // std::thread::hardware_concurrency may return 0 + // if the value is not well defined or not computable. + static const unsigned g_hardware_concurrency = +std::max(1u, std::thread::hardware_concurrency()); + return g_hardware_concurrency; +} + void TaskPoolImpl::AddTask(std::function &&task_fn) { - static const uint32_t max_threads = std::thread::hardware_concurrency(); const size_t min_stack_size = 8 * 1024 * 1024; std::unique_lock lock(m_tasks_mutex); m_tasks.emplace(std::move(task_fn)); - if (m_thread_count < max_threads) { + if (m_thread_count < GetHardwareConcurrencyHint()) { m_thread_count++; // Note that this detach call needs to happen with the m_tasks_mutex held. // This prevents the thread @@ -77,7 +86,7 @@ break; } -std::function f = pool->m_tasks.front(); +std::function f = std::move(pool->m_tasks.front()); pool->m_tasks.pop(); lock.unlock(); @@ -
[Lldb-commits] [PATCH] D40587: [lldb] Minor fixes in TaskPool
This revision was automatically updated to reflect the committed changes. Closed by commit rL319492: [lldb] A few minor fixes in TaskPool (authored by alexshap). Changed prior to commit: https://reviews.llvm.org/D40587?vs=124661&id=125036#toc Repository: rL LLVM https://reviews.llvm.org/D40587 Files: lldb/trunk/include/lldb/Host/TaskPool.h lldb/trunk/source/Host/common/TaskPool.cpp lldb/trunk/unittests/Host/TaskPoolTest.cpp Index: lldb/trunk/unittests/Host/TaskPoolTest.cpp === --- lldb/trunk/unittests/Host/TaskPoolTest.cpp +++ lldb/trunk/unittests/Host/TaskPoolTest.cpp @@ -2,6 +2,8 @@ #include "lldb/Host/TaskPool.h" +using namespace lldb_private; + TEST(TaskPoolTest, AddTask) { auto fn = [](int x) { return x * x + 1; }; Index: lldb/trunk/source/Host/common/TaskPool.cpp === --- lldb/trunk/source/Host/common/TaskPool.cpp +++ lldb/trunk/source/Host/common/TaskPool.cpp @@ -14,6 +14,8 @@ #include// for queue #include // for thread +namespace lldb_private { + namespace { class TaskPoolImpl { public: @@ -46,13 +48,20 @@ TaskPoolImpl::TaskPoolImpl() : m_thread_count(0) {} +unsigned GetHardwareConcurrencyHint() { + // std::thread::hardware_concurrency may return 0 + // if the value is not well defined or not computable. + static const unsigned g_hardware_concurrency = +std::max(1u, std::thread::hardware_concurrency()); + return g_hardware_concurrency; +} + void TaskPoolImpl::AddTask(std::function &&task_fn) { - static const uint32_t max_threads = std::thread::hardware_concurrency(); const size_t min_stack_size = 8 * 1024 * 1024; std::unique_lock lock(m_tasks_mutex); m_tasks.emplace(std::move(task_fn)); - if (m_thread_count < max_threads) { + if (m_thread_count < GetHardwareConcurrencyHint()) { m_thread_count++; // Note that this detach call needs to happen with the m_tasks_mutex held. // This prevents the thread @@ -77,7 +86,7 @@ break; } -std::function f = pool->m_tasks.front(); +std::function f = std::move(pool->m_tasks.front()); pool->m_tasks.pop(); lock.unlock(); @@ -87,10 +96,9 @@ void TaskMapOverInt(size_t begin, size_t end, const llvm::function_ref &func) { + const size_t num_workers = std::min(end, GetHardwareConcurrencyHint()); std::atomic idx{begin}; - size_t num_workers = - std::min(end, std::thread::hardware_concurrency()); - + auto wrapper = [&idx, end, &func]() { while (true) { size_t i = idx.fetch_add(1); @@ -107,3 +115,6 @@ for (size_t i = 0; i < num_workers; i++) futures[i].wait(); } + +} // namespace lldb_private + Index: lldb/trunk/include/lldb/Host/TaskPool.h === --- lldb/trunk/include/lldb/Host/TaskPool.h +++ lldb/trunk/include/lldb/Host/TaskPool.h @@ -18,6 +18,8 @@ #include// for mutex, unique_lock, condition_variable #include // for forward, result_of, move +namespace lldb_private { + // Global TaskPool class for running tasks in parallel on a set of worker thread // created the first // time the task pool is used. The TaskPool provide no guarantee about the order @@ -89,4 +91,8 @@ void TaskMapOverInt(size_t begin, size_t end, const llvm::function_ref &func); +unsigned GetHardwareConcurrencyHint(); + +} // namespace lldb_private + #endif // #ifndef utility_TaskPool_h_ Index: lldb/trunk/unittests/Host/TaskPoolTest.cpp === --- lldb/trunk/unittests/Host/TaskPoolTest.cpp +++ lldb/trunk/unittests/Host/TaskPoolTest.cpp @@ -2,6 +2,8 @@ #include "lldb/Host/TaskPool.h" +using namespace lldb_private; + TEST(TaskPoolTest, AddTask) { auto fn = [](int x) { return x * x + 1; }; Index: lldb/trunk/source/Host/common/TaskPool.cpp === --- lldb/trunk/source/Host/common/TaskPool.cpp +++ lldb/trunk/source/Host/common/TaskPool.cpp @@ -14,6 +14,8 @@ #include// for queue #include // for thread +namespace lldb_private { + namespace { class TaskPoolImpl { public: @@ -46,13 +48,20 @@ TaskPoolImpl::TaskPoolImpl() : m_thread_count(0) {} +unsigned GetHardwareConcurrencyHint() { + // std::thread::hardware_concurrency may return 0 + // if the value is not well defined or not computable. + static const unsigned g_hardware_concurrency = +std::max(1u, std::thread::hardware_concurrency()); + return g_hardware_concurrency; +} + void TaskPoolImpl::AddTask(std::function &&task_fn) { - static const uint32_t max_threads = std::thread::hardware_concurrency(); const size_t min_stack_size = 8 * 1024 * 1024; std::unique_lock lock(m_tasks_mutex); m_tasks.emplace(std::move(task_fn)); - if (m_thread_count < max_threads) { + if (m_thread_count < GetHardw
[Lldb-commits] [PATCH] D42563: [lldb] attempt to fix DIERef::GetUID
alexshap created this revision. alexshap added reviewers: tberghammer, labath, clayborg. Herald added subscribers: llvm-commits, JDevlieghere, aprantl. A small test where the issue is easy to reproduce: a.cpp: int f() { return 1; } b.cpp: extern int f(); void g() { int y = 14; int x = f(); } int main() { g(); return 0; } g++ -O0 -g -gsplit-dwarf -c a.cpp -o a.o // with fission g++ -O0 -g -c b.cpp -o b.o // without fission g++ a.o b.o -o main.exe // the order matters run lldb br set --name g // WORKS FINE run // WORKS FINE frame variable// DOESN'T WORK So the problem is the following: on Linux dwarf->GetID() returns 0 (unless dwarf is an instance of SymbolFileDWARFDwo), > the higher 32 bits of the returned by DIERef::GetUID(SymbolFileDWARF *dwarf) > uid do not encode cu_offset. What happens next - in the constructor of DIERef the incorrect value of cu_offset is extracted from uid and propagates further. For example, inside SymbolFileDWARF::ParseVariablesForContext there is a call DWARFDIE function_die = info->GetDIE(DIERef(sc.function->GetID(), this)) - and because of the "broken" cu_offset (inside DIERef) the method GetDIE returns an invalid DWARFDIE. I don't like the proposed fix myself, maybe you have better ideas how to address the issue. Partially the complexity stems from the fact that DIERefs are used in many places => they need to contain the correct cu_offset. Next, it's important to keep in mind that one file may contain several compilation units => fixing SymbolFileDWARF::GetID doesn't seem to be an option. Anyway - suggestions are very welcome, maybe I'm missing smth. Test plan: make check-lldb Repository: rL LLVM https://reviews.llvm.org/D42563 Files: source/Plugins/SymbolFile/DWARF/DIERef.cpp Index: source/Plugins/SymbolFile/DWARF/DIERef.cpp === --- source/Plugins/SymbolFile/DWARF/DIERef.cpp +++ source/Plugins/SymbolFile/DWARF/DIERef.cpp @@ -13,6 +13,7 @@ #include "DWARFFormValue.h" #include "SymbolFileDWARF.h" #include "SymbolFileDWARFDebugMap.h" +#include "lldb/Symbol/ObjectFile.h" DIERef::DIERef() : cu_offset(DW_INVALID_OFFSET), die_offset(DW_INVALID_OFFSET) {} @@ -57,16 +58,21 @@ } lldb::user_id_t DIERef::GetUID(SymbolFileDWARF *dwarf) const { - //-- - // Each SymbolFileDWARF will set its ID to what is expected. - // - // SymbolFileDWARF, when used for DWARF with .o files on MacOSX, has the - // ID set to the compile unit index. - // - // SymbolFileDWARFDwo sets the ID to the compile unit offset. - //-- - if (dwarf && die_offset != DW_INVALID_OFFSET) -return dwarf->GetID() | die_offset; - else + if (!dwarf || die_offset == DW_INVALID_OFFSET) return LLDB_INVALID_UID; + + // For ELF targets the higher 32 bits of the returned id encode cu_offset + // which is used, for example, by DIERef. + lldb_private::ArchSpec arch; + if (dwarf->GetObjectFile()->GetArchitecture(arch) && + arch.GetTriple().isOSBinFormatELF()) { +// For SymbolFileDWARFDwo/SymbolFileDWARFDwoDwp +// the offset of the base compilation unit should be used. +uint64_t offset = + dwarf->GetBaseCompileUnit() ? dwarf->GetBaseCompileUnit()->GetOffset() : + cu_offset; +return (offset << 32) | die_offset; + } + + return dwarf->GetID() | die_offset; } Index: source/Plugins/SymbolFile/DWARF/DIERef.cpp === --- source/Plugins/SymbolFile/DWARF/DIERef.cpp +++ source/Plugins/SymbolFile/DWARF/DIERef.cpp @@ -13,6 +13,7 @@ #include "DWARFFormValue.h" #include "SymbolFileDWARF.h" #include "SymbolFileDWARFDebugMap.h" +#include "lldb/Symbol/ObjectFile.h" DIERef::DIERef() : cu_offset(DW_INVALID_OFFSET), die_offset(DW_INVALID_OFFSET) {} @@ -57,16 +58,21 @@ } lldb::user_id_t DIERef::GetUID(SymbolFileDWARF *dwarf) const { - //-- - // Each SymbolFileDWARF will set its ID to what is expected. - // - // SymbolFileDWARF, when used for DWARF with .o files on MacOSX, has the - // ID set to the compile unit index. - // - // SymbolFileDWARFDwo sets the ID to the compile unit offset. - //-- - if (dwarf && die_offset != DW_INVALID_OFFSET) -return dwarf->GetID() | die_offset; - else + if (!dwarf || die_offset == DW_INVALID_OFFSET) return LLDB_INVALID_UID; + + // For ELF targets the higher 32 bits of the returned id encode cu_offset + // which is used, for example, by DIERef. + lldb_private::ArchSpec arch; + if
[Lldb-commits] [PATCH] D42563: [lldb] attempt to fix DIERef::GetUID
alexshap added a comment. @davide - the test case is in the description but i can try to add it to the test suite. Repository: rL LLVM https://reviews.llvm.org/D42563 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D42563: [lldb] attempt to fix DIERef::GetUID
alexshap added a comment. @tberghammer > ELF specific as nothing really ties SymbolFileDWARF with the ELF format the only reason why it's currently guarded to ELF is the fact that for Mach-O uuid also encodes something and i didn't want to change that (see the comment in the old version of the code) (although i don't know if it's up to date). > Do you know who is using the partially incorrect value returned from here? yes, i do. I mentioned in the summary one example: > For example, inside SymbolFileDWARF::ParseVariablesForContext there is a call > DWARFDIE function_die = info->GetDIE(DIERef(sc.function->GetID(), this)) - > and because of the "broken" cu_offset (inside DIERef) the method GetDIE > returns an invalid DWARFDIE. If necessary, i can provide more details. > One possible idea what can provide a nice fix is to change > SymbolFileDWARF::GetID() to return (DW_INVALID_OFFSET << 32) and then treat > that value as a special case indicating that the compile unit offset >is > invalid and we should look for the DIE based on the die_offset part of the ID > only yeah, i thought about this as well, one thing that makes me worry - is die_offset sufficient to uniquely identify DIE ? otherwise dropping cu_offset might lead to similar hard-to-debug/hard-to-fix bugs/collisions Repository: rL LLVM https://reviews.llvm.org/D42563 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D42563: [lldb] attempt to fix DIERef::GetUID
alexshap added inline comments. Comment at: source/Plugins/SymbolFile/DWARF/DIERef.cpp:67-68 + lldb_private::ArchSpec arch; + if (dwarf->GetObjectFile()->GetArchitecture(arch) && + arch.GetTriple().isOSBinFormatELF()) { +// For SymbolFileDWARFDwo/SymbolFileDWARFDwoDwp clayborg wrote: > Why do this arch check? check? Why not just get rely on > dwarf->GetBaseCompileUnit()? Seem like we are doing more work than needed. the only reason why it's currently guarded to ELF is the fact that for Mach-O uuid also encodes something (if i am not mistaken) and i didn't want to change that (see the comment in the old version of the code) (although i don't know if it's up to date). If we don't need to check that we are dealing with ELF - I'm more than happy to remove it. Repository: rL LLVM https://reviews.llvm.org/D42563 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D42563: [lldb] attempt to fix DIERef::GetUID
alexshap updated this revision to Diff 131920. alexshap added a comment. Update, rerun the tests. Repository: rL LLVM https://reviews.llvm.org/D42563 Files: packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/Makefile packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/TestMixedDwarfBinary.py packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/a.c packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/b.c source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp === --- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -392,9 +392,10 @@ } SymbolFileDWARF::SymbolFileDWARF(ObjectFile *objfile) -: SymbolFile(objfile), UserID(0), // Used by SymbolFileDWARFDebugMap to when - // this class parses .o files to contain - // the .o file index/ID +: SymbolFile(objfile), + UserID(uint64_t(DW_INVALID_OFFSET) << 32), // Used by SymbolFileDWARFDebugMap to when + // this class parses .o files to contain + // the .o file index/ID m_debug_map_module_wp(), m_debug_map_symfile(NULL), m_data_debug_abbrev(), m_data_debug_aranges(), m_data_debug_frame(), m_data_debug_info(), m_data_debug_line(), m_data_debug_macro(), m_data_debug_loc(), Index: packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/b.c === --- /dev/null +++ packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/b.c @@ -0,0 +1,11 @@ +extern int f(); + +void g() { + int y = 14; + int x = f(); +} + +int main() { + g(); + return 0; +} Index: packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/a.c === --- /dev/null +++ packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/a.c @@ -0,0 +1,3 @@ +int f() { + return 1; +} Index: packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/TestMixedDwarfBinary.py === --- /dev/null +++ packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/TestMixedDwarfBinary.py @@ -0,0 +1,46 @@ +""" Testing explicit symbol loading via target symbols add. """ +import os +import lldb +import sys +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil + + +class TestMixedDwarfBinary(TestBase): +mydir = TestBase.compute_mydir(__file__) + +def setUp(self): +TestBase.setUp(self) + +@no_debug_info_test # Prevent the genaration of the dwarf version of this test +@add_test_categories(["dwo"]) +@skipUnlessPlatform(['linux']) +def test_target_symbols_add(self): +"""Test that 'frame variable' works +for the executable built from two source files compiled +with/whithout -gsplit-dwarf correspondingly.""" + +self.build() +exe = os.path.join(os.getcwd(), "main") + +self.target = self.dbg.CreateTarget(exe) +self.assertTrue(self.target, VALID_TARGET) + +main_bp = self.target.BreakpointCreateByName("g", "main") +self.assertTrue(main_bp, VALID_BREAKPOINT) + +self.process = self.target.LaunchSimple( +None, None, self.get_process_working_directory()) +self.assertTrue(self.process, PROCESS_IS_VALID) + +# The stop reason of the thread should be breakpoint. +self.assertTrue(self.process.GetState() == lldb.eStateStopped, +STOPPED_DUE_TO_BREAKPOINT) + +frame = self.process.GetThreadAtIndex(0).GetFrameAtIndex(0) +x = frame.FindVariable("x") +self.assertTrue(x.IsValid(), "x is not valid") +y = frame.FindVariable("y") +self.assertTrue(y.IsValid(), "y is not valid") + Index: packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/Makefile === --- /dev/null +++ packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/Makefile @@ -0,0 +1,17 @@ +.PHONY : all +.PHONY : clean +all: main + +CCFLAGS=-O0 -g + +a.o : a.c + "$(CC)" $(CCFLAGS) -gsplit-dwarf -c "$<" -o "$@" + +b.o : b.c + "$(CC)" $(CCFLAGS) -c "$<" -o "$@" + +main : a.o b.o + "$(CC)" $^ -o "$@" + +clean: + rm -f a.dwo a.o b.o main ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D42563: [lldb] attempt to fix DIERef::GetUID
alexshap updated this revision to Diff 131921. alexshap added a comment. fix typo Repository: rL LLVM https://reviews.llvm.org/D42563 Files: packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/Makefile packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/TestMixedDwarfBinary.py packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/a.c packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/b.c source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp === --- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -392,9 +392,10 @@ } SymbolFileDWARF::SymbolFileDWARF(ObjectFile *objfile) -: SymbolFile(objfile), UserID(0), // Used by SymbolFileDWARFDebugMap to when - // this class parses .o files to contain - // the .o file index/ID +: SymbolFile(objfile), + UserID(uint64_t(DW_INVALID_OFFSET) << 32), // Used by SymbolFileDWARFDebugMap to when + // this class parses .o files to contain + // the .o file index/ID m_debug_map_module_wp(), m_debug_map_symfile(NULL), m_data_debug_abbrev(), m_data_debug_aranges(), m_data_debug_frame(), m_data_debug_info(), m_data_debug_line(), m_data_debug_macro(), m_data_debug_loc(), Index: packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/b.c === --- /dev/null +++ packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/b.c @@ -0,0 +1,11 @@ +extern int f(); + +void g() { + int y = 14; + int x = f(); +} + +int main() { + g(); + return 0; +} Index: packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/a.c === --- /dev/null +++ packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/a.c @@ -0,0 +1,3 @@ +int f() { + return 1; +} Index: packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/TestMixedDwarfBinary.py === --- /dev/null +++ packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/TestMixedDwarfBinary.py @@ -0,0 +1,46 @@ +""" Testing explicit symbol loading via target symbols add. """ +import os +import lldb +import sys +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil + + +class TestMixedDwarfBinary(TestBase): +mydir = TestBase.compute_mydir(__file__) + +def setUp(self): +TestBase.setUp(self) + +@no_debug_info_test # Prevent the genaration of the dwarf version of this test +@add_test_categories(["dwo"]) +@skipUnlessPlatform(['linux']) +def test_mixed_dwarf(self): +"""Test that 'frame variable' works +for the executable built from two source files compiled +with/whithout -gsplit-dwarf correspondingly.""" + +self.build() +exe = os.path.join(os.getcwd(), "main") + +self.target = self.dbg.CreateTarget(exe) +self.assertTrue(self.target, VALID_TARGET) + +main_bp = self.target.BreakpointCreateByName("g", "main") +self.assertTrue(main_bp, VALID_BREAKPOINT) + +self.process = self.target.LaunchSimple( +None, None, self.get_process_working_directory()) +self.assertTrue(self.process, PROCESS_IS_VALID) + +# The stop reason of the thread should be breakpoint. +self.assertTrue(self.process.GetState() == lldb.eStateStopped, +STOPPED_DUE_TO_BREAKPOINT) + +frame = self.process.GetThreadAtIndex(0).GetFrameAtIndex(0) +x = frame.FindVariable("x") +self.assertTrue(x.IsValid(), "x is not valid") +y = frame.FindVariable("y") +self.assertTrue(y.IsValid(), "y is not valid") + Index: packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/Makefile === --- /dev/null +++ packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/Makefile @@ -0,0 +1,17 @@ +.PHONY : all +.PHONY : clean +all: main + +CCFLAGS=-O0 -g + +a.o : a.c + "$(CC)" $(CCFLAGS) -gsplit-dwarf -c "$<" -o "$@" + +b.o : b.c + "$(CC)" $(CCFLAGS) -c "$<" -o "$@" + +main : a.o b.o + "$(CC)" $^ -o "$@" + +clean: + rm -f a.dwo a.o b.o main ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D42563: [lldb] attempt to fix DIERef::GetUID
alexshap updated this revision to Diff 131922. alexshap added a comment. one more update Repository: rL LLVM https://reviews.llvm.org/D42563 Files: packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/Makefile packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/TestMixedDwarfBinary.py packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/a.c packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/b.c source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp === --- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -392,9 +392,10 @@ } SymbolFileDWARF::SymbolFileDWARF(ObjectFile *objfile) -: SymbolFile(objfile), UserID(0), // Used by SymbolFileDWARFDebugMap to when - // this class parses .o files to contain - // the .o file index/ID +: SymbolFile(objfile), + UserID(uint64_t(DW_INVALID_OFFSET) << 32), // Used by SymbolFileDWARFDebugMap to when + // this class parses .o files to contain + // the .o file index/ID m_debug_map_module_wp(), m_debug_map_symfile(NULL), m_data_debug_abbrev(), m_data_debug_aranges(), m_data_debug_frame(), m_data_debug_info(), m_data_debug_line(), m_data_debug_macro(), m_data_debug_loc(), Index: packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/b.c === --- /dev/null +++ packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/b.c @@ -0,0 +1,11 @@ +extern int f(); + +void g() { + int y = 14; + int x = f(); +} + +int main() { + g(); + return 0; +} Index: packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/a.c === --- /dev/null +++ packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/a.c @@ -0,0 +1,3 @@ +int f() { + return 1; +} Index: packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/TestMixedDwarfBinary.py === --- /dev/null +++ packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/TestMixedDwarfBinary.py @@ -0,0 +1,46 @@ +""" Testing explicit symbol loading via target symbols add. """ +import os +import lldb +import sys +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil + + +class TestMixedDwarfBinary(TestBase): +mydir = TestBase.compute_mydir(__file__) + +def setUp(self): +TestBase.setUp(self) + +@no_debug_info_test # Prevent the genaration of the dwarf version of this test +@add_test_categories(["dwo"]) +@skipUnlessPlatform(['linux']) +def test_mixed_dwarf(self): +"""Test that 'frame variable' works +for the executable built from two source files compiled +with/whithout -gsplit-dwarf correspondingly.""" + +self.build() +exe = os.path.join(os.getcwd(), "main") + +self.target = self.dbg.CreateTarget(exe) +self.assertTrue(self.target, VALID_TARGET) + +main_bp = self.target.BreakpointCreateByName("g", "main") +self.assertTrue(main_bp, VALID_BREAKPOINT) + +self.process = self.target.LaunchSimple( +None, None, self.get_process_working_directory()) +self.assertTrue(self.process, PROCESS_IS_VALID) + +# The stop reason of the thread should be breakpoint. +self.assertTrue(self.process.GetState() == lldb.eStateStopped, +STOPPED_DUE_TO_BREAKPOINT) + +frame = self.process.GetThreadAtIndex(0).GetFrameAtIndex(0) +x = frame.FindVariable("x") +self.assertTrue(x.IsValid(), "x is not valid") +y = frame.FindVariable("y") +self.assertTrue(y.IsValid(), "y is not valid") + Index: packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/Makefile === --- /dev/null +++ packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/Makefile @@ -0,0 +1,17 @@ +.PHONY : all +.PHONY : clean +all: main + +CCFLAGS=-O0 -g + +a.o : a.c + "$(CC)" $(CCFLAGS) -gsplit-dwarf -c "$<" -o "$@" + +b.o : b.c + "$(CC)" $(CCFLAGS) -c "$<" -o "$@" + +main : a.o b.o + "$(CC)" $^ -o "$@" + +clean: + rm -f a.dwo a.o b.o main ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D42563: [lldb] attempt to fix DIERef::GetUID
alexshap updated this revision to Diff 131924. alexshap added a comment. fix comment https://reviews.llvm.org/D42563 Files: packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/Makefile packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/TestMixedDwarfBinary.py packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/a.c packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/b.c source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp === --- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -392,9 +392,10 @@ } SymbolFileDWARF::SymbolFileDWARF(ObjectFile *objfile) -: SymbolFile(objfile), UserID(0), // Used by SymbolFileDWARFDebugMap to when - // this class parses .o files to contain - // the .o file index/ID +: SymbolFile(objfile), + UserID(uint64_t(DW_INVALID_OFFSET) << 32), // Used by SymbolFileDWARFDebugMap to when + // this class parses .o files to contain + // the .o file index/ID m_debug_map_module_wp(), m_debug_map_symfile(NULL), m_data_debug_abbrev(), m_data_debug_aranges(), m_data_debug_frame(), m_data_debug_info(), m_data_debug_line(), m_data_debug_macro(), m_data_debug_loc(), Index: packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/b.c === --- /dev/null +++ packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/b.c @@ -0,0 +1,11 @@ +extern int f(); + +void g() { + int y = 14; + int x = f(); +} + +int main() { + g(); + return 0; +} Index: packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/a.c === --- /dev/null +++ packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/a.c @@ -0,0 +1,3 @@ +int f() { + return 1; +} Index: packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/TestMixedDwarfBinary.py === --- /dev/null +++ packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/TestMixedDwarfBinary.py @@ -0,0 +1,46 @@ +""" Testing debugging of a binary with "mixed" dwarf (with/without fission). """ +import os +import lldb +import sys +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil + + +class TestMixedDwarfBinary(TestBase): +mydir = TestBase.compute_mydir(__file__) + +def setUp(self): +TestBase.setUp(self) + +@no_debug_info_test # Prevent the genaration of the dwarf version of this test +@add_test_categories(["dwo"]) +@skipUnlessPlatform(['linux']) +def test_mixed_dwarf(self): +"""Test that 'frame variable' works +for the executable built from two source files compiled +with/whithout -gsplit-dwarf correspondingly.""" + +self.build() +exe = os.path.join(os.getcwd(), "main") + +self.target = self.dbg.CreateTarget(exe) +self.assertTrue(self.target, VALID_TARGET) + +main_bp = self.target.BreakpointCreateByName("g", "main") +self.assertTrue(main_bp, VALID_BREAKPOINT) + +self.process = self.target.LaunchSimple( +None, None, self.get_process_working_directory()) +self.assertTrue(self.process, PROCESS_IS_VALID) + +# The stop reason of the thread should be breakpoint. +self.assertTrue(self.process.GetState() == lldb.eStateStopped, +STOPPED_DUE_TO_BREAKPOINT) + +frame = self.process.GetThreadAtIndex(0).GetFrameAtIndex(0) +x = frame.FindVariable("x") +self.assertTrue(x.IsValid(), "x is not valid") +y = frame.FindVariable("y") +self.assertTrue(y.IsValid(), "y is not valid") + Index: packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/Makefile === --- /dev/null +++ packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/Makefile @@ -0,0 +1,17 @@ +.PHONY : all +.PHONY : clean +all: main + +CCFLAGS=-O0 -g + +a.o : a.c + "$(CC)" $(CCFLAGS) -gsplit-dwarf -c "$<" -o "$@" + +b.o : b.c + "$(CC)" $(CCFLAGS) -c "$<" -o "$@" + +main : a.o b.o + "$(CC)" $^ -o "$@" + +clean: + rm -f a.dwo a.o b.o main ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D42563: [lldb] attempt to fix DIERef::GetUID
alexshap updated this revision to Diff 131938. alexshap added a comment. Update makefile Repository: rL LLVM https://reviews.llvm.org/D42563 Files: packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/Makefile packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/TestMixedDwarfBinary.py packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/a.c packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/b.c source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp === --- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -392,9 +392,10 @@ } SymbolFileDWARF::SymbolFileDWARF(ObjectFile *objfile) -: SymbolFile(objfile), UserID(0), // Used by SymbolFileDWARFDebugMap to when - // this class parses .o files to contain - // the .o file index/ID +: SymbolFile(objfile), + UserID(uint64_t(DW_INVALID_OFFSET) << 32), // Used by SymbolFileDWARFDebugMap to when + // this class parses .o files to contain + // the .o file index/ID m_debug_map_module_wp(), m_debug_map_symfile(NULL), m_data_debug_abbrev(), m_data_debug_aranges(), m_data_debug_frame(), m_data_debug_info(), m_data_debug_line(), m_data_debug_macro(), m_data_debug_loc(), Index: packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/b.c === --- /dev/null +++ packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/b.c @@ -0,0 +1,11 @@ +extern int f(); + +void g() { + int y = 14; + int x = f(); +} + +int main() { + g(); + return 0; +} Index: packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/a.c === --- /dev/null +++ packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/a.c @@ -0,0 +1,3 @@ +int f() { + return 1; +} Index: packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/TestMixedDwarfBinary.py === --- /dev/null +++ packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/TestMixedDwarfBinary.py @@ -0,0 +1,46 @@ +""" Testing debugging of a binary with "mixed" dwarf (with/without fission). """ +import os +import lldb +import sys +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil + + +class TestMixedDwarfBinary(TestBase): +mydir = TestBase.compute_mydir(__file__) + +def setUp(self): +TestBase.setUp(self) + +@no_debug_info_test # Prevent the genaration of the dwarf version of this test +@add_test_categories(["dwo"]) +@skipUnlessPlatform(["linux"]) +def test_mixed_dwarf(self): +"""Test that 'frame variable' works +for the executable built from two source files compiled +with/whithout -gsplit-dwarf correspondingly.""" + +self.build() +exe = os.path.join(os.getcwd(), "a.out") + +self.target = self.dbg.CreateTarget(exe) +self.assertTrue(self.target, VALID_TARGET) + +main_bp = self.target.BreakpointCreateByName("g", "a.out") +self.assertTrue(main_bp, VALID_BREAKPOINT) + +self.process = self.target.LaunchSimple( +None, None, self.get_process_working_directory()) +self.assertTrue(self.process, PROCESS_IS_VALID) + +# The stop reason of the thread should be breakpoint. +self.assertTrue(self.process.GetState() == lldb.eStateStopped, +STOPPED_DUE_TO_BREAKPOINT) + +frame = self.process.GetThreadAtIndex(0).GetFrameAtIndex(0) +x = frame.FindVariable("x") +self.assertTrue(x.IsValid(), "x is not valid") +y = frame.FindVariable("y") +self.assertTrue(y.IsValid(), "y is not valid") + Index: packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/Makefile === --- /dev/null +++ packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/Makefile @@ -0,0 +1,12 @@ +LEVEL := ../../make + +C_SOURCES := a.c b.c +CFLAGS_EXTRAS += -g -O0 + +a.o: CFLAGS_EXTRAS += -gsplit-dwarf + +include $(LEVEL)/Makefile.rules + +.PHONY: clean +clean:: + $(RM) -f a.dwo a.o b.o main ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D42563: [lldb] attempt to fix DIERef::GetUID
alexshap added inline comments. Comment at: packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/Makefile:10-12 +.PHONY: clean +clean:: + $(RM) -f a.dwo a.o b.o main tberghammer wrote: > Do you need this? I think Makefile.rules should generate it for you and > looking at that rule it should be correct. it generates the cleanup for .o files, but not for .dwo (because -gsplit-dwarf is added manually) Repository: rL LLVM https://reviews.llvm.org/D42563 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D42563: [lldb] attempt to fix DIERef::GetUID
This revision was automatically updated to reflect the committed changes. Closed by commit rL323832: [lldb] Enable debugging of binaries with mixed (splitted/regular) dwarf (authored by alexshap, committed by ). Changed prior to commit: https://reviews.llvm.org/D42563?vs=131938&id=132067#toc Repository: rL LLVM https://reviews.llvm.org/D42563 Files: lldb/trunk/packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/Makefile lldb/trunk/packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/TestMixedDwarfBinary.py lldb/trunk/packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/a.c lldb/trunk/packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/b.c lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Index: lldb/trunk/packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/Makefile === --- lldb/trunk/packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/Makefile +++ lldb/trunk/packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/Makefile @@ -0,0 +1,10 @@ +LEVEL := ../../make + +C_SOURCES := a.c b.c +a.o: CFLAGS_EXTRAS += -gsplit-dwarf + +include $(LEVEL)/Makefile.rules + +.PHONY: clean +clean:: + $(RM) -f a.dwo a.o b.o main Index: lldb/trunk/packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/TestMixedDwarfBinary.py === --- lldb/trunk/packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/TestMixedDwarfBinary.py +++ lldb/trunk/packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/TestMixedDwarfBinary.py @@ -0,0 +1,46 @@ +""" Testing debugging of a binary with "mixed" dwarf (with/without fission). """ +import os +import lldb +import sys +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil + + +class TestMixedDwarfBinary(TestBase): +mydir = TestBase.compute_mydir(__file__) + +def setUp(self): +TestBase.setUp(self) + +@no_debug_info_test # Prevent the genaration of the dwarf version of this test +@add_test_categories(["dwo"]) +@skipUnlessPlatform(["linux"]) +def test_mixed_dwarf(self): +"""Test that 'frame variable' works +for the executable built from two source files compiled +with/whithout -gsplit-dwarf correspondingly.""" + +self.build() +exe = os.path.join(os.getcwd(), "a.out") + +self.target = self.dbg.CreateTarget(exe) +self.assertTrue(self.target, VALID_TARGET) + +main_bp = self.target.BreakpointCreateByName("g", "a.out") +self.assertTrue(main_bp, VALID_BREAKPOINT) + +self.process = self.target.LaunchSimple( +None, None, self.get_process_working_directory()) +self.assertTrue(self.process, PROCESS_IS_VALID) + +# The stop reason of the thread should be breakpoint. +self.assertTrue(self.process.GetState() == lldb.eStateStopped, +STOPPED_DUE_TO_BREAKPOINT) + +frame = self.process.GetThreadAtIndex(0).GetFrameAtIndex(0) +x = frame.FindVariable("x") +self.assertTrue(x.IsValid(), "x is not valid") +y = frame.FindVariable("y") +self.assertTrue(y.IsValid(), "y is not valid") + Index: lldb/trunk/packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/b.c === --- lldb/trunk/packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/b.c +++ lldb/trunk/packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/b.c @@ -0,0 +1,11 @@ +extern int f(); + +void g() { + int y = 14; + int x = f(); +} + +int main() { + g(); + return 0; +} Index: lldb/trunk/packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/a.c === --- lldb/trunk/packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/a.c +++ lldb/trunk/packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/a.c @@ -0,0 +1,3 @@ +int f() { + return 1; +} Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp === --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -392,9 +392,10 @@ } SymbolFileDWARF::SymbolFileDWARF(ObjectFile *objfile) -: SymbolFile(objfile), UserID(0), // Used by SymbolFileDWARFDebugMap to when - // this class parses .o files to contain - // the .o file index/ID +: SymbolFile(objfile), + UserID(uint64_t(DW_INVALID_OFFSET) << 32), // Used by SymbolFileDWARFDebugMap to when + // this class parses .o files to contain +
[Lldb-commits] [PATCH] D37295: [lldb] Adjust UpdateExternalModuleListIfNeeded method for the case of *.dwo
alexshap created this revision. Herald added a subscriber: JDevlieghere. A *.dwo file itself can have DW_AT_GNU_dwo_name (but no DW_AT_comp_dir) (clang 4.0 generates such DWOs). In this case there is no need to try to get a new module, and, more over, if we try (below) the method ModuleList::GetSharedModule will return an error + nullptr since the path is ill-formed (because comp_dir is null (since DW_AT_comp_dir is not present)). Test plan: built a toy example + "br set --name f" + "p LocaVariable" (lld will search recursively for types and will call UpdateExternalModuleListIfNeeded) Repository: rL LLVM https://reviews.llvm.org/D37295 Files: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp === --- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -1640,7 +1640,21 @@ } dwo_module_spec.GetArchitecture() = m_obj_file->GetModule()->GetArchitecture(); -// printf ("Loading dwo = '%s'\n", dwo_path); + +// A *.dwo file itself can have DW_AT_GNU_dwo_name (but no +// DW_AT_comp_dir) (clang 4.0 generates such DWOs). In this case +// there is no need to try to get a new module, and, more over, if +// we try (below) the method ModuleList::GetSharedModule will return +// an error + nullptr since the path is ill-formed (because comp_dir +// is null (since DW_AT_comp_dir is not present)). +if (m_obj_file->GetFileSpec() +.GetFileNameExtension() +.GetStringRef() == "dwo" && +llvm::StringRef(m_obj_file->GetFileSpec().GetPath()) +.endswith(dwo_module_spec.GetFileSpec().GetPath())) { + continue; +} + Status error = ModuleList::GetSharedModule( dwo_module_spec, module_sp, NULL, NULL, NULL); if (!module_sp) { Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp === --- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -1640,7 +1640,21 @@ } dwo_module_spec.GetArchitecture() = m_obj_file->GetModule()->GetArchitecture(); -// printf ("Loading dwo = '%s'\n", dwo_path); + +// A *.dwo file itself can have DW_AT_GNU_dwo_name (but no +// DW_AT_comp_dir) (clang 4.0 generates such DWOs). In this case +// there is no need to try to get a new module, and, more over, if +// we try (below) the method ModuleList::GetSharedModule will return +// an error + nullptr since the path is ill-formed (because comp_dir +// is null (since DW_AT_comp_dir is not present)). +if (m_obj_file->GetFileSpec() +.GetFileNameExtension() +.GetStringRef() == "dwo" && +llvm::StringRef(m_obj_file->GetFileSpec().GetPath()) +.endswith(dwo_module_spec.GetFileSpec().GetPath())) { + continue; +} + Status error = ModuleList::GetSharedModule( dwo_module_spec, module_sp, NULL, NULL, NULL); if (!module_sp) { ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D37295: [lldb] Adjust UpdateExternalModuleListIfNeeded method for the case of *.dwo
alexshap added inline comments. Comment at: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp:1644-1656 +// A *.dwo file itself can have DW_AT_GNU_dwo_name (but no +// DW_AT_comp_dir) (clang 4.0 generates such DWOs). In this case +// there is no need to try to get a new module, and, more over, if +// we try (below) the method ModuleList::GetSharedModule will return +// an error + nullptr since the path is ill-formed (because comp_dir +// is null (since DW_AT_comp_dir is not present)). +if (m_obj_file->GetFileSpec() clayborg wrote: > So this is checking if the extension is ".dwo" and if the object file's path > is the same as the .dwo file's path? Can you give an example of what fails? > I'm having a hard time understanding what this is doing. Skipping a dwo file > because it doesn't have a DW_AT_comp_dir? If the DW_AT_GNU_dwo_name is > relative, then there really should be a DW_AT_comp_dir. Otherwise unless we > run from the directory things are relative to, we don't find the .dwo file. > So this is checking if the extension is ".dwo" and if the object file's path > is the same as the .dwo file's path? yes! okay, i will try to explain, sorry for the long text in advance. LLDB tries to load "external modules" (recursively) (this is called, for example, when lldb is searching for types). The way this code determines if it needs to try to create an "external" module (and add it to m_external_type_modules) is via looking at the presence of DW_AT_GNU_dwo_name (lines 1627 - 1630). However, when the already created module (corresponding to .dwo itself) is being processed, it will see the presence of DW_AT_GNU_dwo_name (which contains the name of itself) and will try to call ModuleList::GetSharedModule again. Since .dwo has only DW_AT_GNU_dwo_name and doesn't have DW_AT_comp_dir the method ModuleList::GetSharedModule will fail (it will check if the file actually exists - and since the path is not correct, that check will fail) (and actually it doesn't make any sense to try to load the same dwo file again). As a result for each such case the warning (lines 1661 - 1665) will be printed. minimal reduced example where i can reproduce the issue is the following: ~/fission: build/ build.sh out/ A.dwo A.o Empty.dwo Empty.o libFoo.so Main.exe src/ A.cpp Empty.cpp Main.cpp Main.cpp: int f(); int main() { int Y = f(); return Y; } Empty.cpp: #define PrettyMacro 1 A.cpp: struct A { int X; }; int f() { A a; a.X = 12; return a.X; } build.sh: #!/bin/sh -e CLANG4=/path/to/clang-4.0 $CLANG4 -fPIC -gsplit-dwarf -g -O0 -c ../src/Empty.cpp -o out/Empty.o $CLANG4 -fPIC -gsplit-dwarf -g -O0 -c ../src/A.cpp -o out/A.o $CLANG4 -shared out/A.o out/Empty.o -o out/libFoo.so $CLANG4 -fPIC -gsplit-dwarf -g -O0 ../src/Main.cpp -L`pwd`/out -lFoo -o out/Main.exe running: export LD_LIBRARY_PATH="`pwd`/build/out" lldb -- ./build/out/Main.exe br set --name f Process 3169970 stopped thread #1, name = 'Main.exe', stop reason = breakpoint 1.1 frame #0: 0x77ff4634 libFoo.so`f() at A.cpp:7 4 5 int f() { 6 A a; 7 a.X = 12; 8 return a.X; 9 } (lldb) p a warning: (x86_64) /home/alexshap/fission/build/out/Empty.dwo 0x000b: unable to locate module needed for external types: out/Empty.dwo error: 'out/Empty.dwo' does not exist Debugging will be degraded due to missing types. Rebuilding your project will regenerate the needed module files. P.S. llvm-dwarfdump Empty.dwo outputs the following: .debug_info.dwo contents: 0x: Compile Unit: length = 0x0015 version = 0x0004 abbr_offset = 0x addr_size = 0x08 (next unit at 0x0019) 0x000b: DW_TAG_compile_unit [1] DW_AT_GNU_dwo_name [DW_FORM_GNU_str_index]( indexed () string = "out/Empty.dwo") DW_AT_producer [DW_FORM_GNU_str_index]( indexed (0001) string = "clang version 4.0.0 (llvm: 418e5baaeb312dce78aef32a0e53911b89828a15, cfe: 50611996792539b2cb857de93ab34330feef5e46, compiler-rt: f30125d3ab56aa0003adcb63baf43471d0c99105, lld: f3e1544a0fd20c1f8875d86ee53fda439301da11) (based on LLVM 4.0.0)") DW_AT_language [DW_FORM_data2](DW_LANG_C_plus_plus) DW_AT_name [DW_FORM_GNU_str_index]( indexed (0002) string = "../src/Empty.cpp") DW_AT_GNU_dwo_id [DW_FORM_data8] (0x3fb4b906a44efb8f) Repository: rL LLVM https://reviews.llvm.org/D37295 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cg
[Lldb-commits] [PATCH] D37295: [lldb] Adjust UpdateExternalModuleListIfNeeded method for the case of *.dwo
alexshap added a comment. @clayborg, many thanks for the review, i've added above a comment with more details about the issue (to the best my knowledge). Repository: rL LLVM https://reviews.llvm.org/D37295 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D37295: [lldb] Adjust UpdateExternalModuleListIfNeeded method for the case of *.dwo
alexshap added a comment. @clayborg - yeah, many thanks for the comments > Does this seem like it is a compiler bug yeah, i think it might be the case, although right now i can't say for sure and i need to consult with the DWO spec > If this is a long released compiler generating this, then we do need a fix in > LLDB since it will be running into these binaries from here on out. yeah, it's (a long released) compiler (4.0), so this will be this way for some time. besides fixing things for 4.0 I had another thought why this change could be reasonable - LLDB does a linear scan (inside GetSharedModule (in ModuleList::FindModules)) (in this build configuration the size of ModuleList is poportional to the total number of .dwo files which can be quite large) and in this particular case this can be avoided (because we don't actually need to load the already loaded module). Repository: rL LLVM https://reviews.llvm.org/D37295 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D37295: [lldb] Adjust UpdateExternalModuleListIfNeeded method for the case of *.dwo
alexshap added a comment. ping Repository: rL LLVM https://reviews.llvm.org/D37295 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D37295: [lldb] Adjust UpdateExternalModuleListIfNeeded method for the case of *.dwo
This revision was automatically updated to reflect the committed changes. Closed by commit rL313083: [lldb] Adjust UpdateExternalModuleListIfNeeded method for the case of *.dwo (authored by alexshap). Changed prior to commit: https://reviews.llvm.org/D37295?vs=113249&id=114923#toc Repository: rL LLVM https://reviews.llvm.org/D37295 Files: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp === --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -1640,7 +1640,29 @@ } dwo_module_spec.GetArchitecture() = m_obj_file->GetModule()->GetArchitecture(); -// printf ("Loading dwo = '%s'\n", dwo_path); + +// When LLDB loads "external" modules it looks at the +// presence of DW_AT_GNU_dwo_name. +// However, when the already created module +// (corresponding to .dwo itself) is being processed, +// it will see the presence of DW_AT_GNU_dwo_name +// (which contains the name of dwo file) and +// will try to call ModuleList::GetSharedModule again. +// In some cases (i.e. for empty files) Clang 4.0 +// generates a *.dwo file which has DW_AT_GNU_dwo_name, +// but no DW_AT_comp_dir. In this case the method +// ModuleList::GetSharedModule will fail and +// the warning will be printed. However, as one can notice +// in this case we don't actually need to try to load the already +// loaded module (corresponding to .dwo) so we simply skip it. +if (m_obj_file->GetFileSpec() +.GetFileNameExtension() +.GetStringRef() == "dwo" && +llvm::StringRef(m_obj_file->GetFileSpec().GetPath()) +.endswith(dwo_module_spec.GetFileSpec().GetPath())) { + continue; +} + Status error = ModuleList::GetSharedModule( dwo_module_spec, module_sp, NULL, NULL, NULL); if (!module_sp) { Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp === --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -1640,7 +1640,29 @@ } dwo_module_spec.GetArchitecture() = m_obj_file->GetModule()->GetArchitecture(); -// printf ("Loading dwo = '%s'\n", dwo_path); + +// When LLDB loads "external" modules it looks at the +// presence of DW_AT_GNU_dwo_name. +// However, when the already created module +// (corresponding to .dwo itself) is being processed, +// it will see the presence of DW_AT_GNU_dwo_name +// (which contains the name of dwo file) and +// will try to call ModuleList::GetSharedModule again. +// In some cases (i.e. for empty files) Clang 4.0 +// generates a *.dwo file which has DW_AT_GNU_dwo_name, +// but no DW_AT_comp_dir. In this case the method +// ModuleList::GetSharedModule will fail and +// the warning will be printed. However, as one can notice +// in this case we don't actually need to try to load the already +// loaded module (corresponding to .dwo) so we simply skip it. +if (m_obj_file->GetFileSpec() +.GetFileNameExtension() +.GetStringRef() == "dwo" && +llvm::StringRef(m_obj_file->GetFileSpec().GetPath()) +.endswith(dwo_module_spec.GetFileSpec().GetPath())) { + continue; +} + Status error = ModuleList::GetSharedModule( dwo_module_spec, module_sp, NULL, NULL, NULL); if (!module_sp) { ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D38492: [lldb] Fix initialization of m_debug_cu_index_map
alexshap created this revision. Herald added subscribers: JDevlieghere, aprantl. SymbolFileDWARFDwp contains m_debug_cu_index_map which was previously initialized incorrectly: before m_debug_cu_index.parse is called m_debug_cu_index is empty, thus the map was not actually getting populated properly. This diff moves this step into a private helper method and calls it after m_debug_cu_index.parse inside the public static method SymbolFileDWARFDwp::Create (the constructor remains private). Test plan: 0. A) Build a toy test example main.cpp clang -gsplit-dwarf -g -O0 main.cpp -o main.exe llvm-dwp -e main.exe -o main.exe.dwp B) Build LLDB with ENABLE_DEBUG_PRINTF set. 1. Run: lldb -- ./main.exe Check that the indexes are now correct (before this change they were empty) Check that debugging works (setting breakpoints, printing local variables (this was not working before)) Repository: rL LLVM https://reviews.llvm.org/D38492 Files: source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwp.cpp source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwp.h Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwp.h === --- source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwp.h +++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwp.h @@ -40,6 +40,8 @@ bool LoadRawSectionData(lldb::SectionType sect_type, lldb_private::DWARFDataExtractor &data); + + void InitDebugCUIndexMap(); lldb::ObjectFileSP m_obj_file; Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwp.cpp === --- source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwp.cpp +++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwp.cpp @@ -69,17 +69,21 @@ debug_cu_index.GetAddressByteSize()); if (!dwp_symfile->m_debug_cu_index.parse(llvm_debug_cu_index)) return nullptr; + dwp_symfile->InitDebugCUIndexMap(); return dwp_symfile; } -SymbolFileDWARFDwp::SymbolFileDWARFDwp(lldb::ModuleSP module_sp, - lldb::ObjectFileSP obj_file) -: m_obj_file(std::move(obj_file)), m_debug_cu_index(llvm::DW_SECT_INFO) { - for (const auto &entry : m_debug_cu_index.getRows()) { +void SymbolFileDWARFDwp::InitDebugCUIndexMap() { + m_debug_cu_index_map.clear(); + for (const auto &entry : m_debug_cu_index.getRows()) m_debug_cu_index_map.emplace(entry.getSignature(), &entry); - } } +SymbolFileDWARFDwp::SymbolFileDWARFDwp(lldb::ModuleSP module_sp, + lldb::ObjectFileSP obj_file) +: m_obj_file(std::move(obj_file)), m_debug_cu_index(llvm::DW_SECT_INFO) +{} + std::unique_ptr SymbolFileDWARFDwp::GetSymbolFileForDwoId(DWARFCompileUnit *dwarf_cu, uint64_t dwo_id) { Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwp.h === --- source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwp.h +++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwp.h @@ -40,6 +40,8 @@ bool LoadRawSectionData(lldb::SectionType sect_type, lldb_private::DWARFDataExtractor &data); + + void InitDebugCUIndexMap(); lldb::ObjectFileSP m_obj_file; Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwp.cpp === --- source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwp.cpp +++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwp.cpp @@ -69,17 +69,21 @@ debug_cu_index.GetAddressByteSize()); if (!dwp_symfile->m_debug_cu_index.parse(llvm_debug_cu_index)) return nullptr; + dwp_symfile->InitDebugCUIndexMap(); return dwp_symfile; } -SymbolFileDWARFDwp::SymbolFileDWARFDwp(lldb::ModuleSP module_sp, - lldb::ObjectFileSP obj_file) -: m_obj_file(std::move(obj_file)), m_debug_cu_index(llvm::DW_SECT_INFO) { - for (const auto &entry : m_debug_cu_index.getRows()) { +void SymbolFileDWARFDwp::InitDebugCUIndexMap() { + m_debug_cu_index_map.clear(); + for (const auto &entry : m_debug_cu_index.getRows()) m_debug_cu_index_map.emplace(entry.getSignature(), &entry); - } } +SymbolFileDWARFDwp::SymbolFileDWARFDwp(lldb::ModuleSP module_sp, + lldb::ObjectFileSP obj_file) +: m_obj_file(std::move(obj_file)), m_debug_cu_index(llvm::DW_SECT_INFO) +{} + std::unique_ptr SymbolFileDWARFDwp::GetSymbolFileForDwoId(DWARFCompileUnit *dwarf_cu, uint64_t dwo_id) { ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D38492: [lldb] Fix initialization of m_debug_cu_index_map
This revision was automatically updated to reflect the committed changes. Closed by commit rL314832: [lldb] Fix initialization of m_debug_cu_index_map (authored by alexshap). Changed prior to commit: https://reviews.llvm.org/D38492?vs=117470&id=117570#toc Repository: rL LLVM https://reviews.llvm.org/D38492 Files: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwp.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwp.h Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwp.cpp === --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwp.cpp +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwp.cpp @@ -69,17 +69,21 @@ debug_cu_index.GetAddressByteSize()); if (!dwp_symfile->m_debug_cu_index.parse(llvm_debug_cu_index)) return nullptr; + dwp_symfile->InitDebugCUIndexMap(); return dwp_symfile; } -SymbolFileDWARFDwp::SymbolFileDWARFDwp(lldb::ModuleSP module_sp, - lldb::ObjectFileSP obj_file) -: m_obj_file(std::move(obj_file)), m_debug_cu_index(llvm::DW_SECT_INFO) { - for (const auto &entry : m_debug_cu_index.getRows()) { +void SymbolFileDWARFDwp::InitDebugCUIndexMap() { + m_debug_cu_index_map.clear(); + for (const auto &entry : m_debug_cu_index.getRows()) m_debug_cu_index_map.emplace(entry.getSignature(), &entry); - } } +SymbolFileDWARFDwp::SymbolFileDWARFDwp(lldb::ModuleSP module_sp, + lldb::ObjectFileSP obj_file) +: m_obj_file(std::move(obj_file)), m_debug_cu_index(llvm::DW_SECT_INFO) +{} + std::unique_ptr SymbolFileDWARFDwp::GetSymbolFileForDwoId(DWARFCompileUnit *dwarf_cu, uint64_t dwo_id) { Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwp.h === --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwp.h +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwp.h @@ -40,6 +40,8 @@ bool LoadRawSectionData(lldb::SectionType sect_type, lldb_private::DWARFDataExtractor &data); + + void InitDebugCUIndexMap(); lldb::ObjectFileSP m_obj_file; Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwp.cpp === --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwp.cpp +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwp.cpp @@ -69,17 +69,21 @@ debug_cu_index.GetAddressByteSize()); if (!dwp_symfile->m_debug_cu_index.parse(llvm_debug_cu_index)) return nullptr; + dwp_symfile->InitDebugCUIndexMap(); return dwp_symfile; } -SymbolFileDWARFDwp::SymbolFileDWARFDwp(lldb::ModuleSP module_sp, - lldb::ObjectFileSP obj_file) -: m_obj_file(std::move(obj_file)), m_debug_cu_index(llvm::DW_SECT_INFO) { - for (const auto &entry : m_debug_cu_index.getRows()) { +void SymbolFileDWARFDwp::InitDebugCUIndexMap() { + m_debug_cu_index_map.clear(); + for (const auto &entry : m_debug_cu_index.getRows()) m_debug_cu_index_map.emplace(entry.getSignature(), &entry); - } } +SymbolFileDWARFDwp::SymbolFileDWARFDwp(lldb::ModuleSP module_sp, + lldb::ObjectFileSP obj_file) +: m_obj_file(std::move(obj_file)), m_debug_cu_index(llvm::DW_SECT_INFO) +{} + std::unique_ptr SymbolFileDWARFDwp::GetSymbolFileForDwoId(DWARFCompileUnit *dwarf_cu, uint64_t dwo_id) { Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwp.h === --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwp.h +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwp.h @@ -40,6 +40,8 @@ bool LoadRawSectionData(lldb::SectionType sect_type, lldb_private::DWARFDataExtractor &data); + + void InitDebugCUIndexMap(); lldb::ObjectFileSP m_obj_file; ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D38568: [lldb] Enable using out-of-tree dwps
alexshap created this revision. Herald added subscribers: JDevlieghere, aprantl. Previously LLDB required dwp to be located next to the executable file (see the code in SymbolFileDWARF::GetDwpSymbolFile). This diff uses the helper function Symbols::LocateExecutableSymbolFile to search for DWP files in the standard locations for debug symbols. Test plan: Build a toy test example main.cpp clang -gsplit-dwarf -g -O0 main.cpp -o main.exe llvm-dwp -e main.exe -o main.exe.dwp mkdir -p debug_symbols mv main.exe.dwp debug_symbols/main.exe.dwp rm -f main.dwo Run lldb: lldb settings set target.debug-file-search-paths ./debug_symbols file ./main.exe br set --name f r Check that debugging works (setting breakpoints, printing local variables (this was not working before)) Repository: rL LLVM https://reviews.llvm.org/D38568 Files: source/Host/common/Symbols.cpp source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp === --- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -30,6 +30,7 @@ #include "lldb/Host/FileSystem.h" #include "lldb/Host/Host.h" +#include "lldb/Host/Symbols.h" #include "lldb/Interpreter/OptionValueFileSpecList.h" #include "lldb/Interpreter/OptionValueProperties.h" @@ -4352,7 +4353,11 @@ SymbolFileDWARFDwp *SymbolFileDWARF::GetDwpSymbolFile() { llvm::call_once(m_dwp_symfile_once_flag, [this]() { -FileSpec dwp_filespec(m_obj_file->GetFileSpec().GetPath() + ".dwp", false); +ModuleSpec module_spec; +module_spec.GetFileSpec() = m_obj_file->GetFileSpec(); +module_spec.GetSymbolFileSpec() = +FileSpec(m_obj_file->GetFileSpec().GetPath() + ".dwp", false); +FileSpec dwp_filespec = Symbols::LocateExecutableSymbolFile(module_spec); if (dwp_filespec.Exists()) { m_dwp_symfile = SymbolFileDWARFDwp::Create(GetObjectFile()->GetModule(), dwp_filespec); Index: source/Host/common/Symbols.cpp === --- source/Host/common/Symbols.cpp +++ source/Host/common/Symbols.cpp @@ -285,7 +285,13 @@ if (num_specs == 1) { ModuleSpec mspec; if (specs.GetModuleSpecAtIndex(0, mspec)) { - if (mspec.GetUUID() == module_uuid) + // FIXME: at the moment llvm-dwp doesn't output build ids, + // nor does binutils dwp. Thus in the case of DWPs + // we skip uuids check. This needs to be fixed + // to avoid consistency issues as soon as + // llvm-dwp and binutils dwp gain support for build ids. + if (file_spec.GetFileNameExtension().GetStringRef() == "dwp" || + mspec.GetUUID() == module_uuid) return file_spec; } } Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp === --- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -30,6 +30,7 @@ #include "lldb/Host/FileSystem.h" #include "lldb/Host/Host.h" +#include "lldb/Host/Symbols.h" #include "lldb/Interpreter/OptionValueFileSpecList.h" #include "lldb/Interpreter/OptionValueProperties.h" @@ -4352,7 +4353,11 @@ SymbolFileDWARFDwp *SymbolFileDWARF::GetDwpSymbolFile() { llvm::call_once(m_dwp_symfile_once_flag, [this]() { -FileSpec dwp_filespec(m_obj_file->GetFileSpec().GetPath() + ".dwp", false); +ModuleSpec module_spec; +module_spec.GetFileSpec() = m_obj_file->GetFileSpec(); +module_spec.GetSymbolFileSpec() = +FileSpec(m_obj_file->GetFileSpec().GetPath() + ".dwp", false); +FileSpec dwp_filespec = Symbols::LocateExecutableSymbolFile(module_spec); if (dwp_filespec.Exists()) { m_dwp_symfile = SymbolFileDWARFDwp::Create(GetObjectFile()->GetModule(), dwp_filespec); Index: source/Host/common/Symbols.cpp === --- source/Host/common/Symbols.cpp +++ source/Host/common/Symbols.cpp @@ -285,7 +285,13 @@ if (num_specs == 1) { ModuleSpec mspec; if (specs.GetModuleSpecAtIndex(0, mspec)) { - if (mspec.GetUUID() == module_uuid) + // FIXME: at the moment llvm-dwp doesn't output build ids, + // nor does binutils dwp. Thus in the case of DWPs + // we skip uuids check. This needs to be fixed + // to avoid consistency issues as soon as + // llvm-dwp and binutils dwp gain support for build ids. + if (file_spec.GetFileNameExtension().GetStringRef() == "dwp" || + mspec.GetUUID() == module_uuid) return file_spec; }
[Lldb-commits] [PATCH] D38568: [lldb] Enable using out-of-tree dwps
alexshap added a comment. Ping Repository: rL LLVM https://reviews.llvm.org/D38568 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D38568: [lldb] Enable using out-of-tree dwps
alexshap updated this revision to Diff 118250. alexshap added a comment. Ignore the UUID comparison if the UUID field is not valid (in this case the interface seems to be a bit cleaner (module_spec is the single source of truth (without extra parameters)) Repository: rL LLVM https://reviews.llvm.org/D38568 Files: source/Host/common/Symbols.cpp source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp === --- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -30,6 +30,7 @@ #include "lldb/Host/FileSystem.h" #include "lldb/Host/Host.h" +#include "lldb/Host/Symbols.h" #include "lldb/Interpreter/OptionValueFileSpecList.h" #include "lldb/Interpreter/OptionValueProperties.h" @@ -4352,7 +4353,11 @@ SymbolFileDWARFDwp *SymbolFileDWARF::GetDwpSymbolFile() { llvm::call_once(m_dwp_symfile_once_flag, [this]() { -FileSpec dwp_filespec(m_obj_file->GetFileSpec().GetPath() + ".dwp", false); +ModuleSpec module_spec; +module_spec.GetFileSpec() = m_obj_file->GetFileSpec(); +module_spec.GetSymbolFileSpec() = +FileSpec(m_obj_file->GetFileSpec().GetPath() + ".dwp", false); +FileSpec dwp_filespec = Symbols::LocateExecutableSymbolFile(module_spec); if (dwp_filespec.Exists()) { m_dwp_symfile = SymbolFileDWARFDwp::Create(GetObjectFile()->GetModule(), dwp_filespec); Index: source/Host/common/Symbols.cpp === --- source/Host/common/Symbols.cpp +++ source/Host/common/Symbols.cpp @@ -285,7 +285,12 @@ if (num_specs == 1) { ModuleSpec mspec; if (specs.GetModuleSpecAtIndex(0, mspec)) { - if (mspec.GetUUID() == module_uuid) + // Skip the uuids check if module_uuid is invalid. + // For example, this happens for *.dwp files since + // at the moment llvm-dwp doesn't output build ids, + // nor does binutils dwp. + if (!module_uuid.IsValid() || + module_uuid == mspec.GetUUID()) return file_spec; } } Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp === --- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -30,6 +30,7 @@ #include "lldb/Host/FileSystem.h" #include "lldb/Host/Host.h" +#include "lldb/Host/Symbols.h" #include "lldb/Interpreter/OptionValueFileSpecList.h" #include "lldb/Interpreter/OptionValueProperties.h" @@ -4352,7 +4353,11 @@ SymbolFileDWARFDwp *SymbolFileDWARF::GetDwpSymbolFile() { llvm::call_once(m_dwp_symfile_once_flag, [this]() { -FileSpec dwp_filespec(m_obj_file->GetFileSpec().GetPath() + ".dwp", false); +ModuleSpec module_spec; +module_spec.GetFileSpec() = m_obj_file->GetFileSpec(); +module_spec.GetSymbolFileSpec() = +FileSpec(m_obj_file->GetFileSpec().GetPath() + ".dwp", false); +FileSpec dwp_filespec = Symbols::LocateExecutableSymbolFile(module_spec); if (dwp_filespec.Exists()) { m_dwp_symfile = SymbolFileDWARFDwp::Create(GetObjectFile()->GetModule(), dwp_filespec); Index: source/Host/common/Symbols.cpp === --- source/Host/common/Symbols.cpp +++ source/Host/common/Symbols.cpp @@ -285,7 +285,12 @@ if (num_specs == 1) { ModuleSpec mspec; if (specs.GetModuleSpecAtIndex(0, mspec)) { - if (mspec.GetUUID() == module_uuid) + // Skip the uuids check if module_uuid is invalid. + // For example, this happens for *.dwp files since + // at the moment llvm-dwp doesn't output build ids, + // nor does binutils dwp. + if (!module_uuid.IsValid() || + module_uuid == mspec.GetUUID()) return file_spec; } } ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D38568: [lldb] Enable using out-of-tree dwps
This revision was automatically updated to reflect the committed changes. Closed by commit rL315387: [lldb] Enable using out-of-tree dwps (authored by alexshap). Changed prior to commit: https://reviews.llvm.org/D38568?vs=118250&id=118504#toc Repository: rL LLVM https://reviews.llvm.org/D38568 Files: lldb/trunk/source/Host/common/Symbols.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp === --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -30,6 +30,7 @@ #include "lldb/Host/FileSystem.h" #include "lldb/Host/Host.h" +#include "lldb/Host/Symbols.h" #include "lldb/Interpreter/OptionValueFileSpecList.h" #include "lldb/Interpreter/OptionValueProperties.h" @@ -4352,7 +4353,11 @@ SymbolFileDWARFDwp *SymbolFileDWARF::GetDwpSymbolFile() { llvm::call_once(m_dwp_symfile_once_flag, [this]() { -FileSpec dwp_filespec(m_obj_file->GetFileSpec().GetPath() + ".dwp", false); +ModuleSpec module_spec; +module_spec.GetFileSpec() = m_obj_file->GetFileSpec(); +module_spec.GetSymbolFileSpec() = +FileSpec(m_obj_file->GetFileSpec().GetPath() + ".dwp", false); +FileSpec dwp_filespec = Symbols::LocateExecutableSymbolFile(module_spec); if (dwp_filespec.Exists()) { m_dwp_symfile = SymbolFileDWARFDwp::Create(GetObjectFile()->GetModule(), dwp_filespec); Index: lldb/trunk/source/Host/common/Symbols.cpp === --- lldb/trunk/source/Host/common/Symbols.cpp +++ lldb/trunk/source/Host/common/Symbols.cpp @@ -285,7 +285,12 @@ if (num_specs == 1) { ModuleSpec mspec; if (specs.GetModuleSpecAtIndex(0, mspec)) { - if (mspec.GetUUID() == module_uuid) + // Skip the uuids check if module_uuid is invalid. + // For example, this happens for *.dwp files since + // at the moment llvm-dwp doesn't output build ids, + // nor does binutils dwp. + if (!module_uuid.IsValid() || + module_uuid == mspec.GetUUID()) return file_spec; } } Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp === --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -30,6 +30,7 @@ #include "lldb/Host/FileSystem.h" #include "lldb/Host/Host.h" +#include "lldb/Host/Symbols.h" #include "lldb/Interpreter/OptionValueFileSpecList.h" #include "lldb/Interpreter/OptionValueProperties.h" @@ -4352,7 +4353,11 @@ SymbolFileDWARFDwp *SymbolFileDWARF::GetDwpSymbolFile() { llvm::call_once(m_dwp_symfile_once_flag, [this]() { -FileSpec dwp_filespec(m_obj_file->GetFileSpec().GetPath() + ".dwp", false); +ModuleSpec module_spec; +module_spec.GetFileSpec() = m_obj_file->GetFileSpec(); +module_spec.GetSymbolFileSpec() = +FileSpec(m_obj_file->GetFileSpec().GetPath() + ".dwp", false); +FileSpec dwp_filespec = Symbols::LocateExecutableSymbolFile(module_spec); if (dwp_filespec.Exists()) { m_dwp_symfile = SymbolFileDWARFDwp::Create(GetObjectFile()->GetModule(), dwp_filespec); Index: lldb/trunk/source/Host/common/Symbols.cpp === --- lldb/trunk/source/Host/common/Symbols.cpp +++ lldb/trunk/source/Host/common/Symbols.cpp @@ -285,7 +285,12 @@ if (num_specs == 1) { ModuleSpec mspec; if (specs.GetModuleSpecAtIndex(0, mspec)) { - if (mspec.GetUUID() == module_uuid) + // Skip the uuids check if module_uuid is invalid. + // For example, this happens for *.dwp files since + // at the moment llvm-dwp doesn't output build ids, + // nor does binutils dwp. + if (!module_uuid.IsValid() || + module_uuid == mspec.GetUUID()) return file_spec; } } ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D27115: [cleanup] Fix typos in file headers
This revision was automatically updated to reflect the committed changes. Closed by commit rL287966: [lldb] Fix typos in file headers (authored by alexshap). Changed prior to commit: https://reviews.llvm.org/D27115?vs=79259&id=79329#toc Repository: rL LLVM https://reviews.llvm.org/D27115 Files: lldb/trunk/source/API/SBFileSpecList.cpp lldb/trunk/source/API/SBThreadPlan.cpp lldb/trunk/source/Commands/CommandObjectCommands.cpp lldb/trunk/source/Core/EmulateInstruction.cpp lldb/trunk/source/Core/Logging.cpp lldb/trunk/source/Core/StreamAsynchronousIO.cpp lldb/trunk/source/Core/ValueObjectCast.cpp lldb/trunk/source/DataFormatters/CXXFunctionPointer.cpp lldb/trunk/source/Expression/Expression.cpp lldb/trunk/source/Expression/UtilityFunction.cpp lldb/trunk/source/Host/common/GetOptInc.cpp lldb/trunk/source/Host/common/MonitoringProcessLauncher.cpp lldb/trunk/source/Host/common/NativeRegisterContextRegisterInfo.cpp lldb/trunk/source/Host/common/ProcessRunLock.cpp lldb/trunk/source/Host/common/TCPSocket.cpp lldb/trunk/source/Host/common/UDPSocket.cpp lldb/trunk/source/Host/windows/ProcessRunLock.cpp lldb/trunk/source/Interpreter/OptionValueFileSpecLIst.cpp lldb/trunk/source/Interpreter/OptionValueLanguage.cpp lldb/trunk/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp lldb/trunk/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.h lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionHelper.h lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.cpp lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp lldb/trunk/source/Plugins/Language/CPlusPlus/CxxStringTypes.cpp lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcpp.h lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptExpressionOpts.cpp lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptExpressionOpts.h lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.h lldb/trunk/source/Plugins/Process/Darwin/DarwinProcessLauncher.cpp lldb/trunk/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_mips64.cpp lldb/trunk/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_powerpc.cpp lldb/trunk/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_x86.cpp lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_s390x.cpp lldb/trunk/source/Plugins/Process/Utility/lldb-mips-freebsd-register-enums.h lldb/trunk/source/Plugins/Process/Windows/Common/DebuggerThread.cpp lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm.cpp lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm.h lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm64.cpp lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm64.h lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_mips64.cpp lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_mips64.h lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_powerpc.cpp lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_powerpc.h lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_s390x.cpp lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_s390x.h lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_x86_64.cpp lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_x86_64.h lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDefines.cpp lldb/trunk/source/Symbol/SymbolVendor.cpp lldb/trunk/source/Symbol/TypeSystem.cpp lldb/trunk/source/Target/JITLoaderList.cpp lldb/trunk/source/Target/ThreadPlanPython.cpp lldb/trunk/source/Target/ThreadPlanTracer.cpp lldb/trunk/source/Utility/ARM64_DWARF_Registers.cpp lldb/trunk/source/Utility/ARM_DWARF_Registers.cpp Index: lldb/trunk/source/Target/JITLoaderList.cpp === --- lldb/trunk/source/Target/JITLoaderList.cpp +++ lldb/trunk/source/Target/JITLoaderList.cpp @@ -1,4 +1,4 @@ -//===-- JITLoader.cpp ---*- C++ -*-===// +//===-- JITLoaderList.cpp ---*- C++ -*-===// // // The LLVM Compiler Infrastructure // Index: lldb/trunk/source/Target/ThreadPlanPython.cpp === --- lldb/trunk/source/Target/ThreadPlanPython.cpp +++ lldb/trunk/source/Target/ThreadPlanPython.cpp @@ -1,4 +1,4 @@ -//===-- ThreadPlan.cpp
[Lldb-commits] [PATCH] D27177: [lldb] Fix compilation of SymbolFileDWARF.cpp with ENABLE_DEBUG_PRINTF set
alexshap created this revision. alexshap added reviewers: labath, sas. alexshap added a subscriber: LLDB. alexshap set the repository for this revision to rL LLVM. This diff adds missing semicolon in SymbolFileDWARF.cpp . Repository: rL LLVM https://reviews.llvm.org/D27177 Files: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp === --- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -2046,7 +2046,8 @@ m_global_index.Dump(&s); s.Printf("\nTypes:\n"); m_type_index.Dump(&s); -s.Printf("\nNamespaces:\n") m_namespace_index.Dump(&s); +s.Printf("\nNamespaces:\n"); +m_namespace_index.Dump(&s); #endif } } Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp === --- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -2046,7 +2046,8 @@ m_global_index.Dump(&s); s.Printf("\nTypes:\n"); m_type_index.Dump(&s); -s.Printf("\nNamespaces:\n") m_namespace_index.Dump(&s); +s.Printf("\nNamespaces:\n"); +m_namespace_index.Dump(&s); #endif } } ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D27177: [lldb] Fix compilation of SymbolFileDWARF.cpp with ENABLE_DEBUG_PRINTF set
This revision was automatically updated to reflect the committed changes. Closed by commit rL288094: [lldb] Fix compilation of SymbolFileDWARF.cpp with ENABLE_DEBUG_PRINTF set (authored by alexshap). Changed prior to commit: https://reviews.llvm.org/D27177?vs=79465&id=79481#toc Repository: rL LLVM https://reviews.llvm.org/D27177 Files: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp === --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -2046,7 +2046,8 @@ m_global_index.Dump(&s); s.Printf("\nTypes:\n"); m_type_index.Dump(&s); -s.Printf("\nNamespaces:\n") m_namespace_index.Dump(&s); +s.Printf("\nNamespaces:\n"); +m_namespace_index.Dump(&s); #endif } } Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp === --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -2046,7 +2046,8 @@ m_global_index.Dump(&s); s.Printf("\nTypes:\n"); m_type_index.Dump(&s); -s.Printf("\nNamespaces:\n") m_namespace_index.Dump(&s); +s.Printf("\nNamespaces:\n"); +m_namespace_index.Dump(&s); #endif } } ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D27223: Expression evaluation for overloaded C functions (redux)
alexshap added inline comments. Comment at: include/lldb/Core/FastDemangle.h:22 +char * +FastDemangle(const char *mangled_name, size_t mangled_name_length, + std::function primitive_type_hook = nullptr); some thoughts: (also i assume i might be mistaken / missing smth) in ./source/Core/Mangled.cpp at least 3 demanglers are used: FastDemangle, itaniumDemangle, abi::__cxa_demangle . Adding primitive_type_hook to FastDemangle makes the interface more complicated & inconsistent (although yes, it's not particularly consistent right now). Comment at: packages/Python/lldbsuite/test/expression_command/call-overloaded-c-fuction/main.c:17 +return 0; // break here +} does this patch work when the functions come from a shared library ? (i mean if we have libFoo.so which contains the implementations of get_arg_type(float), get_arg_type(int), and then in lldb we want to call "p get_arg_type(0.12f)") https://reviews.llvm.org/D27223 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D27380: [lldb] Update the check for Linux or FreeBSD in SymbolFileDWARF::FindFunctions.
alexshap created this revision. alexshap added reviewers: clayborg, spyffe. alexshap added a subscriber: lldb-commits. alexshap set the repository for this revision to rL LLVM. This diff 1. Adds a comment to ObjectFileELF.cpp about the current approach to determining the OS. 2. Replaces the check in SymbolFileDWARF.cpp with a more robust one. Test plan: 1. Checked that the build is green. 2. Built (on Linux) a test binary linked to a c++ shared library which contains just an implementation of a function TestFunction, the library (the binary itself) doesn't contain ELF notes and EI_OSABI is set to System V. Checked in lldb that now "p TestFunction()" works fine (and doesn't work without this patch). Repository: rL LLVM https://reviews.llvm.org/D27380 Files: source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp === --- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -2586,7 +2586,7 @@ if (sc_list.GetSize() == original_size) { ArchSpec arch; if (!parent_decl_ctx && GetObjectFile()->GetArchitecture(arch) && -(arch.GetTriple().isOSFreeBSD() || arch.GetTriple().isOSLinux() || +(arch.GetTriple().isOSBinFormatELF() || arch.GetMachine() == llvm::Triple::hexagon)) { SymbolContextList temp_sc_list; FindFunctions(name, m_function_basename_index, include_inlines, Index: source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp === --- source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp +++ source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp @@ -1513,8 +1513,14 @@ const uint32_t sub_type = subTypeFromElfHeader(header); arch_spec.SetArchitecture(eArchTypeELF, header.e_machine, sub_type, header.e_ident[EI_OSABI]); -// -// Validate if it is ok to remove GetOsFromOSABI + +// Validate if it is ok to remove GetOsFromOSABI. +// Note, that now the OS is determined based on EI_OSABI flag and +// the info extracted from ELF notes (see RefineModuleDetailsFromNote). +// However in some cases that still might be not enough: for example +// a shared library might not have any notes at all +// and have EI_OSABI flag set to System V, +// as result the OS will be set to UnknownOS. GetOsFromOSABI(header.e_ident[EI_OSABI], ostype); spec_ostype = arch_spec.GetTriple().getOS(); assert(spec_ostype == ostype); Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp === --- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -2586,7 +2586,7 @@ if (sc_list.GetSize() == original_size) { ArchSpec arch; if (!parent_decl_ctx && GetObjectFile()->GetArchitecture(arch) && -(arch.GetTriple().isOSFreeBSD() || arch.GetTriple().isOSLinux() || +(arch.GetTriple().isOSBinFormatELF() || arch.GetMachine() == llvm::Triple::hexagon)) { SymbolContextList temp_sc_list; FindFunctions(name, m_function_basename_index, include_inlines, Index: source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp === --- source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp +++ source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp @@ -1513,8 +1513,14 @@ const uint32_t sub_type = subTypeFromElfHeader(header); arch_spec.SetArchitecture(eArchTypeELF, header.e_machine, sub_type, header.e_ident[EI_OSABI]); -// -// Validate if it is ok to remove GetOsFromOSABI + +// Validate if it is ok to remove GetOsFromOSABI. +// Note, that now the OS is determined based on EI_OSABI flag and +// the info extracted from ELF notes (see RefineModuleDetailsFromNote). +// However in some cases that still might be not enough: for example +// a shared library might not have any notes at all +// and have EI_OSABI flag set to System V, +// as result the OS will be set to UnknownOS. GetOsFromOSABI(header.e_ident[EI_OSABI], ostype); spec_ostype = arch_spec.GetTriple().getOS(); assert(spec_ostype == ostype); ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D27380: [lldb] Update the check for Linux or FreeBSD in SymbolFileDWARF::FindFunctions.
alexshap updated this revision to Diff 80278. alexshap added a comment. Address comments Repository: rL LLVM https://reviews.llvm.org/D27380 Files: source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp === --- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -2586,8 +2586,7 @@ if (sc_list.GetSize() == original_size) { ArchSpec arch; if (!parent_decl_ctx && GetObjectFile()->GetArchitecture(arch) && -(arch.GetTriple().isOSFreeBSD() || arch.GetTriple().isOSLinux() || - arch.GetMachine() == llvm::Triple::hexagon)) { +arch.GetTriple().isOSBinFormatELF()) { SymbolContextList temp_sc_list; FindFunctions(name, m_function_basename_index, include_inlines, temp_sc_list); Index: source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp === --- source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp +++ source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp @@ -1513,8 +1513,14 @@ const uint32_t sub_type = subTypeFromElfHeader(header); arch_spec.SetArchitecture(eArchTypeELF, header.e_machine, sub_type, header.e_ident[EI_OSABI]); -// -// Validate if it is ok to remove GetOsFromOSABI + +// Validate if it is ok to remove GetOsFromOSABI. +// Note, that now the OS is determined based on EI_OSABI flag and +// the info extracted from ELF notes (see RefineModuleDetailsFromNote). +// However in some cases that still might be not enough: for example +// a shared library might not have any notes at all +// and have EI_OSABI flag set to System V, +// as result the OS will be set to UnknownOS. GetOsFromOSABI(header.e_ident[EI_OSABI], ostype); spec_ostype = arch_spec.GetTriple().getOS(); assert(spec_ostype == ostype); Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp === --- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -2586,8 +2586,7 @@ if (sc_list.GetSize() == original_size) { ArchSpec arch; if (!parent_decl_ctx && GetObjectFile()->GetArchitecture(arch) && -(arch.GetTriple().isOSFreeBSD() || arch.GetTriple().isOSLinux() || - arch.GetMachine() == llvm::Triple::hexagon)) { +arch.GetTriple().isOSBinFormatELF()) { SymbolContextList temp_sc_list; FindFunctions(name, m_function_basename_index, include_inlines, temp_sc_list); Index: source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp === --- source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp +++ source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp @@ -1513,8 +1513,14 @@ const uint32_t sub_type = subTypeFromElfHeader(header); arch_spec.SetArchitecture(eArchTypeELF, header.e_machine, sub_type, header.e_ident[EI_OSABI]); -// -// Validate if it is ok to remove GetOsFromOSABI + +// Validate if it is ok to remove GetOsFromOSABI. +// Note, that now the OS is determined based on EI_OSABI flag and +// the info extracted from ELF notes (see RefineModuleDetailsFromNote). +// However in some cases that still might be not enough: for example +// a shared library might not have any notes at all +// and have EI_OSABI flag set to System V, +// as result the OS will be set to UnknownOS. GetOsFromOSABI(header.e_ident[EI_OSABI], ostype); spec_ostype = arch_spec.GetTriple().getOS(); assert(spec_ostype == ostype); ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D27380: [lldb] Update the check for Linux or FreeBSD in SymbolFileDWARF::FindFunctions.
This revision was automatically updated to reflect the committed changes. Closed by commit rL288687: [lldb] Update the check for Linux or FreeBSD in SymbolFileDWARF::FindFunctions (authored by alexshap). Changed prior to commit: https://reviews.llvm.org/D27380?vs=80278&id=80295#toc Repository: rL LLVM https://reviews.llvm.org/D27380 Files: lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Index: lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp === --- lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp +++ lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp @@ -1513,8 +1513,14 @@ const uint32_t sub_type = subTypeFromElfHeader(header); arch_spec.SetArchitecture(eArchTypeELF, header.e_machine, sub_type, header.e_ident[EI_OSABI]); -// -// Validate if it is ok to remove GetOsFromOSABI + +// Validate if it is ok to remove GetOsFromOSABI. +// Note, that now the OS is determined based on EI_OSABI flag and +// the info extracted from ELF notes (see RefineModuleDetailsFromNote). +// However in some cases that still might be not enough: for example +// a shared library might not have any notes at all +// and have EI_OSABI flag set to System V, +// as result the OS will be set to UnknownOS. GetOsFromOSABI(header.e_ident[EI_OSABI], ostype); spec_ostype = arch_spec.GetTriple().getOS(); assert(spec_ostype == ostype); Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp === --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -2586,8 +2586,7 @@ if (sc_list.GetSize() == original_size) { ArchSpec arch; if (!parent_decl_ctx && GetObjectFile()->GetArchitecture(arch) && -(arch.GetTriple().isOSFreeBSD() || arch.GetTriple().isOSLinux() || - arch.GetMachine() == llvm::Triple::hexagon)) { +arch.GetTriple().isOSBinFormatELF()) { SymbolContextList temp_sc_list; FindFunctions(name, m_function_basename_index, include_inlines, temp_sc_list); Index: lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp === --- lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp +++ lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp @@ -1513,8 +1513,14 @@ const uint32_t sub_type = subTypeFromElfHeader(header); arch_spec.SetArchitecture(eArchTypeELF, header.e_machine, sub_type, header.e_ident[EI_OSABI]); -// -// Validate if it is ok to remove GetOsFromOSABI + +// Validate if it is ok to remove GetOsFromOSABI. +// Note, that now the OS is determined based on EI_OSABI flag and +// the info extracted from ELF notes (see RefineModuleDetailsFromNote). +// However in some cases that still might be not enough: for example +// a shared library might not have any notes at all +// and have EI_OSABI flag set to System V, +// as result the OS will be set to UnknownOS. GetOsFromOSABI(header.e_ident[EI_OSABI], ostype); spec_ostype = arch_spec.GetTriple().getOS(); assert(spec_ostype == ostype); Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp === --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -2586,8 +2586,7 @@ if (sc_list.GetSize() == original_size) { ArchSpec arch; if (!parent_decl_ctx && GetObjectFile()->GetArchitecture(arch) && -(arch.GetTriple().isOSFreeBSD() || arch.GetTriple().isOSLinux() || - arch.GetMachine() == llvm::Triple::hexagon)) { +arch.GetTriple().isOSBinFormatELF()) { SymbolContextList temp_sc_list; FindFunctions(name, m_function_basename_index, include_inlines, temp_sc_list); ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits