diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFContext.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFContext.cpp --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFContext.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFContext.cpp @@ -117,32 +117,17 @@ if (!m_llvm_context) { llvm::StringMap> section_map; uint8_t addr_size = 0; - - auto AddSection = [&](Section §ion) { - DataExtractor section_data; - section.GetSectionData(section_data); - + auto AddSection = [&](llvm::StringRef name, DWARFDataExtractor data) { // Set the address size the first time we see it. if (addr_size == 0) - addr_size = section_data.GetByteSize(); + addr_size = data.GetAddressByteSize(); - llvm::StringRef data = llvm::toStringRef(section_data.GetData()); - llvm::StringRef name = section.GetName().GetStringRef(); - if (name.startswith(".")) - name = name.drop_front(); section_map.try_emplace( - name, llvm::MemoryBuffer::getMemBuffer(data, name, false)); + name, llvm::MemoryBuffer::getMemBuffer(toStringRef(data.GetData()), + name, false)); }; - if (m_main_section_list) { - for (auto §ion : *m_main_section_list) - AddSection(*section); - } - - if (m_dwo_section_list) { - for (auto §ion : *m_dwo_section_list) - AddSection(*section); - } + AddSection("debug_line_str", getOrLoadLineStrData()); m_llvm_context = llvm::DWARFContext::create(section_map, addr_size); } diff --git a/lldb/test/Shell/SymbolFile/DWARF/debug-names-compressed.cpp b/lldb/test/Shell/SymbolFile/DWARF/debug-names-compressed.cpp --- a/lldb/test/Shell/SymbolFile/DWARF/debug-names-compressed.cpp +++ b/lldb/test/Shell/SymbolFile/DWARF/debug-names-compressed.cpp @@ -3,12 +3,15 @@ // REQUIRES: lld, zlib -// RUN: %clang -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Dwarf %s +// RUN: %clang -c -o %t.o --target=x86_64-pc-linux -gdwarf-5 -gpubnames %s // RUN: ld.lld %t.o -o %t --compress-debug-sections=zlib +// RUN: llvm-readobj --sections %t | FileCheck %s --check-prefix NAMES // RUN: lldb-test symbols --find=variable --name=foo %t | FileCheck %s +// NAMES: Name: .debug_names + // CHECK: Found 1 variables: int foo; -// ONE-DAG: name = "foo", type = {{.*}} (int), {{.*}} decl = debug-names-compressed.cpp:[[@LINE-1]] +// CHECK-DAG: name = "foo", type = {{.*}} (int), {{.*}} decl = debug-names-compressed.cpp:[[@LINE-1]] extern "C" void _start() {}