Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp =================================================================== --- lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp +++ lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp @@ -1001,7 +1001,8 @@ bool check_specification_or_abstract_origin) const { DWARFFormValue form_value; if (GetAttributeValue(dwarf2Data, cu, attr, form_value, nullptr, - check_specification_or_abstract_origin)) + check_specification_or_abstract_origin) + && form_value.FormIsReference()) return form_value.Reference(); return fail_value; } Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.h =================================================================== --- lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.h +++ lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.h @@ -71,6 +71,7 @@ bool ExtractValue(const lldb_private::DWARFDataExtractor &data, lldb::offset_t *offset_ptr); const uint8_t *BlockData() const; + bool FormIsReference() const; uint64_t Reference() const; uint64_t Reference(dw_offset_t offset) const; bool Boolean() const { return m_value.value.uval != 0; } Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp =================================================================== --- lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp +++ lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp @@ -603,6 +603,25 @@ return symbol_file->get_debug_addr_data().GetMaxU64(&offset, index_size); } +bool DWARFFormValue::FormIsReference() const { + switch (m_form) { + case DW_FORM_ref1: + case DW_FORM_ref2: + case DW_FORM_ref4: + case DW_FORM_ref8: + case DW_FORM_ref_udata: + case DW_FORM_ref_addr: + return true; + break; + + // It cannot be resolved by the Reference() method. + case DW_FORM_ref_sig8: + default: + break; + } + return false; +} + uint64_t DWARFFormValue::Reference() const { uint64_t die_offset = m_value.value.uval; switch (m_form) {