[Lldb-commits] [lldb] r314832 - [lldb] Fix initialization of m_debug_cu_index_map
Alexander Shaposhnikov via lldb-commits
lldb-commits at lists.llvm.org
Tue Oct 3 12:56:21 PDT 2017
Author: alexshap
Date: Tue Oct 3 12:56:21 2017
New Revision: 314832
URL: http://llvm.org/viewvc/llvm-project?rev=314832&view=rev
Log:
[lldb] Fix initialization of m_debug_cu_index_map
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 SymbolFileDWARFDwp::Create.
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
Build LLDB with ENABLE_DEBUG_PRINTF set.
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))
Differential revision: http://reviews.llvm.org/D38492
Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwp.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwp.h
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwp.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwp.cpp?rev=314832&r1=314831&r2=314832&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwp.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwp.cpp Tue Oct 3 12:56:21 2017
@@ -69,17 +69,21 @@ SymbolFileDWARFDwp::Create(lldb::ModuleS
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) {
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwp.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwp.h?rev=314832&r1=314831&r2=314832&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwp.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwp.h Tue Oct 3 12:56:21 2017
@@ -40,6 +40,8 @@ private:
bool LoadRawSectionData(lldb::SectionType sect_type,
lldb_private::DWARFDataExtractor &data);
+
+ void InitDebugCUIndexMap();
lldb::ObjectFileSP m_obj_file;
More information about the lldb-commits
mailing list