Skip to content

Commit 1704c8d

Browse files
[lldb][MachO] Fix section type recognition for new DWARF 5 sections
When LLDB needs to access a debug section, it generally calls SectionList::FindSectionByType with the corresponding type (we have one type for each DWARF section). However, the missing entries made some sections be classified as "eSectionTypeOther", which makes all calls to `FindSectionByType` fail. With this patch, a check-lldb build with `-DLLDB_TEST_USER_ARGS=--dwarf-version=5` reports a much lower number of failures: Unsupported : 327 Passed : 2423 Expectedly Failed: 16 Unresolved : 2 Failed : 52 This is down from previously 400~ failures. Differential Revision: https://reviews.llvm.org/D153433
1 parent 54db162 commit 1704c8d

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1439,19 +1439,32 @@ static lldb::SectionType GetSectionType(uint32_t flags,
14391439
static ConstString g_sect_name_cfstring("__cfstring");
14401440

14411441
static ConstString g_sect_name_dwarf_debug_abbrev("__debug_abbrev");
1442+
static ConstString g_sect_name_dwarf_debug_abbrev_dwo("__debug_abbrev.dwo");
1443+
static ConstString g_sect_name_dwarf_debug_addr("__debug_addr");
14421444
static ConstString g_sect_name_dwarf_debug_aranges("__debug_aranges");
1445+
static ConstString g_sect_name_dwarf_debug_cu_index("__debug_cu_index");
14431446
static ConstString g_sect_name_dwarf_debug_frame("__debug_frame");
14441447
static ConstString g_sect_name_dwarf_debug_info("__debug_info");
1448+
static ConstString g_sect_name_dwarf_debug_info_dwo("__debug_info.dwo");
14451449
static ConstString g_sect_name_dwarf_debug_line("__debug_line");
1450+
static ConstString g_sect_name_dwarf_debug_line_dwo("__debug_line.dwo");
14461451
static ConstString g_sect_name_dwarf_debug_line_str("__debug_line_str");
14471452
static ConstString g_sect_name_dwarf_debug_loc("__debug_loc");
14481453
static ConstString g_sect_name_dwarf_debug_loclists("__debug_loclists");
1454+
static ConstString g_sect_name_dwarf_debug_loclists_dwo("__debug_loclists.dwo");
14491455
static ConstString g_sect_name_dwarf_debug_macinfo("__debug_macinfo");
1456+
static ConstString g_sect_name_dwarf_debug_macro("__debug_macro");
1457+
static ConstString g_sect_name_dwarf_debug_macro_dwo("__debug_macro.dwo");
14501458
static ConstString g_sect_name_dwarf_debug_names("__debug_names");
14511459
static ConstString g_sect_name_dwarf_debug_pubnames("__debug_pubnames");
14521460
static ConstString g_sect_name_dwarf_debug_pubtypes("__debug_pubtypes");
14531461
static ConstString g_sect_name_dwarf_debug_ranges("__debug_ranges");
1462+
static ConstString g_sect_name_dwarf_debug_rnglists("__debug_rnglists");
14541463
static ConstString g_sect_name_dwarf_debug_str("__debug_str");
1464+
static ConstString g_sect_name_dwarf_debug_str_dwo("__debug_str.dwo");
1465+
static ConstString g_sect_name_dwarf_debug_str_offs("__debug_str_offs");
1466+
static ConstString g_sect_name_dwarf_debug_str_offs_dwo("__debug_str_offs.dwo");
1467+
static ConstString g_sect_name_dwarf_debug_tu_index("__debug_tu_index");
14551468
static ConstString g_sect_name_dwarf_debug_types("__debug_types");
14561469
static ConstString g_sect_name_dwarf_apple_names("__apple_names");
14571470
static ConstString g_sect_name_dwarf_apple_types("__apple_types");
@@ -1465,22 +1478,38 @@ static lldb::SectionType GetSectionType(uint32_t flags,
14651478

14661479
if (section_name == g_sect_name_dwarf_debug_abbrev)
14671480
return eSectionTypeDWARFDebugAbbrev;
1481+
if (section_name == g_sect_name_dwarf_debug_abbrev_dwo)
1482+
return eSectionTypeDWARFDebugAbbrevDwo;
1483+
if (section_name == g_sect_name_dwarf_debug_addr)
1484+
return eSectionTypeDWARFDebugAddr;
14681485
if (section_name == g_sect_name_dwarf_debug_aranges)
14691486
return eSectionTypeDWARFDebugAranges;
1487+
if (section_name == g_sect_name_dwarf_debug_cu_index)
1488+
return eSectionTypeDWARFDebugCuIndex;
14701489
if (section_name == g_sect_name_dwarf_debug_frame)
14711490
return eSectionTypeDWARFDebugFrame;
14721491
if (section_name == g_sect_name_dwarf_debug_info)
14731492
return eSectionTypeDWARFDebugInfo;
1493+
if (section_name == g_sect_name_dwarf_debug_info_dwo)
1494+
return eSectionTypeDWARFDebugInfoDwo;
14741495
if (section_name == g_sect_name_dwarf_debug_line)
14751496
return eSectionTypeDWARFDebugLine;
1497+
if (section_name == g_sect_name_dwarf_debug_line_dwo)
1498+
return eSectionTypeDWARFDebugLine; // Same as debug_line.
14761499
if (section_name == g_sect_name_dwarf_debug_line_str)
14771500
return eSectionTypeDWARFDebugLineStr;
14781501
if (section_name == g_sect_name_dwarf_debug_loc)
14791502
return eSectionTypeDWARFDebugLoc;
14801503
if (section_name == g_sect_name_dwarf_debug_loclists)
14811504
return eSectionTypeDWARFDebugLocLists;
1505+
if (section_name == g_sect_name_dwarf_debug_loclists_dwo)
1506+
return eSectionTypeDWARFDebugLocListsDwo;
14821507
if (section_name == g_sect_name_dwarf_debug_macinfo)
14831508
return eSectionTypeDWARFDebugMacInfo;
1509+
if (section_name == g_sect_name_dwarf_debug_macro)
1510+
return eSectionTypeDWARFDebugMacro;
1511+
if (section_name == g_sect_name_dwarf_debug_macro_dwo)
1512+
return eSectionTypeDWARFDebugMacInfo; // Same as debug_macro.
14841513
if (section_name == g_sect_name_dwarf_debug_names)
14851514
return eSectionTypeDWARFDebugNames;
14861515
if (section_name == g_sect_name_dwarf_debug_pubnames)
@@ -1489,8 +1518,18 @@ static lldb::SectionType GetSectionType(uint32_t flags,
14891518
return eSectionTypeDWARFDebugPubTypes;
14901519
if (section_name == g_sect_name_dwarf_debug_ranges)
14911520
return eSectionTypeDWARFDebugRanges;
1521+
if (section_name == g_sect_name_dwarf_debug_rnglists)
1522+
return eSectionTypeDWARFDebugRngLists;
14921523
if (section_name == g_sect_name_dwarf_debug_str)
14931524
return eSectionTypeDWARFDebugStr;
1525+
if (section_name == g_sect_name_dwarf_debug_str_dwo)
1526+
return eSectionTypeDWARFDebugStrDwo;
1527+
if (section_name == g_sect_name_dwarf_debug_str_offs)
1528+
return eSectionTypeDWARFDebugStrOffsets;
1529+
if (section_name == g_sect_name_dwarf_debug_str_offs_dwo)
1530+
return eSectionTypeDWARFDebugStrOffsetsDwo;
1531+
if (section_name == g_sect_name_dwarf_debug_tu_index)
1532+
return eSectionTypeDWARFDebugTuIndex;
14941533
if (section_name == g_sect_name_dwarf_debug_types)
14951534
return eSectionTypeDWARFDebugTypes;
14961535
if (section_name == g_sect_name_dwarf_apple_names)

0 commit comments

Comments
 (0)