Lines Matching +full:form +full:- +full:data

1 //=== DIEAttributeCloner.cpp ----------------------------------------------===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
18 DWARFDataExtractor Data = InUnit.getOrigUnit().getDebugInfoExtractor(); in clone() local
20 uint64_t Offset = InputDieEntry->getOffset(); in clone()
28 // We could copy the data only if we need to apply a relocation to it. After in clone()
31 SmallString<40> DIECopy(Data.getData().substr(Offset, NextOffset - Offset)); in clone()
32 Data = in clone()
33 DWARFDataExtractor(DIECopy, Data.isLittleEndian(), Data.getAddressSize()); in clone()
36 InUnit.getContaingFile().Addresses->applyValidRelocs(DIECopy, Offset, in clone()
37 Data.isLittleEndian()); in clone()
40 // the data. in clone()
43 const auto *Abbrev = InputDieEntry->getAbbreviationDeclarationPtr(); in clone()
44 Offset += getULEB128Size(Abbrev->getCode()); in clone()
47 AttrOutOffset = OutUnit.isCompileUnit() ? OutDIE->getOffset() : 0; in clone()
48 for (const auto &AttrSpec : Abbrev->attributes()) { in clone()
51 DWARFFormValue::skipValue(AttrSpec.Form, Data, &Offset, in clone()
57 Val.extractValue(Data, &Offset, InUnit.getFormParams(), in clone()
61 switch (AttrSpec.Form) { in clone()
110 InUnit.warn("unsupported attribute form " + in clone()
111 dwarf::FormEncodingString(AttrSpec.Form) + in clone()
117 // We convert source strings into the indexed form for DWARFv5. in clone()
120 if (InputDieEntry->getTag() == dwarf::DW_TAG_compile_unit && in clone()
124 &OutUnit->getOrCreateSectionDescriptor( in clone()
133 OutUnit->getDebugStrOffsetsHeaderSize()) in clone()
201 if (AttrSpec.Form == dwarf::DW_FORM_line_strp) { in cloneStringAttr()
232 OutUnit->getDebugStrIndex(StringInPool)) in cloneStringAttr()
244 if (!RefDiePair || !RefDiePair->DieEntry) { in cloneDieRefAttr()
252 RefDiePair->CU->getDIEInfo(RefDiePair->DieEntry); in cloneDieRefAttr()
254 RefTypeName = RefDiePair->CU->getDieTypeEntry(RefDiePair->DieEntry); in cloneDieRefAttr()
280 uint64_t OutDieOffset = RefDiePair->CU->getDieOutOffset(RefDiePair->DieEntry); in cloneDieRefAttr()
283 bool IsLocal = OutUnit->getUniqueID() == RefDiePair->CU->getUniqueID(); in cloneDieRefAttr()
285 // Set attribute form basing on the kind of referenced DIE(local or not?). in cloneDieRefAttr()
286 dwarf::Form NewForm = IsLocal ? dwarf::DW_FORM_ref4 : dwarf::DW_FORM_ref_addr; in cloneDieRefAttr()
289 // the same compilation unit. If true - write the already known offset value. in cloneDieRefAttr()
298 RefDiePair->CU, in cloneDieRefAttr()
299 RefDiePair->CU->getDIEIndex(RefDiePair->DieEntry)}, in cloneDieRefAttr()
310 // reference to it do not change value in case --update. in cloneScalarAttr()
315 InUnit.getContaingFile().Dwarf->getDebugMacinfo(); in cloneScalarAttr()
316 if (Macro == nullptr || !Macro->hasEntryForOffset(*Offset)) in cloneScalarAttr()
321 &OutUnit->getOrCreateSectionDescriptor( in cloneScalarAttr()
329 InUnit.getContaingFile().Dwarf->getDebugMacro(); in cloneScalarAttr()
330 if (Macro == nullptr || !Macro->hasEntryForOffset(*Offset)) in cloneScalarAttr()
335 &OutUnit->getOrCreateSectionDescriptor( in cloneScalarAttr()
342 DebugOffsetPatch{AttrOutOffset, &OutUnit->getOrCreateSectionDescriptor( in cloneScalarAttr()
349 &OutUnit->getOrCreateSectionDescriptor( in cloneScalarAttr()
358 .addScalarAttribute(AttrSpec.Attr, AttrSpec.Form, in cloneScalarAttr()
359 OutUnit->getDebugStrOffsetsHeaderSize()) in cloneScalarAttr()
363 // Value of DW_AT_decl_file may exceed original form. Longer in cloneScalarAttr()
364 // form can affect offsets to the following attributes. To not in cloneScalarAttr()
374 OutUnit->getGlobalData() in cloneScalarAttr()
376 .insert(DirAndFilename->first) in cloneScalarAttr()
378 OutUnit->getGlobalData() in cloneScalarAttr()
380 .insert(DirAndFilename->second) in cloneScalarAttr()
392 (InputDieEntry->getTag() == dwarf::DW_TAG_variable || in cloneScalarAttr()
393 InputDieEntry->getTag() == dwarf::DW_TAG_constant)) in cloneScalarAttr()
404 InUnit.warn("unsupported scalar attribute form. Dropping attribute.", in cloneScalarAttr()
412 if (AttrSpec.Form == dwarf::DW_FORM_loclistx) in cloneScalarAttr()
413 return Generator.addLocListAttribute(AttrSpec.Attr, AttrSpec.Form, Value) in cloneScalarAttr()
416 return Generator.addScalarAttribute(AttrSpec.Attr, AttrSpec.Form, Value) in cloneScalarAttr()
420 dwarf::Form ResultingForm = AttrSpec.Form; in cloneScalarAttr()
421 if (AttrSpec.Form == dwarf::DW_FORM_rnglistx) { in cloneScalarAttr()
439 } else if (AttrSpec.Form == dwarf::DW_FORM_loclistx) { in cloneScalarAttr()
458 InputDieEntry->getTag() == dwarf::DW_TAG_compile_unit) { in cloneScalarAttr()
462 std::optional<uint64_t> LowPC = OutUnit.getAsCompileUnit()->getLowPc(); in cloneScalarAttr()
466 Value = OutUnit.getAsCompileUnit()->getHighPc() - *LowPC; in cloneScalarAttr()
467 } else if (AttrSpec.Form == dwarf::DW_FORM_sec_offset) in cloneScalarAttr()
469 else if (AttrSpec.Form == dwarf::DW_FORM_sdata) in cloneScalarAttr()
474 InUnit.warn("unsupported scalar attribute form. Dropping attribute.", in cloneScalarAttr()
484 InputDieEntry->getTag() == dwarf::DW_TAG_compile_unit}, in cloneScalarAttr()
488 dwarf::doesFormBelongToClass(AttrSpec.Form, in cloneScalarAttr()
504 &OutUnit->getOrCreateSectionDescriptor(DebugSectionKind::DebugAddr), in cloneScalarAttr()
511 .addScalarAttribute(AttrSpec.Attr, AttrSpec.Form, in cloneScalarAttr()
512 OutUnit->getDebugAddrHeaderSize()) in cloneScalarAttr()
531 // buffer using cloneExpression(), otherwise copy the data directly. in cloneBlockAttr()
537 DataExtractor Data(StringRef((const char *)Bytes.data(), Bytes.size()), in cloneBlockAttr() local
540 DWARFExpression Expr(Data, InUnit.getOrigUnit().getAddressByteSize(), in cloneBlockAttr()
548 // The expression location data might be updated and exceed the original size. in cloneBlockAttr()
549 // Check whether the new data fits into the original form. in cloneBlockAttr()
550 dwarf::Form ResultForm = AttrSpec.Form; in cloneBlockAttr()
557 if (AttrSpec.Form == dwarf::DW_FORM_exprloc) in cloneBlockAttr()
569 (AttrOutOffset + (FinalAttributeSize - Bytes.size())); in cloneBlockAttr()
588 .addScalarAttribute(AttrSpec.Attr, AttrSpec.Form, Val.getRawUValue()) in cloneAddressAttr()
596 // - If high_pc is an address (Dwarf version == 2), then it might have been in cloneAddressAttr()
600 // - If address relocated in an inline_subprogram that happens at the in cloneAddressAttr()
611 std::optional<uint64_t> Addr = AddrAttribute->getAsAddress(); in cloneAddressAttr()
617 if (InputDieEntry->getTag() == dwarf::DW_TAG_compile_unit && in cloneAddressAttr()
619 if (std::optional<uint64_t> LowPC = OutUnit.getAsCompileUnit()->getLowPc()) in cloneAddressAttr()
623 } else if (InputDieEntry->getTag() == dwarf::DW_TAG_compile_unit && in cloneAddressAttr()
625 if (uint64_t HighPc = OutUnit.getAsCompileUnit()->getHighPc()) in cloneAddressAttr()
636 if (AttrSpec.Form == dwarf::DW_FORM_addr) { in cloneAddressAttr()
637 return Generator.addScalarAttribute(AttrSpec.Attr, AttrSpec.Form, *Addr) in cloneAddressAttr()
642 .addScalarAttribute(AttrSpec.Attr, dwarf::Form::DW_FORM_addrx, in cloneAddressAttr()
643 OutUnit.getAsCompileUnit()->getDebugAddrIndex(*Addr)) in cloneAddressAttr()