From 98963db57d04d38f154ca37b9c8c768da1697222 Mon Sep 17 00:00:00 2001 From: George Rimar Date: Wed, 14 Nov 2018 10:35:14 +0000 Subject: [PATCH] [LLDB] - Support the single file split DWARF. DWARF5 spec describes a single file split dwarf case (when .dwo sections are in the .o files). Problem is that LLDB does not work correctly in that case. The issue is that, for example, both .debug_info and .debug_info.dwo has the same type: eSectionTypeDWARFDebugInfo. And when code searches section by type it might find the regular debug section and not the .dwo one. The patch fixes that. With it, LLDB is able to work with output compiled with -gsplit-dwarf=single flag correctly. Differential revision: https://reviews.llvm.org/D52296 llvm-svn: 346848 --- lldb/include/lldb/lldb-enumerations.h | 4 + .../Inputs/single-file-split-dwarf.o.yaml | 84 +++++++++++++++++++ .../Inputs/single-file-split-dwarf.yaml | 61 ++++++++++++++ .../Breakpoint/single-file-split-dwarf.test | 38 +++++++++ lldb/source/Core/Section.cpp | 8 ++ .../Plugins/ObjectFile/ELF/ObjectFileELF.cpp | 8 +- .../ObjectFile/Mach-O/ObjectFileMachO.cpp | 4 + .../SymbolFile/DWARF/SymbolFileDWARF.h | 10 +-- .../SymbolFile/DWARF/SymbolFileDWARFDwo.cpp | 39 +++++++-- .../SymbolFile/DWARF/SymbolFileDWARFDwo.h | 6 ++ lldb/source/Symbol/ObjectFile.cpp | 4 + 11 files changed, 249 insertions(+), 17 deletions(-) create mode 100644 lldb/lit/Breakpoint/Inputs/single-file-split-dwarf.o.yaml create mode 100644 lldb/lit/Breakpoint/Inputs/single-file-split-dwarf.yaml create mode 100644 lldb/lit/Breakpoint/single-file-split-dwarf.test diff --git a/lldb/include/lldb/lldb-enumerations.h b/lldb/include/lldb/lldb-enumerations.h index 7fc7f06eb41f..0ed634071e26 100644 --- a/lldb/include/lldb/lldb-enumerations.h +++ b/lldb/include/lldb/lldb-enumerations.h @@ -708,6 +708,10 @@ enum SectionType { eSectionTypeDWARFDebugLineStr, // DWARF v5 .debug_line_str eSectionTypeDWARFDebugRngLists, // DWARF v5 .debug_rnglists eSectionTypeDWARFDebugLocLists, // DWARF v5 .debug_loclists + eSectionTypeDWARFDebugAbbrevDwo, + eSectionTypeDWARFDebugInfoDwo, + eSectionTypeDWARFDebugStrDwo, + eSectionTypeDWARFDebugStrOffsetsDwo, }; FLAGS_ENUM(EmulateInstructionOptions){ diff --git a/lldb/lit/Breakpoint/Inputs/single-file-split-dwarf.o.yaml b/lldb/lit/Breakpoint/Inputs/single-file-split-dwarf.o.yaml new file mode 100644 index 000000000000..5adc9d82fcad --- /dev/null +++ b/lldb/lit/Breakpoint/Inputs/single-file-split-dwarf.o.yaml @@ -0,0 +1,84 @@ +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_REL + Machine: EM_X86_64 +Sections: + - Name: .text + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC, SHF_EXECINSTR ] + AddressAlign: 0x0000000000000010 + Content: 554889E531C0C745FC000000005DC390554889E55DC3 + - Name: .debug_str_offsets + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: 0C000000050000000000000000000000 + - Name: .debug_str + Type: SHT_PROGBITS + Flags: [ SHF_MERGE, SHF_STRINGS ] + AddressAlign: 0x0000000000000001 + Content: 746573742E6F002F686F6D652F756D622F74657374735F323031382F39355F6C6C64622F726570726F2F6477617266355F73706C69745F73696E676C655F66696C652F707265706172655F73616D706C65006D61696E00666F6F005F5A33666F6F7600696E7400 + - Name: .debug_loc.dwo + Type: SHT_PROGBITS + Flags: [ SHF_EXCLUDE ] + AddressAlign: 0x0000000000000001 + Content: '' + - Name: .debug_abbrev + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: 01110010177217B042251B25B44219B3421711011206000000 + - Name: .debug_info + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: 2B00000005000408000000003F4B7684A29835B9010000000000000000000100000000000000000000000016000000 + - Name: .debug_macinfo + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: '00' + - Name: .debug_str_offsets.dwo + Type: SHT_PROGBITS + Flags: [ SHF_EXCLUDE ] + AddressAlign: 0x0000000000000001 + Content: 200000000500000000000000070000002A00000033000000380000003C00000044000000 + - Name: .debug_str.dwo + Type: SHT_PROGBITS + Flags: [ SHF_EXCLUDE, SHF_MERGE, SHF_STRINGS ] + AddressAlign: 0x0000000000000001 + Content: 746573742E6F00636C616E672076657273696F6E20382E302E3020287472756E6B203334323731382900746573742E637070006D61696E00696E74005F5A33666F6F7600666F6F00 + - Name: .debug_info.dwo + Type: SHT_PROGBITS + Flags: [ SHF_EXCLUDE ] + AddressAlign: 0x0000000000000001 + Content: 3600000005000508000000003F4B7684A29835B901000104000202000F0000000156030101350000000301060000000156050601050404050400 + - Name: .debug_abbrev.dwo + Type: SHT_PROGBITS + Flags: [ SHF_EXCLUDE ] + AddressAlign: 0x0000000000000001 + Content: 011101B042252525130503250000022E0011813E1206401803253A0B3B0B49133F190000032E0011813E120640186E2503253A0B3B0B3F19000004240003253E0B0B0B000000 + - Name: .debug_addr + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: '140000000500080000000000000000000000000000000000' + - Name: .debug_names + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000004 + Content: A00000000500000001000000000000000000000004000000040000000D000000080000004C4C564D3037303000000000010000000200000003000000040000003080880B8973880B6A7F9A7C0B3D06B5000000000000000000000000000000000000000009000000120000001B0000002E2E03130000242403130000002435000000000000002E29000000000000002E1A000000000000002E2900000000000000000000 + - Name: .debug_gnu_pubnames + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: 210000000200000000002F0000002900000030666F6F001A000000306D61696E0000000000 + - Name: .debug_gnu_pubtypes + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: 170000000200000000002F0000003500000090696E740000000000 + - Name: .debug_line + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: 70000000050008004C000000010101FB0E0D00010101010000000100000101011F010000000003011F020F051E020000000000FD7C0F2E46BA561F7BDA351B04E677090000000000FD7C0F2E46BA561F7BDA351B04E6770900090200000000000000000105030AC905003F05010A4B0202000101 + - Name: .debug_line_str + Type: SHT_PROGBITS + Flags: [ SHF_MERGE, SHF_STRINGS ] + AddressAlign: 0x0000000000000001 + Content: 2F686F6D652F756D622F74657374735F323031382F39355F6C6C64622F726570726F2F6477617266355F73706C69745F73696E676C655F66696C652F707265706172655F73616D706C6500746573742E63707000 +... diff --git a/lldb/lit/Breakpoint/Inputs/single-file-split-dwarf.yaml b/lldb/lit/Breakpoint/Inputs/single-file-split-dwarf.yaml new file mode 100644 index 000000000000..e86cd87ff0b0 --- /dev/null +++ b/lldb/lit/Breakpoint/Inputs/single-file-split-dwarf.yaml @@ -0,0 +1,61 @@ +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_EXEC + Machine: EM_X86_64 + Entry: 0x0000000000400440 +Sections: + - Name: .text + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC, SHF_EXECINSTR ] + Address: 0x0000000000400440 + AddressAlign: 0x0000000000000010 + Content: 31ED4989D15E4889E24883E4F0505449C7C0B005400048C7C14005400048C7C720054000E8B7FFFFFFF4660F1F44000055B820204000483D202040004889E57417B8000000004885C0740D5DBF20204000FFE00F1F4400005DC3660F1F440000BE20204000554881EE202040004889E548C1FE034889F048C1E83F4801C648D1FE7415B8000000004885C0740B5DBF20204000FFE00F1F005DC3660F1F440000803D391B0000007517554889E5E87EFFFFFFC605271B0000015DC30F1F440000F3C30F1F4000662E0F1F840000000000554889E55DEB89660F1F840000000000554889E531C0C745FC000000005DC390554889E55DC3662E0F1F840000000000415741564189FF415541544C8D25B618000055488D2DB6180000534989F64989D54C29E54883EC0848C1FD03E87FFEFFFF4885ED742031DB0F1F8400000000004C89EA4C89F64489FF41FF14DC4883C3014839EB75EA4883C4085B5D415C415D415E415FC390662E0F1F840000000000F3C3 + - Name: .debug_str_offsets + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: 0C000000050000000000000007000000 + - Name: .debug_str + Type: SHT_PROGBITS + Flags: [ SHF_MERGE, SHF_STRINGS ] + AddressAlign: 0x0000000000000001 + Content: 746573742E6F002F686F6D652F756D622F74657374735F323031382F39355F6C6C64622F726570726F2F6477617266355F73706C69745F73696E676C655F66696C652F707265706172655F73616D706C65006D61696E00666F6F005F5A33666F6F7600696E7400 + - Name: .debug_abbrev + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: 01110010177217B042251B25B44219B3421711011206000000 + - Name: .debug_info + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: 2B00000005000408000000003F4B7684A29835B9010000000008000000000108000000200540000000000016000000 + - Name: .debug_macinfo + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: '00' + - Name: .debug_addr + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: '140000000500080020054000000000003005400000000000' + - Name: .debug_names + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000004 + Content: A00000000500000001000000000000000000000004000000040000000D000000080000004C4C564D3037303000000000010000000200000003000000040000003080880B8973880B6A7F9A7C0B3D06B56300000057000000520000005B0000000000000009000000120000001B0000002E2E03130000242403130000002435000000000000002E29000000000000002E1A000000000000002E2900000000000000000000 + - Name: .debug_gnu_pubnames + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: 210000000200000000002F0000002900000030666F6F001A000000306D61696E0000000000 + - Name: .debug_gnu_pubtypes + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: 170000000200000000002F0000003500000090696E740000000000 + - Name: .debug_line + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: 70000000050008004C000000010101FB0E0D00010101010000000100000101011F010000000003011F020F051E024B00000000FD7C0F2E46BA561F7BDA351B04E677094B00000000FD7C0F2E46BA561F7BDA351B04E6770900090220054000000000000105030AC905003F05010A4B0202000101 + - Name: .debug_line_str + Type: SHT_PROGBITS + Flags: [ SHF_MERGE, SHF_STRINGS ] + AddressAlign: 0x0000000000000001 + Content: 2F686F6D652F756D622F74657374735F323031382F39355F6C6C64622F726570726F2F6477617266355F73706C69745F73696E676C655F66696C652F707265706172655F73616D706C6500746573742E63707000 +... diff --git a/lldb/lit/Breakpoint/single-file-split-dwarf.test b/lldb/lit/Breakpoint/single-file-split-dwarf.test new file mode 100644 index 000000000000..2488f7612f9f --- /dev/null +++ b/lldb/lit/Breakpoint/single-file-split-dwarf.test @@ -0,0 +1,38 @@ +# RUN: yaml2obj %p/Inputs/single-file-split-dwarf.yaml > %ttest +# RUN: yaml2obj %p/Inputs/single-file-split-dwarf.o.yaml > %ttest.o +# RUN: lldb-test breakpoints %ttest %s | FileCheck %s + +# This test checks that source code location is shown correctly +# when single split file debug information is used (when .dwo sections are in .o files). +# +# single-file-split-dwarf.yaml and single-file-split-dwarf.o.yaml are +# reduced yaml files produces from the object file and the corresponding executable. +# +# The following code was used initially: +# int main() { +# return 0; +# } +# +# void foo() { +# } +# +# Invocation used to produce .o file was: +# clang test.cpp -gdwarf-5 -gsplit-dwarf=single -c -o test.o -v +# +# Invocation used to produce the executable was: +# "/usr/local/bin/ld" -z relro --hash-style=gnu --eh-frame-hdr -m elf_x86_64 -dynamic-linker +# /lib64/ld-linux-x86-64.so.2 -o test /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../x86_64-linux-gnu/crt1.o +# /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/7.3.0/crtbegin.o +# -L/usr/lib/gcc/x86_64-linux-gnu/7.3.0 -L/usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../x86_64-linux-gnu +# -L/lib/x86_64-linux-gnu -L/lib/../lib64 -L/usr/lib/x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../.. +# -L/home/umb/LLVM/build/bin/../lib -L/lib -L/usr/lib test.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc +# --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/x86_64-linux-gnu/7.3.0/crtend.o +# /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../x86_64-linux-gnu/crtn.o + +b main +# CHECK-LABEL: b main +# CHECK: Address: {{.*}}main + 13 at test.cpp:2:3 + +b foo +# CHECK-LABEL: b foo +# CHECK: Address: {{.*}}foo() + 4 at test.cpp:6:1 diff --git a/lldb/source/Core/Section.cpp b/lldb/source/Core/Section.cpp index 626878175099..87f75e1f50ac 100644 --- a/lldb/source/Core/Section.cpp +++ b/lldb/source/Core/Section.cpp @@ -61,6 +61,8 @@ const char *Section::GetTypeAsCString() const { return "objc-cfstrings"; case eSectionTypeDWARFDebugAbbrev: return "dwarf-abbrev"; + case eSectionTypeDWARFDebugAbbrevDwo: + return "dwarf-abbrev-dwo"; case eSectionTypeDWARFDebugAddr: return "dwarf-addr"; case eSectionTypeDWARFDebugAranges: @@ -71,6 +73,8 @@ const char *Section::GetTypeAsCString() const { return "dwarf-frame"; case eSectionTypeDWARFDebugInfo: return "dwarf-info"; + case eSectionTypeDWARFDebugInfoDwo: + return "dwarf-info-dwo"; case eSectionTypeDWARFDebugLine: return "dwarf-line"; case eSectionTypeDWARFDebugLineStr: @@ -93,8 +97,12 @@ const char *Section::GetTypeAsCString() const { return "dwarf-rnglists"; case eSectionTypeDWARFDebugStr: return "dwarf-str"; + case eSectionTypeDWARFDebugStrDwo: + return "dwarf-str-dwo"; case eSectionTypeDWARFDebugStrOffsets: return "dwarf-str-offsets"; + case eSectionTypeDWARFDebugStrOffsetsDwo: + return "dwarf-str-offsets-dwo"; case eSectionTypeDWARFDebugTypes: return "dwarf-types"; case eSectionTypeDWARFDebugNames: diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp index 1001eaef555a..efb6a0b85c1b 100644 --- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp +++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp @@ -1897,9 +1897,9 @@ void ObjectFileELF::CreateSections(SectionList &unified_section_list) { else if (name == g_sect_name_dwarf_debug_str_offsets) sect_type = eSectionTypeDWARFDebugStrOffsets; else if (name == g_sect_name_dwarf_debug_abbrev_dwo) - sect_type = eSectionTypeDWARFDebugAbbrev; + sect_type = eSectionTypeDWARFDebugAbbrevDwo; else if (name == g_sect_name_dwarf_debug_info_dwo) - sect_type = eSectionTypeDWARFDebugInfo; + sect_type = eSectionTypeDWARFDebugInfoDwo; else if (name == g_sect_name_dwarf_debug_line_dwo) sect_type = eSectionTypeDWARFDebugLine; else if (name == g_sect_name_dwarf_debug_line_str_dwo) @@ -1911,9 +1911,9 @@ void ObjectFileELF::CreateSections(SectionList &unified_section_list) { else if (name == g_sect_name_dwarf_debug_loclists_dwo) sect_type = eSectionTypeDWARFDebugLocLists; else if (name == g_sect_name_dwarf_debug_str_dwo) - sect_type = eSectionTypeDWARFDebugStr; + sect_type = eSectionTypeDWARFDebugStrDwo; else if (name == g_sect_name_dwarf_debug_str_offsets_dwo) - sect_type = eSectionTypeDWARFDebugStrOffsets; + sect_type = eSectionTypeDWARFDebugStrOffsetsDwo; else if (name == g_sect_name_eh_frame) sect_type = eSectionTypeEHFrame; else if (name == g_sect_name_arm_exidx) diff --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp index e14e4094f66c..dafbb64847cd 100644 --- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp +++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp @@ -1187,11 +1187,13 @@ AddressClass ObjectFileMachO::GetAddressClass(lldb::addr_t file_addr) { case eSectionTypeDebug: case eSectionTypeDWARFDebugAbbrev: + case eSectionTypeDWARFDebugAbbrevDwo: case eSectionTypeDWARFDebugAddr: case eSectionTypeDWARFDebugAranges: case eSectionTypeDWARFDebugCuIndex: case eSectionTypeDWARFDebugFrame: case eSectionTypeDWARFDebugInfo: + case eSectionTypeDWARFDebugInfoDwo: case eSectionTypeDWARFDebugLine: case eSectionTypeDWARFDebugLineStr: case eSectionTypeDWARFDebugLoc: @@ -1204,7 +1206,9 @@ AddressClass ObjectFileMachO::GetAddressClass(lldb::addr_t file_addr) { case eSectionTypeDWARFDebugRanges: case eSectionTypeDWARFDebugRngLists: case eSectionTypeDWARFDebugStr: + case eSectionTypeDWARFDebugStrDwo: case eSectionTypeDWARFDebugStrOffsets: + case eSectionTypeDWARFDebugStrOffsetsDwo: case eSectionTypeDWARFDebugTypes: case eSectionTypeDWARFAppleNames: case eSectionTypeDWARFAppleTypes: diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h index dc678e167023..1e30e17f3cfe 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h @@ -233,11 +233,11 @@ public: uint32_t GetPluginVersion() override; - const lldb_private::DWARFDataExtractor &get_debug_abbrev_data(); - const lldb_private::DWARFDataExtractor &get_debug_addr_data(); + virtual const lldb_private::DWARFDataExtractor &get_debug_abbrev_data(); + virtual const lldb_private::DWARFDataExtractor &get_debug_addr_data(); const lldb_private::DWARFDataExtractor &get_debug_aranges_data(); const lldb_private::DWARFDataExtractor &get_debug_frame_data(); - const lldb_private::DWARFDataExtractor &get_debug_info_data(); + virtual const lldb_private::DWARFDataExtractor &get_debug_info_data(); const lldb_private::DWARFDataExtractor &get_debug_line_data(); const lldb_private::DWARFDataExtractor &get_debug_line_str_data(); const lldb_private::DWARFDataExtractor &get_debug_macro_data(); @@ -245,8 +245,8 @@ public: const lldb_private::DWARFDataExtractor &get_debug_loclists_data(); const lldb_private::DWARFDataExtractor &get_debug_ranges_data(); const lldb_private::DWARFDataExtractor &get_debug_rnglists_data(); - const lldb_private::DWARFDataExtractor &get_debug_str_data(); - const lldb_private::DWARFDataExtractor &get_debug_str_offsets_data(); + virtual const lldb_private::DWARFDataExtractor &get_debug_str_data(); + virtual const lldb_private::DWARFDataExtractor &get_debug_str_offsets_data(); const lldb_private::DWARFDataExtractor &get_debug_types_data(); const lldb_private::DWARFDataExtractor &get_apple_names_data(); const lldb_private::DWARFDataExtractor &get_apple_types_data(); diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp index 15fe362fa117..7881448535b8 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp @@ -61,14 +61,6 @@ SymbolFileDWARFDwo::ParseCompileUnit(DWARFUnit *dwarf_cu, } DWARFUnit *SymbolFileDWARFDwo::GetCompileUnit() { - // A clang module is found via a skeleton CU, but is not a proper DWO. - // Clang modules have a .debug_info section instead of the *_dwo variant. - if (auto *section_list = m_obj_file->GetSectionList(false)) - if (auto section_sp = - section_list->FindSectionByType(eSectionTypeDWARFDebugInfo, true)) - if (!section_sp->GetName().GetStringRef().endswith("dwo")) - return nullptr; - // Only dwo files with 1 compile unit is supported if (GetNumCompileUnits() == 1) return DebugInfo()->GetCompileUnitAtIndex(0); @@ -126,6 +118,37 @@ DWARFUnit *SymbolFileDWARFDwo::GetBaseCompileUnit() { return m_base_dwarf_cu; } +const DWARFDataExtractor &SymbolFileDWARFDwo::get_debug_abbrev_data() { + return GetCachedSectionData(eSectionTypeDWARFDebugAbbrevDwo, + m_data_debug_abbrev); +} + +const DWARFDataExtractor &SymbolFileDWARFDwo::get_debug_addr_data() { + // For single file split dwarf case (when we have .dwo sections in a .o), + // we do not want to use the .debug_addr section from .o file, + // but want to get one from the final executable. + // For regular split debug case, .dwo file does not contain the + // .debug_addr, so we would always fall back to such lookup anyways. + llvm::call_once(m_data_debug_addr.m_flag, [this] { + SymbolFileDWARF::LoadSectionData(eSectionTypeDWARFDebugAddr, + std::ref(m_data_debug_addr.m_data)); + }); + return m_data_debug_addr.m_data; +} + +const DWARFDataExtractor &SymbolFileDWARFDwo::get_debug_info_data() { + return GetCachedSectionData(eSectionTypeDWARFDebugInfoDwo, m_data_debug_info); +} + +const DWARFDataExtractor &SymbolFileDWARFDwo::get_debug_str_data() { + return GetCachedSectionData(eSectionTypeDWARFDebugStrDwo, m_data_debug_str); +} + +const DWARFDataExtractor &SymbolFileDWARFDwo::get_debug_str_offsets_data() { + return GetCachedSectionData(eSectionTypeDWARFDebugStrOffsetsDwo, + m_data_debug_str_offsets); +} + SymbolFileDWARF *SymbolFileDWARFDwo::GetBaseSymbolFile() { return m_base_dwarf_cu->GetSymbolFileDWARF(); } diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h index 21ad90cca643..b9ed37547aca 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h @@ -46,6 +46,12 @@ public: DWARFUnit *GetBaseCompileUnit() override; + const lldb_private::DWARFDataExtractor &get_debug_abbrev_data() override; + const lldb_private::DWARFDataExtractor &get_debug_addr_data() override; + const lldb_private::DWARFDataExtractor &get_debug_info_data() override; + const lldb_private::DWARFDataExtractor &get_debug_str_data() override; + const lldb_private::DWARFDataExtractor &get_debug_str_offsets_data() override; + protected: void LoadSectionData(lldb::SectionType sect_type, lldb_private::DWARFDataExtractor &data) override; diff --git a/lldb/source/Symbol/ObjectFile.cpp b/lldb/source/Symbol/ObjectFile.cpp index d56acd230c35..db9136e4ba82 100644 --- a/lldb/source/Symbol/ObjectFile.cpp +++ b/lldb/source/Symbol/ObjectFile.cpp @@ -345,11 +345,13 @@ AddressClass ObjectFile::GetAddressClass(addr_t file_addr) { return AddressClass::eData; case eSectionTypeDebug: case eSectionTypeDWARFDebugAbbrev: + case eSectionTypeDWARFDebugAbbrevDwo: case eSectionTypeDWARFDebugAddr: case eSectionTypeDWARFDebugAranges: case eSectionTypeDWARFDebugCuIndex: case eSectionTypeDWARFDebugFrame: case eSectionTypeDWARFDebugInfo: + case eSectionTypeDWARFDebugInfoDwo: case eSectionTypeDWARFDebugLine: case eSectionTypeDWARFDebugLineStr: case eSectionTypeDWARFDebugLoc: @@ -362,7 +364,9 @@ AddressClass ObjectFile::GetAddressClass(addr_t file_addr) { case eSectionTypeDWARFDebugRanges: case eSectionTypeDWARFDebugRngLists: case eSectionTypeDWARFDebugStr: + case eSectionTypeDWARFDebugStrDwo: case eSectionTypeDWARFDebugStrOffsets: + case eSectionTypeDWARFDebugStrOffsetsDwo: case eSectionTypeDWARFDebugTypes: case eSectionTypeDWARFAppleNames: case eSectionTypeDWARFAppleTypes: