Index: source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.h =================================================================== --- source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.h +++ source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.h @@ -41,6 +41,7 @@ // void Encode(BinaryStreamBuf& debug_abbrev_buf) const; dw_uleb128_t AppendAbbrevDeclSequential(const DWARFAbbreviationDeclaration &abbrevDecl); + bool SupportsAllForms(dw_form_t &invalid_form) const; const DWARFAbbreviationDeclaration * GetAbbreviationDeclaration(dw_uleb128_t abbrCode) const; @@ -65,6 +66,7 @@ GetAbbreviationDeclarationSet(dw_offset_t cu_abbr_offset) const; void Dump(lldb_private::Stream *s) const; void Parse(const lldb_private::DWARFDataExtractor &data); + bool SupportsAllForms(dw_form_t &invalid_form) const; protected: DWARFAbbreviationDeclarationCollMap m_abbrevCollMap; Index: source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.cpp =================================================================== --- source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.cpp +++ source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.cpp @@ -98,6 +98,23 @@ } //---------------------------------------------------------------------- +// DWARFAbbreviationDeclarationSet::SupportsAllForms() +//---------------------------------------------------------------------- +bool DWARFAbbreviationDeclarationSet::SupportsAllForms(dw_form_t &invalid_form) const { + for (const auto &abbr_decl : m_decls) { + const size_t num_attrs = abbr_decl.NumAttributes(); + for (size_t i=0; isecond); return NULL; } + +//---------------------------------------------------------------------- +// DWARFDebugAbbrev::SupportsAllForms() +//---------------------------------------------------------------------- +bool DWARFDebugAbbrev::SupportsAllForms(dw_form_t &invalid_form) const { + for (const auto &pair : m_abbrevCollMap) + if (!pair.second.SupportsAllForms(invalid_form)) + return false; + return true; +} Index: source/Plugins/SymbolFile/DWARF/DWARFFormValue.h =================================================================== --- source/Plugins/SymbolFile/DWARF/DWARFFormValue.h +++ source/Plugins/SymbolFile/DWARF/DWARFFormValue.h @@ -86,6 +86,7 @@ bool is_dwarf64); static int Compare(const DWARFFormValue &a, const DWARFFormValue &b); void Clear(); + static bool FormIsSupported(dw_form_t form); protected: const DWARFCompileUnit *m_cu; // Compile unit for this form Index: source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp =================================================================== --- source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp +++ source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp @@ -725,3 +725,39 @@ } return -1; } + +bool DWARFFormValue::FormIsSupported(dw_form_t form) { + switch (form) { + case DW_FORM_addr: + case DW_FORM_block2: + case DW_FORM_block4: + case DW_FORM_data2: + case DW_FORM_data4: + case DW_FORM_data8: + case DW_FORM_string: + case DW_FORM_block: + case DW_FORM_block1: + case DW_FORM_data1: + case DW_FORM_flag: + case DW_FORM_sdata: + case DW_FORM_strp: + case DW_FORM_udata: + case DW_FORM_ref_addr: + case DW_FORM_ref1: + case DW_FORM_ref2: + case DW_FORM_ref4: + case DW_FORM_ref8: + case DW_FORM_ref_udata: + case DW_FORM_indirect: + case DW_FORM_sec_offset: + case DW_FORM_exprloc: + case DW_FORM_flag_present: + case DW_FORM_ref_sig8: + case DW_FORM_GNU_str_index: + case DW_FORM_GNU_addr_index: + return true; + default: + break; + } + return false; +} Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp =================================================================== --- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -514,8 +514,16 @@ section = section_list->FindSectionByType(eSectionTypeDWARFDebugAbbrev, true) .get(); - if (section) + if (section) { debug_abbrev_file_size = section->GetFileSize(); + DWARFDebugAbbrev *abbrev = DebugAbbrev(); + dw_form_t invalid_form; + if (!abbrev->SupportsAllForms(invalid_form)) { + m_obj_file->GetModule()->ReportWarning( + "unsupported DW_FORM value of 0x%x.",invalid_form); + return 0; + } + } section = section_list->FindSectionByType(eSectionTypeDWARFDebugLine, true)