uint32_t DWARFDebugInfoEntryMinimal::getAttributeValue(const DWARFCompileUnit *cu, const uint16_t attr, DWARFFormValue &form_value, uint32_t *end_attr_offset_ptr) const { if (AbbrevDecl) { uint32_t attr_idx = AbbrevDecl->findAttributeIndex(attr); if (attr_idx != -1U) { uint32_t offset = getOffset(); DataExtractor debug_info_data = cu->getDebugInfoExtractor(); // Skip the abbreviation code so we are at the data for the attributes debug_info_data.getULEB128(&offset); uint32_t idx = 0; while (idx < attr_idx) DWARFFormValue::skipValue(AbbrevDecl->getFormByIndex(idx++), debug_info_data, &offset, cu); const uint32_t attr_offset = offset; form_value = DWARFFormValue(AbbrevDecl->getFormByIndex(idx)); if (form_value.extractValue(debug_info_data, &offset, cu)) { if (end_attr_offset_ptr) *end_attr_offset_ptr = offset; return attr_offset; } } } return 0; }
bool DWARFDebugInfoEntryMinimal::getAttributeValue( const DWARFUnit *U, const uint16_t Attr, DWARFFormValue &FormValue) const { if (!AbbrevDecl) return false; uint32_t AttrIdx = AbbrevDecl->findAttributeIndex(Attr); if (AttrIdx == -1U) return false; DataExtractor DebugInfoData = U->getDebugInfoExtractor(); uint32_t DebugInfoOffset = getOffset(); // Skip the abbreviation code so we are at the data for the attributes DebugInfoData.getULEB128(&DebugInfoOffset); // Skip preceding attribute values. for (uint32_t i = 0; i < AttrIdx; ++i) { DWARFFormValue::skipValue(AbbrevDecl->getFormByIndex(i), DebugInfoData, &DebugInfoOffset, U); } FormValue = DWARFFormValue(AbbrevDecl->getFormByIndex(AttrIdx)); return FormValue.extractValue(DebugInfoData, &DebugInfoOffset, U); }