Index: source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp =================================================================== --- source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp +++ source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp @@ -1819,6 +1819,32 @@ static ConstString g_sect_name_dwarf_debug_str_dwo(".debug_str.dwo"); static ConstString g_sect_name_dwarf_debug_str_offsets_dwo( ".debug_str_offsets.dwo"); + static ConstString g_sect_name_dwarf_zdebug_abbrev(".zdebug_abbrev"); + static ConstString g_sect_name_dwarf_zdebug_addr(".zdebug_addr"); + static ConstString g_sect_name_dwarf_zdebug_aranges(".zdebug_aranges"); + static ConstString g_sect_name_dwarf_zdebug_cu_index(".zdebug_cu_index"); + static ConstString g_sect_name_dwarf_zdebug_frame(".zdebug_frame"); + static ConstString g_sect_name_dwarf_zdebug_info(".zdebug_info"); + static ConstString g_sect_name_dwarf_zdebug_line(".zdebug_line"); + static ConstString g_sect_name_dwarf_zdebug_loc(".zdebug_loc"); + static ConstString g_sect_name_dwarf_zdebug_macinfo(".zdebug_macinfo"); + static ConstString g_sect_name_dwarf_zdebug_macro(".zdebug_macro"); + static ConstString g_sect_name_dwarf_zdebug_pubnames(".zdebug_pubnames"); + static ConstString g_sect_name_dwarf_zdebug_pubtypes(".zdebug_pubtypes"); + static ConstString g_sect_name_dwarf_zdebug_ranges(".zdebug_ranges"); + static ConstString g_sect_name_dwarf_zdebug_str(".zdebug_str"); + static ConstString g_sect_name_dwarf_zdebug_str_offsets( + ".zdebug_str_offsets"); + static ConstString g_sect_name_dwarf_zdebug_abbrev_dwo( + ".zdebug_abbrev.dwo"); + static ConstString g_sect_name_dwarf_zdebug_info_dwo(".zdebug_info.dwo"); + static ConstString g_sect_name_dwarf_zdebug_line_dwo(".zdebug_line.dwo"); + static ConstString g_sect_name_dwarf_zdebug_macro_dwo( + ".zdebug_macro.dwo"); + static ConstString g_sect_name_dwarf_zdebug_loc_dwo(".zdebug_loc.dwo"); + static ConstString g_sect_name_dwarf_zdebug_str_dwo(".zdebug_str.dwo"); + static ConstString g_sect_name_dwarf_zdebug_str_offsets_dwo( + ".zdebug_str_offsets.dwo"); static ConstString g_sect_name_eh_frame(".eh_frame"); static ConstString g_sect_name_arm_exidx(".ARM.exidx"); static ConstString g_sect_name_arm_extab(".ARM.extab"); @@ -1861,49 +1887,71 @@ // http://src.chromium.org/viewvc/chrome/trunk/src/build/gdb-add-index?pathrev=144644 // MISSING? .debug_types - Type descriptions from DWARF 4? See // http://gcc.gnu.org/wiki/DwarfSeparateTypeInfo - else if (name == g_sect_name_dwarf_debug_abbrev) + else if (name == g_sect_name_dwarf_debug_abbrev || + name == g_sect_name_dwarf_zdebug_abbrev) sect_type = eSectionTypeDWARFDebugAbbrev; - else if (name == g_sect_name_dwarf_debug_addr) + else if (name == g_sect_name_dwarf_debug_addr || + name == g_sect_name_dwarf_zdebug_addr) sect_type = eSectionTypeDWARFDebugAddr; - else if (name == g_sect_name_dwarf_debug_aranges) + else if (name == g_sect_name_dwarf_debug_aranges || + name == g_sect_name_dwarf_zdebug_aranges) sect_type = eSectionTypeDWARFDebugAranges; - else if (name == g_sect_name_dwarf_debug_cu_index) + else if (name == g_sect_name_dwarf_debug_cu_index || + name == g_sect_name_dwarf_zdebug_cu_index) sect_type = eSectionTypeDWARFDebugCuIndex; - else if (name == g_sect_name_dwarf_debug_frame) + else if (name == g_sect_name_dwarf_debug_frame || + name == g_sect_name_dwarf_zdebug_frame) sect_type = eSectionTypeDWARFDebugFrame; - else if (name == g_sect_name_dwarf_debug_info) + else if (name == g_sect_name_dwarf_debug_info || + name == g_sect_name_dwarf_zdebug_info) sect_type = eSectionTypeDWARFDebugInfo; - else if (name == g_sect_name_dwarf_debug_line) + else if (name == g_sect_name_dwarf_debug_line || + name == g_sect_name_dwarf_zdebug_line) sect_type = eSectionTypeDWARFDebugLine; - else if (name == g_sect_name_dwarf_debug_loc) + else if (name == g_sect_name_dwarf_debug_loc || + name == g_sect_name_dwarf_zdebug_loc) sect_type = eSectionTypeDWARFDebugLoc; - else if (name == g_sect_name_dwarf_debug_macinfo) + else if (name == g_sect_name_dwarf_debug_macinfo || + name == g_sect_name_dwarf_zdebug_macinfo) sect_type = eSectionTypeDWARFDebugMacInfo; - else if (name == g_sect_name_dwarf_debug_macro) + else if (name == g_sect_name_dwarf_debug_macro || + name == g_sect_name_dwarf_zdebug_macro) sect_type = eSectionTypeDWARFDebugMacro; - else if (name == g_sect_name_dwarf_debug_pubnames) + else if (name == g_sect_name_dwarf_debug_pubnames || + name == g_sect_name_dwarf_zdebug_pubnames) sect_type = eSectionTypeDWARFDebugPubNames; - else if (name == g_sect_name_dwarf_debug_pubtypes) + else if (name == g_sect_name_dwarf_debug_pubtypes || + name == g_sect_name_dwarf_zdebug_pubtypes) sect_type = eSectionTypeDWARFDebugPubTypes; - else if (name == g_sect_name_dwarf_debug_ranges) + else if (name == g_sect_name_dwarf_debug_ranges || + name == g_sect_name_dwarf_zdebug_ranges) sect_type = eSectionTypeDWARFDebugRanges; - else if (name == g_sect_name_dwarf_debug_str) + else if (name == g_sect_name_dwarf_debug_str || + name == g_sect_name_dwarf_zdebug_str) sect_type = eSectionTypeDWARFDebugStr; - else if (name == g_sect_name_dwarf_debug_str_offsets) + else if (name == g_sect_name_dwarf_debug_str_offsets || + name == g_sect_name_dwarf_zdebug_str_offsets) sect_type = eSectionTypeDWARFDebugStrOffsets; - else if (name == g_sect_name_dwarf_debug_abbrev_dwo) + else if (name == g_sect_name_dwarf_debug_abbrev_dwo || + name == g_sect_name_dwarf_zdebug_abbrev_dwo) sect_type = eSectionTypeDWARFDebugAbbrev; - else if (name == g_sect_name_dwarf_debug_info_dwo) + else if (name == g_sect_name_dwarf_debug_info_dwo || + name == g_sect_name_dwarf_zdebug_info_dwo) sect_type = eSectionTypeDWARFDebugInfo; - else if (name == g_sect_name_dwarf_debug_line_dwo) + else if (name == g_sect_name_dwarf_debug_line_dwo || + name == g_sect_name_dwarf_zdebug_line_dwo) sect_type = eSectionTypeDWARFDebugLine; - else if (name == g_sect_name_dwarf_debug_macro_dwo) + else if (name == g_sect_name_dwarf_debug_macro_dwo || + name == g_sect_name_dwarf_zdebug_macro_dwo) sect_type = eSectionTypeDWARFDebugMacro; - else if (name == g_sect_name_dwarf_debug_loc_dwo) + else if (name == g_sect_name_dwarf_debug_loc_dwo || + name == g_sect_name_dwarf_zdebug_loc_dwo) sect_type = eSectionTypeDWARFDebugLoc; - else if (name == g_sect_name_dwarf_debug_str_dwo) + else if (name == g_sect_name_dwarf_debug_str_dwo || + name == g_sect_name_dwarf_zdebug_str_dwo) sect_type = eSectionTypeDWARFDebugStr; - else if (name == g_sect_name_dwarf_debug_str_offsets_dwo) + else if (name == g_sect_name_dwarf_debug_str_offsets_dwo || + name == g_sect_name_dwarf_zdebug_str_offsets_dwo) sect_type = eSectionTypeDWARFDebugStrOffsets; else if (name == g_sect_name_eh_frame) sect_type = eSectionTypeEHFrame; @@ -2062,11 +2110,18 @@ SectionList *module_section_list = module_sp ? module_sp->GetSectionList() : nullptr; + // GOOGLE3: never use hash or hash. +#if 0 + // Local cache to avoid doing a FindSectionByName for each symbol. The "const // char*" key must // came from a ConstString object so they can be compared by pointer std::unordered_map section_name_to_section; +#else + std::unordered_map section_name_to_section; +#endif + unsigned i; for (i = 0; i < num_symbols; ++i) { if (symbol.Parse(symtab_data, &offset) == false) @@ -2887,6 +2942,7 @@ void ObjectFileELF::RelocateSection(lldb_private::Section *section) { static const char *debug_prefix = ".debug"; + static const char *zdebug_prefix = ".zdebug"; // Set relocated bit so we stop getting called, regardless of // whether we actually relocate. @@ -2902,7 +2958,8 @@ return; // We don't relocate non-debug sections at the moment - if (strncmp(section_name, debug_prefix, strlen(debug_prefix))) + if (strncmp(section_name, debug_prefix, strlen(debug_prefix)) || + strncmp(section_name, zdebug_prefix, strlen(zdebug_prefix))) return; // Relocation section names to look for @@ -3397,7 +3454,8 @@ return section->GetObjectFile()->ReadSectionData(section, section_offset, dst, dst_len); - if (!section->Test(SHF_COMPRESSED)) + if (!llvm::object::Decompressor::isCompressedELFSection( + section->Get(), section->GetName().GetStringRef())) return ObjectFile::ReadSectionData(section, section_offset, dst, dst_len); // For compressed sections we need to read to full data to be able to @@ -3416,7 +3474,8 @@ Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_MODULES); size_t result = ObjectFile::ReadSectionData(section, section_data); - if (result == 0 || !section->Test(SHF_COMPRESSED)) + if (result == 0 || !llvm::object::Decompressor::isCompressedELFSection( + section->Get(), section->GetName().GetStringRef())) return result; auto Decompressor = llvm::object::Decompressor::create( @@ -3477,3 +3536,4 @@ } return loadables; } +