[LLDB] Unify DWARF section name matching (#141344)

Different object file formats support DWARF sections (COFF, ELF, MachO,
PE/COFF, WASM). COFF and PE/COFF only matched a subset. This caused some
GCC executables produced on MinGW to have issue later on when debugging.
One example is that `.debug_rnglists` was not matched, which caused
range-extraction to fail when printing a backtrace.

This unifies the parsing of section names in
`ObjectFile::GetDWARFSectionTypeFromName`, so all file formats can use
the same naming convention. Since the prefixes are different,
`GetDWARFSectionTypeFromName` only matches the suffixes (i.e. `.debug_`
needs to be stripped before).

I added two tests to ensure the sections are correctly identified on
Windows executables.
This commit is contained in:
nerix
2025-06-09 10:46:50 +02:00
committed by GitHub
parent 62c9b0cab6
commit c6670fa20d
9 changed files with 364 additions and 175 deletions

View File

@@ -709,6 +709,13 @@ public:
llvm::StringRef name,
lldb::SymbolType symbol_type_hint = lldb::eSymbolTypeUndefined);
/// Parses the section type from a section name for DWARF sections.
///
/// The \a name must be stripped of the default prefix (e.g. ".debug_" or
/// "__debug_"). If there's no matching section type, \a eSectionTypeOther
/// will be returned.
static lldb::SectionType GetDWARFSectionTypeFromName(llvm::StringRef name);
/// Loads this objfile to memory.
///
/// Loads the bits needed to create an executable image to the memory. It is

View File

@@ -191,19 +191,15 @@ void ObjectFileCOFF::CreateSections(lldb_private::SectionList &sections) {
auto SectionType = [](StringRef Name,
const coff_section *Section) -> lldb::SectionType {
lldb::SectionType type =
StringSwitch<lldb::SectionType>(Name)
// DWARF Debug Sections
.Case(".debug_abbrev", eSectionTypeDWARFDebugAbbrev)
.Case(".debug_info", eSectionTypeDWARFDebugInfo)
.Case(".debug_line", eSectionTypeDWARFDebugLine)
.Case(".debug_pubnames", eSectionTypeDWARFDebugPubNames)
.Case(".debug_pubtypes", eSectionTypeDWARFDebugPubTypes)
.Case(".debug_str", eSectionTypeDWARFDebugStr)
// CodeView Debug Sections: .debug$S, .debug$T
.StartsWith(".debug$", eSectionTypeDebug)
.Case("clangast", eSectionTypeOther)
.Default(eSectionTypeInvalid);
// DWARF Debug Sections
if (Name.consume_front(".debug_"))
return GetDWARFSectionTypeFromName(Name);
lldb::SectionType type = StringSwitch<lldb::SectionType>(Name)
// CodeView Debug Sections: .debug$S, .debug$T
.StartsWith(".debug$", eSectionTypeDebug)
.Case("clangast", eSectionTypeOther)
.Default(eSectionTypeInvalid);
if (type != eSectionTypeInvalid)
return type;

View File

@@ -1653,39 +1653,9 @@ lldb::user_id_t ObjectFileELF::GetSectionIndexByName(const char *name) {
}
static SectionType GetSectionTypeFromName(llvm::StringRef Name) {
if (Name.consume_front(".debug_")) {
return llvm::StringSwitch<SectionType>(Name)
.Case("abbrev", eSectionTypeDWARFDebugAbbrev)
.Case("abbrev.dwo", eSectionTypeDWARFDebugAbbrevDwo)
.Case("addr", eSectionTypeDWARFDebugAddr)
.Case("aranges", eSectionTypeDWARFDebugAranges)
.Case("cu_index", eSectionTypeDWARFDebugCuIndex)
.Case("frame", eSectionTypeDWARFDebugFrame)
.Case("info", eSectionTypeDWARFDebugInfo)
.Case("info.dwo", eSectionTypeDWARFDebugInfoDwo)
.Cases("line", "line.dwo", eSectionTypeDWARFDebugLine)
.Cases("line_str", "line_str.dwo", eSectionTypeDWARFDebugLineStr)
.Case("loc", eSectionTypeDWARFDebugLoc)
.Case("loc.dwo", eSectionTypeDWARFDebugLocDwo)
.Case("loclists", eSectionTypeDWARFDebugLocLists)
.Case("loclists.dwo", eSectionTypeDWARFDebugLocListsDwo)
.Case("macinfo", eSectionTypeDWARFDebugMacInfo)
.Cases("macro", "macro.dwo", eSectionTypeDWARFDebugMacro)
.Case("names", eSectionTypeDWARFDebugNames)
.Case("pubnames", eSectionTypeDWARFDebugPubNames)
.Case("pubtypes", eSectionTypeDWARFDebugPubTypes)
.Case("ranges", eSectionTypeDWARFDebugRanges)
.Case("rnglists", eSectionTypeDWARFDebugRngLists)
.Case("rnglists.dwo", eSectionTypeDWARFDebugRngListsDwo)
.Case("str", eSectionTypeDWARFDebugStr)
.Case("str.dwo", eSectionTypeDWARFDebugStrDwo)
.Case("str_offsets", eSectionTypeDWARFDebugStrOffsets)
.Case("str_offsets.dwo", eSectionTypeDWARFDebugStrOffsetsDwo)
.Case("tu_index", eSectionTypeDWARFDebugTuIndex)
.Case("types", eSectionTypeDWARFDebugTypes)
.Case("types.dwo", eSectionTypeDWARFDebugTypesDwo)
.Default(eSectionTypeOther);
}
if (Name.consume_front(".debug_"))
return ObjectFile::GetDWARFSectionTypeFromName(Name);
return llvm::StringSwitch<SectionType>(Name)
.Case(".ARM.exidx", eSectionTypeARMexidx)
.Case(".ARM.extab", eSectionTypeARMextab)

View File

@@ -1595,34 +1595,6 @@ static lldb::SectionType GetSectionType(uint32_t flags,
static ConstString g_sect_name_objc_classlist("__objc_classlist");
static ConstString g_sect_name_cfstring("__cfstring");
static ConstString g_sect_name_dwarf_debug_abbrev("__debug_abbrev");
static ConstString g_sect_name_dwarf_debug_abbrev_dwo("__debug_abbrev.dwo");
static ConstString g_sect_name_dwarf_debug_addr("__debug_addr");
static ConstString g_sect_name_dwarf_debug_aranges("__debug_aranges");
static ConstString g_sect_name_dwarf_debug_cu_index("__debug_cu_index");
static ConstString g_sect_name_dwarf_debug_frame("__debug_frame");
static ConstString g_sect_name_dwarf_debug_info("__debug_info");
static ConstString g_sect_name_dwarf_debug_info_dwo("__debug_info.dwo");
static ConstString g_sect_name_dwarf_debug_line("__debug_line");
static ConstString g_sect_name_dwarf_debug_line_dwo("__debug_line.dwo");
static ConstString g_sect_name_dwarf_debug_line_str("__debug_line_str");
static ConstString g_sect_name_dwarf_debug_loc("__debug_loc");
static ConstString g_sect_name_dwarf_debug_loclists("__debug_loclists");
static ConstString g_sect_name_dwarf_debug_loclists_dwo("__debug_loclists.dwo");
static ConstString g_sect_name_dwarf_debug_macinfo("__debug_macinfo");
static ConstString g_sect_name_dwarf_debug_macro("__debug_macro");
static ConstString g_sect_name_dwarf_debug_macro_dwo("__debug_macro.dwo");
static ConstString g_sect_name_dwarf_debug_names("__debug_names");
static ConstString g_sect_name_dwarf_debug_pubnames("__debug_pubnames");
static ConstString g_sect_name_dwarf_debug_pubtypes("__debug_pubtypes");
static ConstString g_sect_name_dwarf_debug_ranges("__debug_ranges");
static ConstString g_sect_name_dwarf_debug_rnglists("__debug_rnglists");
static ConstString g_sect_name_dwarf_debug_str("__debug_str");
static ConstString g_sect_name_dwarf_debug_str_dwo("__debug_str.dwo");
static ConstString g_sect_name_dwarf_debug_str_offs("__debug_str_offs");
static ConstString g_sect_name_dwarf_debug_str_offs_dwo("__debug_str_offs.dwo");
static ConstString g_sect_name_dwarf_debug_tu_index("__debug_tu_index");
static ConstString g_sect_name_dwarf_debug_types("__debug_types");
static ConstString g_sect_name_dwarf_apple_names("__apple_names");
static ConstString g_sect_name_dwarf_apple_types("__apple_types");
static ConstString g_sect_name_dwarf_apple_namespaces("__apple_namespac");
@@ -1637,62 +1609,10 @@ static lldb::SectionType GetSectionType(uint32_t flags,
static ConstString g_sect_name_lldb_formatters("__lldbformatters");
static ConstString g_sect_name_swift_ast("__swift_ast");
if (section_name == g_sect_name_dwarf_debug_abbrev)
return eSectionTypeDWARFDebugAbbrev;
if (section_name == g_sect_name_dwarf_debug_abbrev_dwo)
return eSectionTypeDWARFDebugAbbrevDwo;
if (section_name == g_sect_name_dwarf_debug_addr)
return eSectionTypeDWARFDebugAddr;
if (section_name == g_sect_name_dwarf_debug_aranges)
return eSectionTypeDWARFDebugAranges;
if (section_name == g_sect_name_dwarf_debug_cu_index)
return eSectionTypeDWARFDebugCuIndex;
if (section_name == g_sect_name_dwarf_debug_frame)
return eSectionTypeDWARFDebugFrame;
if (section_name == g_sect_name_dwarf_debug_info)
return eSectionTypeDWARFDebugInfo;
if (section_name == g_sect_name_dwarf_debug_info_dwo)
return eSectionTypeDWARFDebugInfoDwo;
if (section_name == g_sect_name_dwarf_debug_line)
return eSectionTypeDWARFDebugLine;
if (section_name == g_sect_name_dwarf_debug_line_dwo)
return eSectionTypeDWARFDebugLine; // Same as debug_line.
if (section_name == g_sect_name_dwarf_debug_line_str)
return eSectionTypeDWARFDebugLineStr;
if (section_name == g_sect_name_dwarf_debug_loc)
return eSectionTypeDWARFDebugLoc;
if (section_name == g_sect_name_dwarf_debug_loclists)
return eSectionTypeDWARFDebugLocLists;
if (section_name == g_sect_name_dwarf_debug_loclists_dwo)
return eSectionTypeDWARFDebugLocListsDwo;
if (section_name == g_sect_name_dwarf_debug_macinfo)
return eSectionTypeDWARFDebugMacInfo;
if (section_name == g_sect_name_dwarf_debug_macro)
return eSectionTypeDWARFDebugMacro;
if (section_name == g_sect_name_dwarf_debug_macro_dwo)
return eSectionTypeDWARFDebugMacInfo; // Same as debug_macro.
if (section_name == g_sect_name_dwarf_debug_names)
return eSectionTypeDWARFDebugNames;
if (section_name == g_sect_name_dwarf_debug_pubnames)
return eSectionTypeDWARFDebugPubNames;
if (section_name == g_sect_name_dwarf_debug_pubtypes)
return eSectionTypeDWARFDebugPubTypes;
if (section_name == g_sect_name_dwarf_debug_ranges)
return eSectionTypeDWARFDebugRanges;
if (section_name == g_sect_name_dwarf_debug_rnglists)
return eSectionTypeDWARFDebugRngLists;
if (section_name == g_sect_name_dwarf_debug_str)
return eSectionTypeDWARFDebugStr;
if (section_name == g_sect_name_dwarf_debug_str_dwo)
return eSectionTypeDWARFDebugStrDwo;
if (section_name == g_sect_name_dwarf_debug_str_offs)
return eSectionTypeDWARFDebugStrOffsets;
if (section_name == g_sect_name_dwarf_debug_str_offs_dwo)
return eSectionTypeDWARFDebugStrOffsetsDwo;
if (section_name == g_sect_name_dwarf_debug_tu_index)
return eSectionTypeDWARFDebugTuIndex;
if (section_name == g_sect_name_dwarf_debug_types)
return eSectionTypeDWARFDebugTypes;
llvm::StringRef stripped_name = section_name.GetStringRef();
if (stripped_name.consume_front("__debug_"))
return ObjectFile::GetDWARFSectionTypeFromName(stripped_name);
if (section_name == g_sect_name_dwarf_apple_names)
return eSectionTypeDWARFAppleNames;
if (section_name == g_sect_name_dwarf_apple_types)

View File

@@ -976,25 +976,14 @@ SectionType ObjectFilePECOFF::GetSectionType(llvm::StringRef sect_name,
return eSectionTypeData;
}
if (sect_name.consume_front(".debug_"))
return GetDWARFSectionTypeFromName(sect_name);
SectionType section_type =
llvm::StringSwitch<SectionType>(sect_name)
.Case(".debug", eSectionTypeDebug)
.Case(".stabstr", eSectionTypeDataCString)
.Case(".reloc", eSectionTypeOther)
.Case(".debug_abbrev", eSectionTypeDWARFDebugAbbrev)
.Case(".debug_aranges", eSectionTypeDWARFDebugAranges)
.Case(".debug_frame", eSectionTypeDWARFDebugFrame)
.Case(".debug_info", eSectionTypeDWARFDebugInfo)
.Case(".debug_line", eSectionTypeDWARFDebugLine)
.Case(".debug_loc", eSectionTypeDWARFDebugLoc)
.Case(".debug_loclists", eSectionTypeDWARFDebugLocLists)
.Case(".debug_macinfo", eSectionTypeDWARFDebugMacInfo)
.Case(".debug_names", eSectionTypeDWARFDebugNames)
.Case(".debug_pubnames", eSectionTypeDWARFDebugPubNames)
.Case(".debug_pubtypes", eSectionTypeDWARFDebugPubTypes)
.Case(".debug_ranges", eSectionTypeDWARFDebugRanges)
.Case(".debug_str", eSectionTypeDWARFDebugStr)
.Case(".debug_types", eSectionTypeDWARFDebugTypes)
// .eh_frame can be truncated to 8 chars.
.Cases(".eh_frame", ".eh_fram", eSectionTypeEHFrame)
.Case(".gosymtab", eSectionTypeGoSymtab)

View File

@@ -252,37 +252,7 @@ void ObjectFileWasm::ParseSymtab(Symtab &symtab) {}
static SectionType GetSectionTypeFromName(llvm::StringRef Name) {
if (Name.consume_front(".debug_") || Name.consume_front(".zdebug_")) {
return llvm::StringSwitch<SectionType>(Name)
.Case("abbrev", eSectionTypeDWARFDebugAbbrev)
.Case("abbrev.dwo", eSectionTypeDWARFDebugAbbrevDwo)
.Case("addr", eSectionTypeDWARFDebugAddr)
.Case("aranges", eSectionTypeDWARFDebugAranges)
.Case("cu_index", eSectionTypeDWARFDebugCuIndex)
.Case("frame", eSectionTypeDWARFDebugFrame)
.Case("info", eSectionTypeDWARFDebugInfo)
.Case("info.dwo", eSectionTypeDWARFDebugInfoDwo)
.Cases("line", "line.dwo", eSectionTypeDWARFDebugLine)
.Cases("line_str", "line_str.dwo", eSectionTypeDWARFDebugLineStr)
.Case("loc", eSectionTypeDWARFDebugLoc)
.Case("loc.dwo", eSectionTypeDWARFDebugLocDwo)
.Case("loclists", eSectionTypeDWARFDebugLocLists)
.Case("loclists.dwo", eSectionTypeDWARFDebugLocListsDwo)
.Case("macinfo", eSectionTypeDWARFDebugMacInfo)
.Cases("macro", "macro.dwo", eSectionTypeDWARFDebugMacro)
.Case("names", eSectionTypeDWARFDebugNames)
.Case("pubnames", eSectionTypeDWARFDebugPubNames)
.Case("pubtypes", eSectionTypeDWARFDebugPubTypes)
.Case("ranges", eSectionTypeDWARFDebugRanges)
.Case("rnglists", eSectionTypeDWARFDebugRngLists)
.Case("rnglists.dwo", eSectionTypeDWARFDebugRngListsDwo)
.Case("str", eSectionTypeDWARFDebugStr)
.Case("str.dwo", eSectionTypeDWARFDebugStrDwo)
.Case("str_offsets", eSectionTypeDWARFDebugStrOffsets)
.Case("str_offsets.dwo", eSectionTypeDWARFDebugStrOffsetsDwo)
.Case("tu_index", eSectionTypeDWARFDebugTuIndex)
.Case("types", eSectionTypeDWARFDebugTypes)
.Case("types.dwo", eSectionTypeDWARFDebugTypesDwo)
.Default(eSectionTypeOther);
return ObjectFile::GetDWARFSectionTypeFromName(Name);
}
return eSectionTypeOther;
}

View File

@@ -635,6 +635,41 @@ ObjectFile::GetSymbolTypeFromName(llvm::StringRef name,
return symbol_type_hint;
}
lldb::SectionType
ObjectFile::GetDWARFSectionTypeFromName(llvm::StringRef name) {
return llvm::StringSwitch<SectionType>(name)
.Case("abbrev", eSectionTypeDWARFDebugAbbrev)
.Case("abbrev.dwo", eSectionTypeDWARFDebugAbbrevDwo)
.Case("addr", eSectionTypeDWARFDebugAddr)
.Case("aranges", eSectionTypeDWARFDebugAranges)
.Case("cu_index", eSectionTypeDWARFDebugCuIndex)
.Case("frame", eSectionTypeDWARFDebugFrame)
.Case("info", eSectionTypeDWARFDebugInfo)
.Case("info.dwo", eSectionTypeDWARFDebugInfoDwo)
.Cases("line", "line.dwo", eSectionTypeDWARFDebugLine)
.Cases("line_str", "line_str.dwo", eSectionTypeDWARFDebugLineStr)
.Case("loc", eSectionTypeDWARFDebugLoc)
.Case("loc.dwo", eSectionTypeDWARFDebugLocDwo)
.Case("loclists", eSectionTypeDWARFDebugLocLists)
.Case("loclists.dwo", eSectionTypeDWARFDebugLocListsDwo)
.Case("macinfo", eSectionTypeDWARFDebugMacInfo)
.Cases("macro", "macro.dwo", eSectionTypeDWARFDebugMacro)
.Case("names", eSectionTypeDWARFDebugNames)
.Case("pubnames", eSectionTypeDWARFDebugPubNames)
.Case("pubtypes", eSectionTypeDWARFDebugPubTypes)
.Case("ranges", eSectionTypeDWARFDebugRanges)
.Case("rnglists", eSectionTypeDWARFDebugRngLists)
.Case("rnglists.dwo", eSectionTypeDWARFDebugRngListsDwo)
.Case("str", eSectionTypeDWARFDebugStr)
.Case("str.dwo", eSectionTypeDWARFDebugStrDwo)
.Case("str_offsets", eSectionTypeDWARFDebugStrOffsets)
.Case("str_offsets.dwo", eSectionTypeDWARFDebugStrOffsetsDwo)
.Case("tu_index", eSectionTypeDWARFDebugTuIndex)
.Case("types", eSectionTypeDWARFDebugTypes)
.Case("types.dwo", eSectionTypeDWARFDebugTypesDwo)
.Default(eSectionTypeOther);
}
std::vector<ObjectFile::LoadableData>
ObjectFile::GetLoadableData(Target &target) {
std::vector<LoadableData> loadables;

View File

@@ -0,0 +1,151 @@
# Test that LLDB can read executables with DWARF sections generated by Clang
# RUN: yaml2obj %s -o %t
# RUN: lldb-test object-file %t | FileCheck %s
# CHECK: Name: .debug_abbrev
# CHECK-NEXT: Type: dwarf-abbrev
# CHECK: Name: .debug_addr
# CHECK-NEXT: Type: dwarf-addr
# CHECK: Name: .debug_aranges
# CHECK-NEXT: Type: dwarf-aranges
# CHECK: Name: .debug_info
# CHECK-NEXT: Type: dwarf-info
# CHECK: Name: .debug_line
# CHECK-NEXT: Type: dwarf-line
# CHECK: Name: .debug_line_str
# CHECK-NEXT: Type: dwarf-line-str
# CHECK: Name: .debug_rnglists
# CHECK-NEXT: Type: dwarf-rnglists
# CHECK: Name: .debug_str
# CHECK-NEXT: Type: dwarf-str
# CHECK: Name: .debug_str_offsets
# CHECK-NEXT: Type: dwarf-str-offsets
--- !COFF
OptionalHeader:
AddressOfEntryPoint: 4956
ImageBase: 5368709120
SectionAlignment: 4096
FileAlignment: 512
MajorOperatingSystemVersion: 6
MinorOperatingSystemVersion: 0
MajorImageVersion: 0
MinorImageVersion: 0
MajorSubsystemVersion: 6
MinorSubsystemVersion: 0
Subsystem: IMAGE_SUBSYSTEM_WINDOWS_CUI
DLLCharacteristics: [ IMAGE_DLL_CHARACTERISTICS_HIGH_ENTROPY_VA, IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE, IMAGE_DLL_CHARACTERISTICS_NX_COMPAT, IMAGE_DLL_CHARACTERISTICS_TERMINAL_SERVER_AWARE ]
SizeOfStackReserve: 1048576
SizeOfStackCommit: 4096
SizeOfHeapReserve: 1048576
SizeOfHeapCommit: 4096
header:
Machine: IMAGE_FILE_MACHINE_AMD64
Characteristics: [ IMAGE_FILE_EXECUTABLE_IMAGE, IMAGE_FILE_LARGE_ADDRESS_AWARE ]
sections:
- Name: .text
Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
VirtualAddress: 4096
VirtualSize: 64
SectionData: DEADBEEFBAADF00D
- Name: .rdata
Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ]
VirtualAddress: 401408
VirtualSize: 64
SectionData: DEADBEEFBAADF00D
- Name: .data
Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE ]
VirtualAddress: 479232
VirtualSize: 64
SectionData: DEADBEEFBAADF00D
- Name: .pdata
Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ]
VirtualAddress: 491520
VirtualSize: 64
SectionData: DEADBEEFBAADF00D
- Name: .fptable
Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE ]
VirtualAddress: 512000
VirtualSize: 64
SectionData: DEADBEEFBAADF00D
- Name: _RDATA
Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ]
VirtualAddress: 516096
VirtualSize: 64
SectionData: DEADBEEFBAADF00D
- Name: _guard_c
Characteristics: [ ]
VirtualAddress: 520192
VirtualSize: 64
SectionData: DEADBEEFBAADF00D
- Name: _guard_d
Characteristics: [ ]
VirtualAddress: 524288
VirtualSize: 64
SectionData: DEADBEEFBAADF00D
- Name: memcpy_
Characteristics: [ ]
VirtualAddress: 528384
VirtualSize: 64
SectionData: DEADBEEFBAADF00D
- Name: .reloc
Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
VirtualAddress: 532480
VirtualSize: 64
SectionData: DEADBEEFBAADF00D
- Name: .debug_abbrev
Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
VirtualAddress: 536576
VirtualSize: 64
SectionData: DEADBEEFBAADF00D
- Name: .debug_addr
Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
VirtualAddress: 540672
VirtualSize: 64
SectionData: DEADBEEFBAADF00D
- Name: .debug_aranges
Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
VirtualAddress: 544768
VirtualSize: 64
SectionData: DEADBEEFBAADF00D
- Name: .debug_info
Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
VirtualAddress: 548864
VirtualSize: 64
SectionData: DEADBEEFBAADF00D
- Name: .debug_line
Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
VirtualAddress: 552960
VirtualSize: 64
SectionData: DEADBEEFBAADF00D
- Name: .debug_line_str
Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
VirtualAddress: 557056
VirtualSize: 64
SectionData: DEADBEEFBAADF00D
- Name: .debug_rnglists
Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
VirtualAddress: 561152
VirtualSize: 64
SectionData: DEADBEEFBAADF00D
- Name: .debug_str
Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
VirtualAddress: 565248
VirtualSize: 64
SectionData: DEADBEEFBAADF00D
- Name: .debug_str_offsets
Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
VirtualAddress: 569344
VirtualSize: 64
SectionData: DEADBEEFBAADF00D
symbols: []
...

View File

@@ -0,0 +1,151 @@
# Test that LLDB can read executables with DWARF sections generated by GCC on MinGW
# RUN: yaml2obj %s -o %t
# RUN: lldb-test object-file %t | FileCheck %s
# CHECK: Name: .debug_aranges
# CHECK-NEXT: Type: dwarf-aranges
# CHECK: Name: .debug_info
# CHECK-NEXT: Type: dwarf-info
# CHECK: Name: .debug_abbrev
# CHECK-NEXT: Type: dwarf-abbrev
# CHECK: Name: .debug_line
# CHECK-NEXT: Type: dwarf-line
# CHECK: Name: .debug_frame
# CHECK-NEXT: Type: dwarf-frame
# CHECK: Name: .debug_str
# CHECK-NEXT: Type: dwarf-str
# CHECK: Name: .debug_line_str
# CHECK-NEXT: Type: dwarf-line-str
# CHECK: Name: .debug_loclists
# CHECK-NEXT: Type: dwarf-loclists
# CHECK: Name: .debug_rnglists
# CHECK-NEXT: Type: dwarf-rnglists
--- !COFF
OptionalHeader:
AddressOfEntryPoint: 5136
ImageBase: 5368709120
SectionAlignment: 4096
FileAlignment: 512
MajorOperatingSystemVersion: 4
MinorOperatingSystemVersion: 0
MajorImageVersion: 0
MinorImageVersion: 0
MajorSubsystemVersion: 5
MinorSubsystemVersion: 2
Subsystem: IMAGE_SUBSYSTEM_WINDOWS_CUI
DLLCharacteristics: [ IMAGE_DLL_CHARACTERISTICS_HIGH_ENTROPY_VA, IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE, IMAGE_DLL_CHARACTERISTICS_NX_COMPAT ]
SizeOfStackReserve: 2097152
SizeOfStackCommit: 4096
SizeOfHeapReserve: 1048576
SizeOfHeapCommit: 4096
header:
Machine: IMAGE_FILE_MACHINE_AMD64
Characteristics: [ IMAGE_FILE_EXECUTABLE_IMAGE, IMAGE_FILE_LINE_NUMS_STRIPPED, IMAGE_FILE_LARGE_ADDRESS_AWARE ]
sections:
- Name: .text
Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
VirtualAddress: 4096
VirtualSize: 64
SectionData: DEADBEEFBAADF00D
- Name: .data
Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE ]
VirtualAddress: 12288
VirtualSize: 64
SectionData: DEADBEEFBAADF00D
- Name: .rdata
Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ]
VirtualAddress: 16384
VirtualSize: 64
SectionData: DEADBEEFBAADF00D
- Name: .pdata
Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ]
VirtualAddress: 20480
VirtualSize: 64
SectionData: DEADBEEFBAADF00D
- Name: .xdata
Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ]
VirtualAddress: 24576
VirtualSize: 64
SectionData: DEADBEEFBAADF00D
- Name: .bss
Characteristics: [ IMAGE_SCN_CNT_UNINITIALIZED_DATA, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE ]
VirtualAddress: 28672
VirtualSize: 384
SectionData: ''
- Name: .idata
Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ]
VirtualAddress: 32768
VirtualSize: 64
SectionData: DEADBEEFBAADF00D
- Name: .tls
Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE ]
VirtualAddress: 36864
VirtualSize: 64
SectionData: DEADBEEFBAADF00D
- Name: .rsrc
Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ]
VirtualAddress: 40960
VirtualSize: 64
SectionData: DEADBEEFBAADF00D
- Name: .reloc
Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
VirtualAddress: 45056
VirtualSize: 64
SectionData: DEADBEEFBAADF00D
- Name: .debug_aranges
Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
VirtualAddress: 49152
VirtualSize: 64
SectionData: DEADBEEFBAADF00D
- Name: .debug_info
Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
VirtualAddress: 53248
VirtualSize: 64
SectionData: DEADBEEFBAADF00D
- Name: .debug_abbrev
Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
VirtualAddress: 98304
VirtualSize: 64
SectionData: DEADBEEFBAADF00D
- Name: .debug_line
Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
VirtualAddress: 106496
VirtualSize: 64
SectionData: DEADBEEFBAADF00D
- Name: .debug_frame
Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
VirtualAddress: 114688
VirtualSize: 64
SectionData: DEADBEEFBAADF00D
- Name: .debug_str
Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
VirtualAddress: 118784
VirtualSize: 64
SectionData: DEADBEEFBAADF00D
- Name: .debug_line_str
Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
VirtualAddress: 122880
VirtualSize: 64
SectionData: DEADBEEFBAADF00D
- Name: .debug_loclists
Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
VirtualAddress: 131072
VirtualSize: 64
SectionData: DEADBEEFBAADF00D
- Name: .debug_rnglists
Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
VirtualAddress: 139264
VirtualSize: 64
SectionData: DEADBEEFBAADF00D
symbols: []
...