Index: include/lldb/lldb-enumerations.h =================================================================== --- include/lldb/lldb-enumerations.h +++ include/lldb/lldb-enumerations.h @@ -595,6 +595,7 @@ eSectionTypeDataObjCMessageRefs, // Pointer to function pointer + selector eSectionTypeDataObjCCFStrings, // Objective C const CFString/NSString objects eSectionTypeDWARFDebugAbbrev, + eSectionTypeDWARFDebugAddr, eSectionTypeDWARFDebugAranges, eSectionTypeDWARFDebugFrame, eSectionTypeDWARFDebugInfo, @@ -605,6 +606,7 @@ eSectionTypeDWARFDebugPubTypes, eSectionTypeDWARFDebugRanges, eSectionTypeDWARFDebugStr, + eSectionTypeDWARFDebugStrOffsets, eSectionTypeDWARFAppleNames, eSectionTypeDWARFAppleTypes, eSectionTypeDWARFAppleNamespaces, Index: source/Expression/IRExecutionUnit.cpp =================================================================== --- source/Expression/IRExecutionUnit.cpp +++ source/Expression/IRExecutionUnit.cpp @@ -488,6 +488,8 @@ sect_type = lldb::eSectionTypeDWARFDebugAbbrev; else if (dwarf_name.equals("aranges")) sect_type = lldb::eSectionTypeDWARFDebugAranges; + else if (dwarf_name.equals("addr")) + sect_type = lldb::eSectionTypeDWARFDebugAddr; break; case 'f': @@ -522,6 +524,8 @@ case 's': if (dwarf_name.equals("str")) sect_type = lldb::eSectionTypeDWARFDebugStr; + else if (dwarf_name.equals("str_offsets")) + sect_type = lldb::eSectionTypeDWARFDebugStrOffsets; break; case 'r': @@ -789,6 +793,7 @@ { case lldb::eSectionTypeInvalid: case lldb::eSectionTypeDWARFDebugAbbrev: + case lldb::eSectionTypeDWARFDebugAddr: case lldb::eSectionTypeDWARFDebugAranges: case lldb::eSectionTypeDWARFDebugFrame: case lldb::eSectionTypeDWARFDebugInfo: @@ -799,6 +804,7 @@ case lldb::eSectionTypeDWARFDebugPubTypes: case lldb::eSectionTypeDWARFDebugRanges: case lldb::eSectionTypeDWARFDebugStr: + case lldb::eSectionTypeDWARFDebugStrOffsets: case lldb::eSectionTypeDWARFAppleNames: case lldb::eSectionTypeDWARFAppleTypes: case lldb::eSectionTypeDWARFAppleNamespaces: Index: source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp =================================================================== --- source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp +++ source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp @@ -1672,6 +1672,7 @@ static ConstString g_sect_name_tdata (".tdata"); static ConstString g_sect_name_tbss (".tbss"); static ConstString g_sect_name_dwarf_debug_abbrev (".debug_abbrev"); + 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_frame (".debug_frame"); static ConstString g_sect_name_dwarf_debug_info (".debug_info"); @@ -1682,6 +1683,7 @@ 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_str (".debug_str"); + static ConstString g_sect_name_dwarf_debug_str_offsets (".debug_str_offsets"); static ConstString g_sect_name_eh_frame (".eh_frame"); SectionType sect_type = eSectionTypeOther; @@ -1715,18 +1717,20 @@ // MISSING? .gnu_debugdata - "mini debuginfo / MiniDebugInfo" section, http://sourceware.org/gdb/onlinedocs/gdb/MiniDebugInfo.html // MISSING? .debug-index - 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) sect_type = eSectionTypeDWARFDebugAbbrev; - else if (name == g_sect_name_dwarf_debug_aranges) sect_type = eSectionTypeDWARFDebugAranges; - else if (name == g_sect_name_dwarf_debug_frame) sect_type = eSectionTypeDWARFDebugFrame; - else if (name == g_sect_name_dwarf_debug_info) sect_type = eSectionTypeDWARFDebugInfo; - else if (name == g_sect_name_dwarf_debug_line) sect_type = eSectionTypeDWARFDebugLine; - else if (name == g_sect_name_dwarf_debug_loc) sect_type = eSectionTypeDWARFDebugLoc; - else if (name == g_sect_name_dwarf_debug_macinfo) sect_type = eSectionTypeDWARFDebugMacInfo; - else if (name == g_sect_name_dwarf_debug_pubnames) sect_type = eSectionTypeDWARFDebugPubNames; - else if (name == g_sect_name_dwarf_debug_pubtypes) sect_type = eSectionTypeDWARFDebugPubTypes; - else if (name == g_sect_name_dwarf_debug_ranges) sect_type = eSectionTypeDWARFDebugRanges; - else if (name == g_sect_name_dwarf_debug_str) sect_type = eSectionTypeDWARFDebugStr; - else if (name == g_sect_name_eh_frame) sect_type = eSectionTypeEHFrame; + else if (name == g_sect_name_dwarf_debug_abbrev) sect_type = eSectionTypeDWARFDebugAbbrev; + else if (name == g_sect_name_dwarf_debug_addr) sect_type = eSectionTypeDWARFDebugAddr; + else if (name == g_sect_name_dwarf_debug_aranges) sect_type = eSectionTypeDWARFDebugAranges; + else if (name == g_sect_name_dwarf_debug_frame) sect_type = eSectionTypeDWARFDebugFrame; + else if (name == g_sect_name_dwarf_debug_info) sect_type = eSectionTypeDWARFDebugInfo; + else if (name == g_sect_name_dwarf_debug_line) sect_type = eSectionTypeDWARFDebugLine; + else if (name == g_sect_name_dwarf_debug_loc) sect_type = eSectionTypeDWARFDebugLoc; + else if (name == g_sect_name_dwarf_debug_macinfo) sect_type = eSectionTypeDWARFDebugMacInfo; + else if (name == g_sect_name_dwarf_debug_pubnames) sect_type = eSectionTypeDWARFDebugPubNames; + else if (name == g_sect_name_dwarf_debug_pubtypes) sect_type = eSectionTypeDWARFDebugPubTypes; + else if (name == g_sect_name_dwarf_debug_ranges) sect_type = eSectionTypeDWARFDebugRanges; + else if (name == g_sect_name_dwarf_debug_str) sect_type = eSectionTypeDWARFDebugStr; + else if (name == g_sect_name_dwarf_debug_str_offsets) sect_type = eSectionTypeDWARFDebugStrOffsets; + else if (name == g_sect_name_eh_frame) sect_type = eSectionTypeEHFrame; switch (header.sh_type) { @@ -1791,17 +1795,19 @@ { static const SectionType g_sections[] = { - eSectionTypeDWARFDebugAranges, - eSectionTypeDWARFDebugInfo, eSectionTypeDWARFDebugAbbrev, + eSectionTypeDWARFDebugAddr, + eSectionTypeDWARFDebugAranges, eSectionTypeDWARFDebugFrame, + eSectionTypeDWARFDebugInfo, eSectionTypeDWARFDebugLine, - eSectionTypeDWARFDebugStr, eSectionTypeDWARFDebugLoc, eSectionTypeDWARFDebugMacInfo, eSectionTypeDWARFDebugPubNames, eSectionTypeDWARFDebugPubTypes, eSectionTypeDWARFDebugRanges, + eSectionTypeDWARFDebugStr, + eSectionTypeDWARFDebugStrOffsets, eSectionTypeELFSymbolTable, }; SectionList *elf_section_list = m_sections_ap.get(); Index: source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp =================================================================== --- source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp +++ source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp @@ -1323,6 +1323,7 @@ case eSectionTypeDebug: case eSectionTypeDWARFDebugAbbrev: + case eSectionTypeDWARFDebugAddr: case eSectionTypeDWARFDebugAranges: case eSectionTypeDWARFDebugFrame: case eSectionTypeDWARFDebugInfo: @@ -1333,6 +1334,7 @@ case eSectionTypeDWARFDebugPubTypes: case eSectionTypeDWARFDebugRanges: case eSectionTypeDWARFDebugStr: + case eSectionTypeDWARFDebugStrOffsets: case eSectionTypeDWARFAppleNames: case eSectionTypeDWARFAppleTypes: case eSectionTypeDWARFAppleNamespaces: Index: source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h =================================================================== --- source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h +++ source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h @@ -53,6 +53,7 @@ dw_offset_t GetAbbrevOffset() const; uint8_t GetAddressByteSize() const { return m_addr_size; } dw_addr_t GetBaseAddress() const { return m_base_addr; } + dw_addr_t GetAddrBase() const { return 0; } // TODO: Read out DW_AT_addr_base from the parent compile unit void ClearDIEs(bool keep_compile_unit_die); void BuildAddressRangeTable (SymbolFileDWARF* dwarf2Data, DWARFDebugAranges* debug_aranges); Index: source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp =================================================================== --- source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp +++ source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp @@ -660,8 +660,6 @@ NameToDIE& types, NameToDIE& namespaces) { - const DWARFDataExtractor* debug_str = &m_dwarf2Data->get_debug_str_data(); - DWARFFormValue::FixedFormSizes fixed_form_sizes = DWARFFormValue::GetFixedFormSizesForAddressSize (GetAddressByteSize(), m_is_dwarf64); @@ -727,7 +725,7 @@ { case DW_AT_name: if (attributes.ExtractFormValueAtIndex(m_dwarf2Data, i, form_value)) - name = form_value.AsCString(debug_str); + name = form_value.AsCString(m_dwarf2Data); break; case DW_AT_declaration: @@ -743,7 +741,7 @@ case DW_AT_MIPS_linkage_name: case DW_AT_linkage_name: if (attributes.ExtractFormValueAtIndex(m_dwarf2Data, i, form_value)) - mangled_cstr = form_value.AsCString(debug_str); + mangled_cstr = form_value.AsCString(m_dwarf2Data); break; case DW_AT_low_pc: Index: source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp =================================================================== --- source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp +++ source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp @@ -226,9 +226,11 @@ break; // signed or unsigned LEB 128 values - case DW_FORM_sdata : - case DW_FORM_udata : - case DW_FORM_ref_udata : + case DW_FORM_sdata : + case DW_FORM_udata : + case DW_FORM_ref_udata : + case DW_FORM_GNU_addr_index: + case DW_FORM_GNU_str_index : debug_info_data.Skip_LEB128 (&offset); break; @@ -389,9 +391,11 @@ break; // signed or unsigned LEB 128 values - case DW_FORM_sdata : - case DW_FORM_udata : - case DW_FORM_ref_udata : + case DW_FORM_sdata : + case DW_FORM_udata : + case DW_FORM_ref_udata : + case DW_FORM_GNU_addr_index: + case DW_FORM_GNU_str_index : debug_info_data.Skip_LEB128(&offset); break; @@ -819,13 +823,13 @@ case DW_AT_name: if (name == NULL) - name = form_value.AsCString(&dwarf2Data->get_debug_str_data()); + name = form_value.AsCString(dwarf2Data); break; case DW_AT_MIPS_linkage_name: case DW_AT_linkage_name: if (mangled == NULL) - mangled = form_value.AsCString(&dwarf2Data->get_debug_str_data()); + mangled = form_value.AsCString(dwarf2Data); break; case DW_AT_abstract_origin: @@ -1062,7 +1066,6 @@ bool verbose = s.GetVerbose(); bool show_form = s.GetFlags().Test(DWARFDebugInfo::eDumpFlag_ShowForm); - const DWARFDataExtractor* debug_str_data = dwarf2Data ? &dwarf2Data->get_debug_str_data() : NULL; if (verbose) s.Offset (*offset_ptr); else @@ -1094,7 +1097,7 @@ // Always dump form value if verbose is enabled if (verbose) { - form_value.Dump(s, debug_str_data); + form_value.Dump(s, dwarf2Data); } @@ -1127,7 +1130,7 @@ if (blockData) { if (!verbose) - form_value.Dump(s, debug_str_data); + form_value.Dump(s, dwarf2Data); // Location description is inlined in data in the form value DWARFDataExtractor locationData(debug_info_data, (*offset_ptr) - form_value.Unsigned(), form_value.Unsigned()); @@ -1144,7 +1147,7 @@ if (dwarf2Data) { if ( !verbose ) - form_value.Dump(s, debug_str_data); + form_value.Dump(s, dwarf2Data); DWARFLocationList::Dump(s, cu, dwarf2Data->get_debug_loc_data(), debug_loc_offset); } else @@ -1160,7 +1163,7 @@ case DW_AT_specification: { uint64_t abstract_die_offset = form_value.Reference(); - form_value.Dump(s, debug_str_data); + form_value.Dump(s, dwarf2Data); // *ostrm_ptr << HEX32 << abstract_die_offset << " ( "; if ( verbose ) s.PutCString(" ( "); GetName(dwarf2Data, cu, abstract_die_offset, s); @@ -1172,7 +1175,7 @@ { uint64_t type_die_offset = form_value.Reference(); if (!verbose) - form_value.Dump(s, debug_str_data); + form_value.Dump(s, dwarf2Data); s.PutCString(" ( "); AppendTypeName(dwarf2Data, cu, type_die_offset, s); s.PutCString(" )"); @@ -1182,7 +1185,7 @@ case DW_AT_ranges: { if ( !verbose ) - form_value.Dump(s, debug_str_data); + form_value.Dump(s, dwarf2Data); lldb::offset_t ranges_offset = form_value.Unsigned(); dw_addr_t base_addr = cu ? cu->GetBaseAddress() : 0; if (dwarf2Data) @@ -1192,7 +1195,7 @@ default: if ( !verbose ) - form_value.Dump(s, debug_str_data); + form_value.Dump(s, dwarf2Data); break; } @@ -1360,7 +1363,7 @@ { DWARFFormValue form_value; if (GetAttributeValue(dwarf2Data, cu, attr, form_value)) - return form_value.AsCString(&dwarf2Data->get_debug_str_data()); + return form_value.AsCString(dwarf2Data); return fail_value; } @@ -1443,13 +1446,14 @@ ) const { DWARFFormValue form_value; - if (GetAttributeValue(dwarf2Data, cu, DW_AT_high_pc, form_value)) { - dw_addr_t hi_pc = form_value.Unsigned(); - if (form_value.Form() != DW_FORM_addr) - hi_pc += lo_pc; // DWARF4 can specify the hi_pc as an - return hi_pc; + dw_form_t form = form_value.Form(); + if (form == DW_FORM_addr || form == DW_FORM_GNU_addr_index) + return form_value.Address(dwarf2Data); + + // DWARF4 can specify the hi_pc as an + return lo_pc + form_value.Unsigned(); } return fail_value; } @@ -1582,7 +1586,7 @@ { DWARFFormValue form_value; if (GetAttributeValue(dwarf2Data, cu, DW_AT_name, form_value)) - return form_value.AsCString(&dwarf2Data->get_debug_str_data()); + return form_value.AsCString(dwarf2Data); else if (GetAttributeValue(dwarf2Data, cu, DW_AT_specification, form_value)) { DWARFCompileUnitSP cu_sp_ptr; @@ -1615,19 +1619,19 @@ bool substitute_name_allowed ) const { - const char* name = NULL; + const char* name = nullptr; DWARFFormValue form_value; if (GetAttributeValue(dwarf2Data, cu, DW_AT_MIPS_linkage_name, form_value)) - name = form_value.AsCString(&dwarf2Data->get_debug_str_data()); + name = form_value.AsCString(dwarf2Data); if (GetAttributeValue(dwarf2Data, cu, DW_AT_linkage_name, form_value)) - name = form_value.AsCString(&dwarf2Data->get_debug_str_data()); + name = form_value.AsCString(dwarf2Data); - if (substitute_name_allowed && name == NULL) + if (substitute_name_allowed && name == nullptr) { if (GetAttributeValue(dwarf2Data, cu, DW_AT_name, form_value)) - name = form_value.AsCString(&dwarf2Data->get_debug_str_data()); + name = form_value.AsCString(dwarf2Data); } return name; } @@ -1653,11 +1657,11 @@ DWARFFormValue form_value; if (GetAttributeValue(dwarf2Data, cu, DW_AT_MIPS_linkage_name, form_value)) - name = form_value.AsCString(&dwarf2Data->get_debug_str_data()); + name = form_value.AsCString(dwarf2Data); else if (GetAttributeValue(dwarf2Data, cu, DW_AT_linkage_name, form_value)) - name = form_value.AsCString(&dwarf2Data->get_debug_str_data()); + name = form_value.AsCString(dwarf2Data); else if (GetAttributeValue(dwarf2Data, cu, DW_AT_name, form_value)) - name = form_value.AsCString(&dwarf2Data->get_debug_str_data()); + name = form_value.AsCString(dwarf2Data); else if (GetAttributeValue(dwarf2Data, cu, DW_AT_specification, form_value)) { // The specification DIE may be in another compile unit so we need @@ -1709,7 +1713,7 @@ DWARFFormValue form_value; if (die.GetAttributeValue(dwarf2Data, cu, DW_AT_name, form_value)) { - const char* name = form_value.AsCString(&dwarf2Data->get_debug_str_data()); + const char* name = form_value.AsCString(dwarf2Data); if (name) { s.PutCString(name); Index: source/Plugins/SymbolFile/DWARF/DWARFDebugPubnames.cpp =================================================================== --- source/Plugins/SymbolFile/DWARF/DWARFDebugPubnames.cpp +++ source/Plugins/SymbolFile/DWARF/DWARFDebugPubnames.cpp @@ -77,9 +77,6 @@ DWARFDebugInfo* debug_info = dwarf2Data->DebugInfo(); if (debug_info) { - - const DWARFDataExtractor* debug_str = &dwarf2Data->get_debug_str_data(); - uint32_t cu_idx = 0; const uint32_t num_compile_units = dwarf2Data->GetNumCompileUnits(); for (cu_idx = 0; cu_idx < num_compile_units; ++cu_idx) @@ -123,13 +120,13 @@ { case DW_AT_name: if (attributes.ExtractFormValueAtIndex(dwarf2Data, i, form_value)) - name = form_value.AsCString(debug_str); + name = form_value.AsCString(dwarf2Data); break; case DW_AT_MIPS_linkage_name: case DW_AT_linkage_name: if (attributes.ExtractFormValueAtIndex(dwarf2Data, i, form_value)) - mangled = form_value.AsCString(debug_str); + mangled = form_value.AsCString(dwarf2Data); break; case DW_AT_low_pc: Index: source/Plugins/SymbolFile/DWARF/DWARFFormValue.h =================================================================== --- source/Plugins/SymbolFile/DWARF/DWARFFormValue.h +++ source/Plugins/SymbolFile/DWARF/DWARFFormValue.h @@ -14,6 +14,7 @@ #include "DWARFDataExtractor.h" class DWARFCompileUnit; +class SymbolFileDWARF; class DWARFFormValue { @@ -80,10 +81,9 @@ dw_form_t Form() const { return m_form; } void SetForm(dw_form_t form) { m_form = form; } const ValueType& Value() const { return m_value; } - void Dump(lldb_private::Stream &s, const lldb_private::DWARFDataExtractor* debug_str_data) const; + void Dump(lldb_private::Stream &s, SymbolFileDWARF* symbol_file) const; bool ExtractValue(const lldb_private::DWARFDataExtractor& data, lldb::offset_t* offset_ptr); - bool IsInlinedCStr() const { return (m_value.data != NULL) && m_value.data == (const uint8_t*)m_value.value.cstr; } const uint8_t* BlockData() const; uint64_t Reference() const; uint64_t Reference (dw_offset_t offset) const; @@ -92,13 +92,16 @@ void SetUnsigned(uint64_t uval) { m_value.value.uval = uval; } int64_t Signed() const { return m_value.value.sval; } void SetSigned(int64_t sval) { m_value.value.sval = sval; } - const char* AsCString(const lldb_private::DWARFDataExtractor* debug_str_data_ptr) const; + const char* AsCString(SymbolFileDWARF* symbol_file) const; + dw_addr_t Address(SymbolFileDWARF* symbol_file) const; bool SkipValue(const lldb_private::DWARFDataExtractor& debug_info_data, lldb::offset_t *offset_ptr) const; static bool SkipValue(const dw_form_t form, const lldb_private::DWARFDataExtractor& debug_info_data, lldb::offset_t *offset_ptr, const DWARFCompileUnit* cu); static bool IsBlockForm(const dw_form_t form); static bool IsDataForm(const dw_form_t form); static FixedFormSizes GetFixedFormSizesForAddressSize (uint8_t addr_size, bool is_dwarf64); - static int Compare (const DWARFFormValue& a, const DWARFFormValue& b, const lldb_private::DWARFDataExtractor* debug_str_data_ptr); + static int Compare (const DWARFFormValue& a, + const DWARFFormValue& b, + SymbolFileDWARF* symbol_file); protected: const DWARFCompileUnit* m_cu; // Compile unit for this form dw_form_t m_form; // Form for this value Index: source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp =================================================================== --- source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp +++ source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp @@ -187,11 +187,7 @@ case DW_FORM_data2: m_value.value.uval = data.GetU16(offset_ptr); break; case DW_FORM_data4: m_value.value.uval = data.GetU32(offset_ptr); break; case DW_FORM_data8: m_value.value.uval = data.GetU64(offset_ptr); break; - case DW_FORM_string: m_value.value.cstr = data.GetCStr(offset_ptr); - // Set the string value to also be the data for inlined cstr form values only - // so we can tell the difference between DW_FORM_string and DW_FORM_strp form - // values; - m_value.data = (const uint8_t*)m_value.value.cstr; break; + case DW_FORM_string: m_value.value.cstr = data.GetCStr(offset_ptr); break; case DW_FORM_exprloc: case DW_FORM_block: m_value.value.uval = data.GetULEB128(offset_ptr); is_block = true; break; case DW_FORM_block1: m_value.value.uval = data.GetU8(offset_ptr); is_block = true; break; @@ -219,10 +215,12 @@ indirect = true; break; - case DW_FORM_sec_offset: assert(m_cu); - m_value.value.uval = data.GetMaxU64(offset_ptr, DWARFCompileUnit::IsDWARF64(m_cu) ? 8 : 4); break; - case DW_FORM_flag_present: m_value.value.uval = 1; break; - case DW_FORM_ref_sig8: m_value.value.uval = data.GetU64(offset_ptr); break; + case DW_FORM_sec_offset: assert(m_cu); + m_value.value.uval = data.GetMaxU64(offset_ptr, DWARFCompileUnit::IsDWARF64(m_cu) ? 8 : 4); break; + case DW_FORM_flag_present: m_value.value.uval = 1; break; + case DW_FORM_ref_sig8: m_value.value.uval = data.GetU64(offset_ptr); break; + case DW_FORM_GNU_str_index: m_value.value.uval = data.GetULEB128(offset_ptr); break; + case DW_FORM_GNU_addr_index: m_value.value.uval = data.GetULEB128(offset_ptr); break; default: return false; break; @@ -322,6 +320,8 @@ case DW_FORM_sdata: case DW_FORM_udata: case DW_FORM_ref_udata: + case DW_FORM_GNU_addr_index: + case DW_FORM_GNU_str_index: debug_info_data.Skip_LEB128(offset_ptr); return true; @@ -342,7 +342,7 @@ void -DWARFFormValue::Dump(Stream &s, const DWARFDataExtractor* debug_str_data) const +DWARFFormValue::Dump(Stream &s, SymbolFileDWARF* symbol_file) const { uint64_t uvalue = Unsigned(); bool cu_relative_offset = false; @@ -353,13 +353,13 @@ { case DW_FORM_addr: s.Address(uvalue, sizeof (uint64_t)); break; case DW_FORM_flag: - case DW_FORM_data1: s.PutHex8(uvalue); break; + case DW_FORM_data1: s.PutHex8(uvalue); break; case DW_FORM_data2: s.PutHex16(uvalue); break; case DW_FORM_sec_offset: case DW_FORM_data4: s.PutHex32(uvalue); break; case DW_FORM_ref_sig8: case DW_FORM_data8: s.PutHex64(uvalue); break; - case DW_FORM_string: s.QuotedCString(AsCString(NULL)); break; + case DW_FORM_string: s.QuotedCString(AsCString(symbol_file)); break; case DW_FORM_exprloc: case DW_FORM_block: case DW_FORM_block1: @@ -395,12 +395,12 @@ case DW_FORM_sdata: s.PutSLEB128(uvalue); break; case DW_FORM_udata: s.PutULEB128(uvalue); break; case DW_FORM_strp: - if (debug_str_data) + if (symbol_file) { if (verbose) s.Printf(" .debug_str[0x%8.8x] = ", (uint32_t)uvalue); - const char* dbg_str = AsCString(debug_str_data); + const char* dbg_str = AsCString(symbol_file); if (dbg_str) s.QuotedCString(dbg_str); } @@ -444,13 +444,48 @@ } const char* -DWARFFormValue::AsCString(const DWARFDataExtractor* debug_str_data_ptr) const +DWARFFormValue::AsCString(SymbolFileDWARF* symbol_file) const { - if (IsInlinedCStr()) + if (m_form == DW_FORM_string) + { return m_value.value.cstr; - else if (debug_str_data_ptr) - return debug_str_data_ptr->PeekCStr(m_value.value.uval); - return NULL; + } + else if (m_form == DW_FORM_strp) + { + if (!symbol_file) + return nullptr; + + return symbol_file->get_debug_str_data().PeekCStr(m_value.value.uval); + } + else if (m_form == DW_FORM_GNU_str_index) + { + if (!symbol_file) + return nullptr; + + uint32_t index_size = m_cu->IsDWARF64() ? 8 : 4; + lldb::offset_t offset = m_value.value.uval * index_size; + dw_offset_t str_offset = symbol_file->get_debug_str_offsets_data().GetMaxU64(&offset, index_size); + return symbol_file->get_debug_str_data().PeekCStr(str_offset); + } + return nullptr; +} + +dw_addr_t +DWARFFormValue::Address(SymbolFileDWARF* symbol_file) const +{ + if (m_form == DW_FORM_addr) + return Unsigned(); + + assert(m_cu); + assert(m_form == DW_FORM_GNU_addr_index); + + if (!symbol_file) + return 0; + + uint32_t index_size = m_cu->GetAddressByteSize(); + dw_offset_t addr_base = m_cu->GetAddrBase(); + lldb::offset_t offset = addr_base + m_value.value.uval * index_size; + return symbol_file->get_debug_addr_data().GetMaxU64(&offset, index_size); } uint64_t @@ -500,9 +535,7 @@ const uint8_t* DWARFFormValue::BlockData() const { - if (!IsInlinedCStr()) - return m_value.data; - return NULL; + return m_value.data; } @@ -537,7 +570,9 @@ } int -DWARFFormValue::Compare (const DWARFFormValue& a_value, const DWARFFormValue& b_value, const DWARFDataExtractor* debug_str_data_ptr) +DWARFFormValue::Compare (const DWARFFormValue& a_value, + const DWARFFormValue& b_value, + SymbolFileDWARF* symbol_file) { dw_form_t a_form = a_value.Form(); dw_form_t b_form = b_value.Form(); @@ -558,6 +593,7 @@ case DW_FORM_sec_offset: case DW_FORM_flag_present: case DW_FORM_ref_sig8: + case DW_FORM_GNU_addr_index: { uint64_t a = a_value.Unsigned(); uint64_t b = b_value.Unsigned(); @@ -581,9 +617,10 @@ case DW_FORM_string: case DW_FORM_strp: + case DW_FORM_GNU_str_index: { - const char *a_string = a_value.AsCString(debug_str_data_ptr); - const char *b_string = b_value.AsCString(debug_str_data_ptr); + const char *a_string = a_value.AsCString(symbol_file); + const char *b_string = b_value.AsCString(symbol_file); if (a_string == b_string) return 0; else if (a_string && b_string) Index: source/Plugins/SymbolFile/DWARF/HashedNameToDIE.h =================================================================== --- source/Plugins/SymbolFile/DWARF/HashedNameToDIE.h +++ source/Plugins/SymbolFile/DWARF/HashedNameToDIE.h @@ -307,6 +307,8 @@ case DW_FORM_sdata: case DW_FORM_udata: case DW_FORM_ref_udata: + case DW_FORM_GNU_addr_index: + case DW_FORM_GNU_str_index: hash_data_has_fixed_byte_size = false; // Fall through to the cases below... case DW_FORM_flag: Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h =================================================================== --- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h +++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h @@ -158,6 +158,7 @@ GetPluginVersion() override; const lldb_private::DWARFDataExtractor& get_debug_abbrev_data (); + 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 (); @@ -165,6 +166,7 @@ const lldb_private::DWARFDataExtractor& get_debug_loc_data (); const lldb_private::DWARFDataExtractor& get_debug_ranges_data (); const lldb_private::DWARFDataExtractor& get_debug_str_data (); + const lldb_private::DWARFDataExtractor& get_debug_str_offsets_data (); const lldb_private::DWARFDataExtractor& get_apple_names_data (); const lldb_private::DWARFDataExtractor& get_apple_types_data (); const lldb_private::DWARFDataExtractor& get_apple_namespaces_data (); @@ -229,20 +231,22 @@ enum { flagsGotDebugAbbrevData = (1 << 0), - flagsGotDebugArangesData = (1 << 1), - flagsGotDebugFrameData = (1 << 2), - flagsGotDebugInfoData = (1 << 3), - flagsGotDebugLineData = (1 << 4), - flagsGotDebugLocData = (1 << 5), - flagsGotDebugMacInfoData = (1 << 6), - flagsGotDebugPubNamesData = (1 << 7), - flagsGotDebugPubTypesData = (1 << 8), - flagsGotDebugRangesData = (1 << 9), - flagsGotDebugStrData = (1 << 10), - flagsGotAppleNamesData = (1 << 11), - flagsGotAppleTypesData = (1 << 12), - flagsGotAppleNamespacesData = (1 << 13), - flagsGotAppleObjCData = (1 << 14) + flagsGotDebugAddrData = (1 << 1), + flagsGotDebugArangesData = (1 << 2), + flagsGotDebugFrameData = (1 << 3), + flagsGotDebugInfoData = (1 << 4), + flagsGotDebugLineData = (1 << 5), + flagsGotDebugLocData = (1 << 6), + flagsGotDebugMacInfoData = (1 << 7), + flagsGotDebugPubNamesData = (1 << 8), + flagsGotDebugPubTypesData = (1 << 9), + flagsGotDebugRangesData = (1 << 10), + flagsGotDebugStrData = (1 << 11), + flagsGotDebugStrOffsetsData = (1 << 12), + flagsGotAppleNamesData = (1 << 13), + flagsGotAppleTypesData = (1 << 14), + flagsGotAppleNamespacesData = (1 << 15), + flagsGotAppleObjCData = (1 << 16) }; bool NamespaceDeclMatchesThisSymbolFile (const lldb_private::ClangNamespaceDecl *namespace_decl); @@ -415,8 +419,9 @@ lldb::ModuleWP m_debug_map_module_wp; SymbolFileDWARFDebugMap * m_debug_map_symfile; lldb_private::Flags m_flags; - lldb_private::DWARFDataExtractor m_dwarf_data; + lldb_private::DWARFDataExtractor m_dwarf_data; lldb_private::DWARFDataExtractor m_data_debug_abbrev; + lldb_private::DWARFDataExtractor m_data_debug_addr; lldb_private::DWARFDataExtractor m_data_debug_aranges; lldb_private::DWARFDataExtractor m_data_debug_frame; lldb_private::DWARFDataExtractor m_data_debug_info; @@ -424,6 +429,7 @@ lldb_private::DWARFDataExtractor m_data_debug_loc; lldb_private::DWARFDataExtractor m_data_debug_ranges; lldb_private::DWARFDataExtractor m_data_debug_str; + lldb_private::DWARFDataExtractor m_data_debug_str_offsets; lldb_private::DWARFDataExtractor m_data_apple_names; lldb_private::DWARFDataExtractor m_data_apple_types; lldb_private::DWARFDataExtractor m_data_apple_namespaces; Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp =================================================================== --- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -781,6 +781,12 @@ } const DWARFDataExtractor& +SymbolFileDWARF::get_debug_addr_data() +{ + return GetCachedSectionData (flagsGotDebugAddrData, eSectionTypeDWARFDebugAddr, m_data_debug_addr); +} + +const DWARFDataExtractor& SymbolFileDWARF::get_debug_aranges_data() { return GetCachedSectionData (flagsGotDebugArangesData, eSectionTypeDWARFDebugAranges, m_data_debug_aranges); @@ -823,6 +829,12 @@ } const DWARFDataExtractor& +SymbolFileDWARF::get_debug_str_offsets_data() +{ + return GetCachedSectionData (flagsGotDebugStrOffsetsData, eSectionTypeDWARFDebugStrOffsets, m_data_debug_str_offsets); +} + +const DWARFDataExtractor& SymbolFileDWARF::get_apple_names_data() { return GetCachedSectionData (flagsGotAppleNamesData, eSectionTypeDWARFAppleNames, m_data_apple_names); @@ -2549,7 +2561,7 @@ { if (attributes.ExtractFormValueAtIndex(this, idx, form_value)) { - const char *mangled_name = form_value.AsCString(&get_debug_str_data()); + const char *mangled_name = form_value.AsCString(this); if (mangled_name) best_name.SetValue (ConstString(mangled_name), true); } @@ -2560,7 +2572,7 @@ idx = attributes.FindAttributeIndex(DW_AT_name); if (idx != UINT32_MAX && attributes.ExtractFormValueAtIndex(this, idx, form_value)) { - const char *name = form_value.AsCString(&get_debug_str_data()); + const char *name = form_value.AsCString(this); best_name.SetValue (ConstString(name), false); } } @@ -4020,9 +4032,9 @@ case DW_AT_decl_file: decl.SetFile(sc.comp_unit->GetSupportFiles().GetFileSpecAtIndex(form_value.Unsigned())); break; case DW_AT_decl_line: decl.SetLine(form_value.Unsigned()); break; case DW_AT_decl_column: decl.SetColumn(form_value.Unsigned()); break; - case DW_AT_name: name = form_value.AsCString(&get_debug_str_data()); break; + case DW_AT_name: name = form_value.AsCString(this); break; case DW_AT_linkage_name: - case DW_AT_MIPS_linkage_name: mangled = form_value.AsCString(&get_debug_str_data()); break; + case DW_AT_MIPS_linkage_name: mangled = form_value.AsCString(this); break; case DW_AT_type: type_uid = form_value.Reference(); break; case DW_AT_external: is_external = form_value.Boolean(); break; case DW_AT_const_value: @@ -4079,7 +4091,7 @@ } else { - const char *str = form_value.AsCString(&debug_info_data); + const char *str = form_value.AsCString(this); uint32_t string_offset = str - (const char *)debug_info_data.GetDataStart(); uint32_t string_length = strlen(str) + 1; location.CopyOpcodeData(module, debug_info_data, string_offset, string_length); Index: source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp =================================================================== --- source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp +++ source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp @@ -142,17 +142,19 @@ static const SectionType g_sections[] = { - eSectionTypeDWARFDebugAranges, - eSectionTypeDWARFDebugInfo, eSectionTypeDWARFDebugAbbrev, + eSectionTypeDWARFDebugAddr, + eSectionTypeDWARFDebugAranges, eSectionTypeDWARFDebugFrame, + eSectionTypeDWARFDebugInfo, eSectionTypeDWARFDebugLine, - eSectionTypeDWARFDebugStr, eSectionTypeDWARFDebugLoc, eSectionTypeDWARFDebugMacInfo, eSectionTypeDWARFDebugPubNames, eSectionTypeDWARFDebugPubTypes, eSectionTypeDWARFDebugRanges, + eSectionTypeDWARFDebugStr, + eSectionTypeDWARFDebugStrOffsets, eSectionTypeELFSymbolTable, }; for (size_t idx = 0; idx < sizeof(g_sections) / sizeof(g_sections[0]); ++idx) Index: source/Symbol/ClangASTContext.cpp =================================================================== --- source/Symbol/ClangASTContext.cpp +++ source/Symbol/ClangASTContext.cpp @@ -8966,7 +8966,7 @@ { case DW_AT_name: if (attributes.ExtractFormValueAtIndex(dwarf, i, form_value)) - name = form_value.AsCString(&dwarf->get_debug_str_data()); + name = form_value.AsCString(dwarf); break; case DW_AT_type: @@ -9498,7 +9498,7 @@ break; case DW_AT_name: - name = form_value.AsCString(&dwarf->get_debug_str_data()); + name = form_value.AsCString(dwarf); break; case DW_AT_description: @@ -9877,7 +9877,7 @@ case DW_AT_decl_file: decl.SetFile(sc.comp_unit->GetSupportFiles().GetFileSpecAtIndex(form_value.Unsigned())); break; case DW_AT_decl_line: decl.SetLine(form_value.Unsigned()); break; case DW_AT_decl_column: decl.SetColumn(form_value.Unsigned()); break; - case DW_AT_name: name = form_value.AsCString(&dwarf->get_debug_str_data()); break; + case DW_AT_name: name = form_value.AsCString(dwarf); break; case DW_AT_type: encoding_uid = form_value.Reference(); break; case DW_AT_bit_offset: bit_offset = form_value.Unsigned(); break; case DW_AT_bit_size: bit_size = form_value.Unsigned(); break; @@ -9917,9 +9917,12 @@ case DW_AT_accessibility: accessibility = DW_ACCESS_to_AccessType (form_value.Unsigned()); break; case DW_AT_artificial: is_artificial = form_value.Boolean(); break; - case DW_AT_APPLE_property_name: prop_name = form_value.AsCString(&dwarf->get_debug_str_data()); break; - case DW_AT_APPLE_property_getter: prop_getter_name = form_value.AsCString(&dwarf->get_debug_str_data()); break; - case DW_AT_APPLE_property_setter: prop_setter_name = form_value.AsCString(&dwarf->get_debug_str_data()); break; + case DW_AT_APPLE_property_name: prop_name = form_value.AsCString(dwarf); + break; + case DW_AT_APPLE_property_getter: prop_getter_name = form_value.AsCString(dwarf); + break; + case DW_AT_APPLE_property_setter: prop_setter_name = form_value.AsCString(dwarf); + break; case DW_AT_APPLE_property_attribute: prop_attributes = form_value.Unsigned(); break; case DW_AT_external: is_external = form_value.Boolean(); break; @@ -10436,7 +10439,8 @@ case DW_AT_decl_file: decl.SetFile(sc.comp_unit->GetSupportFiles().GetFileSpecAtIndex(form_value.Unsigned())); break; case DW_AT_decl_line: decl.SetLine(form_value.Unsigned()); break; case DW_AT_decl_column: decl.SetColumn(form_value.Unsigned()); break; - case DW_AT_name: name = form_value.AsCString(&dwarf->get_debug_str_data()); break; + case DW_AT_name: name = form_value.AsCString(dwarf); + break; case DW_AT_type: param_type_die_offset = form_value.Reference(); break; case DW_AT_artificial: is_artificial = form_value.Boolean(); break; case DW_AT_location: @@ -10960,7 +10964,7 @@ case DW_AT_decl_column: decl.SetColumn(form_value.Unsigned()); break; case DW_AT_name: - type_name_cstr = form_value.AsCString(&dwarf->get_debug_str_data()); + type_name_cstr = form_value.AsCString(dwarf); // Work around a bug in llvm-gcc where they give a name to a reference type which doesn't // include the "&"... if (tag == DW_TAG_reference_type) @@ -11163,7 +11167,7 @@ break; case DW_AT_name: - type_name_cstr = form_value.AsCString(&dwarf->get_debug_str_data()); + type_name_cstr = form_value.AsCString(dwarf); type_name_const_str.SetCString(type_name_cstr); break; @@ -11560,7 +11564,7 @@ case DW_AT_decl_line: decl.SetLine(form_value.Unsigned()); break; case DW_AT_decl_column: decl.SetColumn(form_value.Unsigned()); break; case DW_AT_name: - type_name_cstr = form_value.AsCString(&dwarf->get_debug_str_data()); + type_name_cstr = form_value.AsCString(dwarf); type_name_const_str.SetCString(type_name_cstr); break; case DW_AT_type: encoding_uid = form_value.Reference(); break; @@ -11678,7 +11682,7 @@ case DW_AT_decl_line: decl.SetLine(form_value.Unsigned()); break; case DW_AT_decl_column: decl.SetColumn(form_value.Unsigned()); break; case DW_AT_name: - type_name_cstr = form_value.AsCString(&dwarf->get_debug_str_data()); + type_name_cstr = form_value.AsCString(dwarf); type_name_const_str.SetCString(type_name_cstr); break; @@ -12150,7 +12154,7 @@ case DW_AT_decl_line: decl.SetLine(form_value.Unsigned()); break; case DW_AT_decl_column: decl.SetColumn(form_value.Unsigned()); break; case DW_AT_name: - type_name_cstr = form_value.AsCString(&dwarf->get_debug_str_data()); + type_name_cstr = form_value.AsCString(dwarf); type_name_const_str.SetCString(type_name_cstr); break; Index: source/Symbol/ObjectFile.cpp =================================================================== --- source/Symbol/ObjectFile.cpp +++ source/Symbol/ObjectFile.cpp @@ -354,6 +354,7 @@ return eAddressClassData; case eSectionTypeDebug: case eSectionTypeDWARFDebugAbbrev: + case eSectionTypeDWARFDebugAddr: case eSectionTypeDWARFDebugAranges: case eSectionTypeDWARFDebugFrame: case eSectionTypeDWARFDebugInfo: @@ -364,6 +365,7 @@ case eSectionTypeDWARFDebugPubTypes: case eSectionTypeDWARFDebugRanges: case eSectionTypeDWARFDebugStr: + case eSectionTypeDWARFDebugStrOffsets: case eSectionTypeDWARFAppleNames: case eSectionTypeDWARFAppleTypes: case eSectionTypeDWARFAppleNamespaces: Index: source/Utility/ConvertEnum.cpp =================================================================== --- source/Utility/ConvertEnum.cpp +++ source/Utility/ConvertEnum.cpp @@ -63,6 +63,8 @@ return "objc-cfstrings"; case eSectionTypeDWARFDebugAbbrev: return "dwarf-abbrev"; + case eSectionTypeDWARFDebugAddr: + return "dwarf-addr"; case eSectionTypeDWARFDebugAranges: return "dwarf-aranges"; case eSectionTypeDWARFDebugFrame: @@ -83,6 +85,8 @@ return "dwarf-ranges"; case eSectionTypeDWARFDebugStr: return "dwarf-str"; + case eSectionTypeDWARFDebugStrOffsets: + return "dwarf-str-offsets"; case eSectionTypeELFSymbolTable: return "elf-symbol-table"; case eSectionTypeELFDynamicSymbols: