Add support for __debug_line_str in Mach-O

This patch resolves an issue that currently accounts for the vast
majority of failures on the matrix bot.

Differential Revision: https://reviews.llvm.org/D152872
This commit is contained in:
Adrian Prantl 2023-06-13 17:31:32 -07:00
parent 43b2df03e8
commit 27fac4a72a
2 changed files with 18 additions and 0 deletions

View File

@ -1443,6 +1443,7 @@ static lldb::SectionType GetSectionType(uint32_t flags,
static ConstString g_sect_name_dwarf_debug_frame("__debug_frame"); 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("__debug_info");
static ConstString g_sect_name_dwarf_debug_line("__debug_line"); static ConstString g_sect_name_dwarf_debug_line("__debug_line");
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_loc("__debug_loc");
static ConstString g_sect_name_dwarf_debug_loclists("__debug_loclists"); static ConstString g_sect_name_dwarf_debug_loclists("__debug_loclists");
static ConstString g_sect_name_dwarf_debug_macinfo("__debug_macinfo"); static ConstString g_sect_name_dwarf_debug_macinfo("__debug_macinfo");
@ -1472,6 +1473,8 @@ static lldb::SectionType GetSectionType(uint32_t flags,
return eSectionTypeDWARFDebugInfo; return eSectionTypeDWARFDebugInfo;
if (section_name == g_sect_name_dwarf_debug_line) if (section_name == g_sect_name_dwarf_debug_line)
return eSectionTypeDWARFDebugLine; return eSectionTypeDWARFDebugLine;
if (section_name == g_sect_name_dwarf_debug_line_str)
return eSectionTypeDWARFDebugLineStr;
if (section_name == g_sect_name_dwarf_debug_loc) if (section_name == g_sect_name_dwarf_debug_loc)
return eSectionTypeDWARFDebugLoc; return eSectionTypeDWARFDebugLoc;
if (section_name == g_sect_name_dwarf_debug_loclists) if (section_name == g_sect_name_dwarf_debug_loclists)

View File

@ -0,0 +1,15 @@
// Test that the file names in the __debug_line_str section can be decoded.
// REQUIRES: system-darwin
// RUN: %clang -target x86_64-apple-darwin %s -c -o %t.o -gdwarf-5
// RUN: llvm-readobj --sections %t.o | FileCheck %s --check-prefix NAMES
// RUN: xcrun %clang -target x86_64-apple-darwin -o %t.exe %t.o
// RUN: %lldb %t.exe -b -o "target modules dump line-table %s" | FileCheck %s
// NAMES: Name: __debug_line_str
int main(int argc, char **argv) {
// CHECK: dwarf5-macho.c:[[@LINE+1]]
return 0;
}