[Lldb-commits] [lldb] r314672 - Improve FreeBSD kernel debugging
Author: emaste Date: Mon Oct 2 07:35:07 2017 New Revision: 314672 URL: http://llvm.org/viewvc/llvm-project?rev=314672&view=rev Log: Improve FreeBSD kernel debugging FreeBSD kernel modules are actually relocatable (.o) ELF files and this previously caused some issues for LLDB. This change addresses these when using lldb to symbolicate FreeBSD kernel backtraces. The major problems: - Relocations were not being applied to the DWARF debug info despite there being code to do this. Several issues prevented it from working: - Relocations are computed at the same time as the symbol table, but in the case of split debug files, symbol table parsing always redirects to the primary object file, meaning that relocations would never be applied in the debug file. - There's actually no guarantee that the symbol table has been parsed yet when trying to parse debug information. - When actually applying relocations, it will segfault because the object files are not mapped with MAP_PRIVATE and PROT_WRITE. - LLDB returned invalid results when performing ordinary address-to- symbol resolution. It turned out that the addresses specified in the section headers were all 0, so LLDB believed all the sections had overlapping "file addresses" and would sometimes return a symbol from the wrong section. Patch by Brian Koropoff Differential Revision: https://reviews.llvm.org/D38142 Modified: lldb/trunk/include/lldb/Core/Section.h lldb/trunk/include/lldb/Symbol/ArmUnwindInfo.h lldb/trunk/include/lldb/Symbol/ObjectFile.h lldb/trunk/source/Core/Section.cpp lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.h lldb/trunk/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp lldb/trunk/source/Plugins/ObjectFile/JIT/ObjectFileJIT.h lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp lldb/trunk/source/Symbol/ArmUnwindInfo.cpp lldb/trunk/source/Symbol/ObjectFile.cpp Modified: lldb/trunk/include/lldb/Core/Section.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Section.h?rev=314672&r1=314671&r2=314672&view=diff == --- lldb/trunk/include/lldb/Core/Section.h (original) +++ lldb/trunk/include/lldb/Core/Section.h Mon Oct 2 07:35:07 2017 @@ -238,7 +238,7 @@ public: /// section has no data or \a offset is not a valid offset /// in this section. //-- - lldb::offset_t GetSectionData(DataExtractor &data) const; + lldb::offset_t GetSectionData(DataExtractor &data); uint32_t GetLog2Align() { return m_log2align; } @@ -247,6 +247,10 @@ public: // Get the number of host bytes required to hold a target byte uint32_t GetTargetByteSize() const { return m_target_byte_size; } + bool IsRelocated() const { return m_relocated; } + + void SetIsRelocated(bool b) { m_relocated = b; } + protected: ObjectFile *m_obj_file; // The object file that data for this section should // be read from @@ -274,7 +278,8 @@ protected: m_thread_specific : 1, // This section is thread specific m_readable : 1, // If this section has read permissions m_writable : 1, // If this section has write permissions - m_executable : 1;// If this section has executable permissions + m_executable : 1,// If this section has executable permissions + m_relocated : 1; // If this section has had relocations applied uint32_t m_target_byte_size; // Some architectures have non-8-bit byte size. // This is specified as // as a multiple number of a host bytes Modified: lldb/trunk/include/lldb/Symbol/ArmUnwindInfo.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ArmUnwindInfo.h?rev=314672&r1=314671&r2=314672&view=diff == --- lldb/trunk/include/lldb/Symbol/ArmUnwindInfo.h (original) +++ lldb/trunk/include/lldb/Symbol/ArmUnwindInfo.h Mon Oct 2 07:35:07 2017 @@ -31,7 +31,7 @@ namespace lldb_private { class ArmUnwindInfo { public: - ArmUnwindInfo(const ObjectFile &objfile, lldb::SectionSP &arm_exidx, + ArmUnwindInfo(ObjectFile &objfile, lldb::SectionSP &arm_exidx, lldb::SectionSP &arm_extab); ~ArmUnwindInfo(); Modified: lldb/trunk/include/lldb/Symbol/ObjectFile.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ObjectFile.h?rev=314672&r1=314671&r2=314672&view=diff == --- lldb/trunk/include/lldb/Symbol/ObjectFile.h (original) +++ lldb/trunk/include/lldb/Symbol/ObjectFile.h Mon Oct 2 07:35:07 2017 @@ -352,6 +352,12 @@ public: virtual Symtab *GetSymtab()
Re: [Lldb-commits] [lldb] r314458 - [Expression parser] Setting to enable use of ExternalASTMerger
On 28 September 2017 at 22:20, Sean Callanan via lldb-commits wrote: > Author: spyffe > Date: Thu Sep 28 13:20:25 2017 > New Revision: 314458 > > URL: http://llvm.org/viewvc/llvm-project?rev=314458&view=rev > Log: > [Expression parser] Setting to enable use of ExternalASTMerger > ... > + lldbassert(!"No mechanism for completing a type!"); Clang 5.0.0 in FreeBSD's base system produces a warning on these lldbasserts "implicit conversion turns string literal into bool". I'm not aware of a nice, concise alternative idiom. This eliminates the warning and may be the best option: lldbassert(false && "string"); I'll switch these over if you have no objection. ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D12245: Implement basic DidAttach and DidLaunch for DynamicLoaderWindowsDYLD.
zturner added a comment. Hi Stephane, what's the status of this? Do you still need this functionality? Repository: rL LLVM https://reviews.llvm.org/D12245 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D12245: Implement basic DidAttach and DidLaunch for DynamicLoaderWindowsDYLD.
I do. We still use this but always in a remote debugging scenario so I never had issues with this diff and I haven't gotten around to looking at windows unit tests at all. On Mon, Oct 2, 2017 at 9:43 AM Zachary Turner via Phabricator < revi...@reviews.llvm.org> wrote: > zturner added a comment. > > Hi Stephane, what's the status of this? Do you still need this > functionality? > > > Repository: > rL LLVM > > https://reviews.llvm.org/D12245 > > > > -- -- Stephane Sezer ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r314731 - Move install_name_tool to a separate make target.
Author: jmolenda Date: Mon Oct 2 15:11:22 2017 New Revision: 314731 URL: http://llvm.org/viewvc/llvm-project?rev=314731&view=rev Log: Move install_name_tool to a separate make target. Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/Makefile Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/Makefile?rev=314731&r1=314730&r2=314731&view=diff == --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/Makefile (original) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/Makefile Mon Oct 2 15:11:22 2017 @@ -8,10 +8,12 @@ CXX_SOURCES := main.cpp include $(LEVEL)/Makefile.rules .PHONY: -a.out: lib_a lib_b lib_c lib_d hidden_lib_d +a.out: lib_a lib_b lib_c lib_d hidden_lib_d install_name_tool lib_%: $(MAKE) -f $*.mk + +install_name_tool: ifeq ($(OS),Darwin) install_name_tool -id @executable_path/libloadunload_d.dylib libloadunload_d.dylib endif ___ 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