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<SymbolFileDWARFDwo> 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<SymbolFileDWARFDwo> 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