[Lldb-commits] [PATCH] D38492: [lldb] Fix initialization of m_debug_cu_index_map
Alexander Shaposhnikov via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Mon Oct 2 22:50:10 PDT 2017
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) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38492.117470.patch
Type: text/x-patch
Size: 1801 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20171003/ee6493fd/attachment.bin>
More information about the lldb-commits
mailing list