Lines Matching +full:unit +full:- +full:addresses

1 //=== DWARFLinker.cpp -----------------------------------------------------===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
55 for (auto &Unit : Dwarf.compile_units()) { in getDebugInfoSize() local
56 Size += Unit->getLength(); in getDebugInfoSize()
66 return LHS < RHS->getOrigUnit().getNextUnitOffset(); in getUnitForOffset()
68 return CU != Units.end() ? CU->get() : nullptr; in getUnitForOffset()
82 RefOffset = RefValue.getUnit()->getOffset() + *Off; in resolveDIEReference()
90 if (const auto RefDie = RefCU->getOrigUnit().getDIEForOffset(RefOffset)) { in resolveDIEReference()
282 Info.Prune &= Info.Ctxt && Info.Ctxt->getCanonicalDIEOffset(); in updatePruning()
284 Info.Prune &= Info.Ctxt && Info.Ctxt->getCanonicalDIEOffset() > 0 && in updatePruning()
285 Info.Ctxt->getCanonicalDIEOffset() <= ModulesEndOffset; in updatePruning()
297 /// gather the child->parent relationships in the original compile unit.
333 // "The module-id should consist of only a single identifier, in analyzeContextInfo()
343 // We treat non-C++ modules like namespaces for this reason. in analyzeContextInfo()
363 Info.Ctxt->setDefinedInClangModule(Info.InModuleScope); in analyzeContextInfo()
402 I->~DIEBlock(); in cleanupAuxiliarryData()
404 I->~DIELoc(); in cleanupAuxiliarryData()
428 Abbrev->findAttributeIndex(dwarf::DW_AT_location); in getVariableRelocAdjustment()
434 Abbrev->getAttributeOffsetFromIndex(*LocationIdx, DIE.getOffset(), *U); in getVariableRelocAdjustment()
438 Abbrev->getAttributeValueFromOffset(*LocationIdx, AttrOffset, *U); in getVariableRelocAdjustment()
445 std::optional<ArrayRef<uint8_t>> Expr = LocationValue->getAsBlock(); in getVariableRelocAdjustment()
450 DataExtractor Data(toStringRef(*Expr), U->getContext().isLittleEndian(), in getVariableRelocAdjustment()
451 U->getAddressByteSize()); in getVariableRelocAdjustment()
452 DWARFExpression Expression(Data, U->getAddressByteSize(), in getVariableRelocAdjustment()
453 U->getFormParams().Format); in getVariableRelocAdjustment()
470 if (NextIt == Expression.end() || !isTlsAddressCode(NextIt->getCode())) in getVariableRelocAdjustment()
486 DIE.getDwarfUnit()->getIndexedAddressOffset( in getVariableRelocAdjustment()
492 *AddressOffset + DIE.getDwarfUnit()->getAddressByteSize(), in getVariableRelocAdjustment()
517 Abbrev->findAttributeIndex(dwarf::DW_AT_const_value)) { in shouldKeepVariableDIE()
558 CompileUnit &Unit, CompileUnit::DIEInfo &MyInfo, unsigned Flags) { in shouldKeepSubprogramDIE() argument
583 if (Unit.hasLabelAt(*LowPc)) in shouldKeepSubprogramDIE()
586 DWARFUnit &OrigUnit = Unit.getOrigUnit(); in shouldKeepSubprogramDIE()
587 // FIXME: dsymutil-classic compat. dsymutil-classic doesn't consider labels in shouldKeepSubprogramDIE()
594 Unit.addLabelLowPc(*LowPc, MyInfo.AddrAdjust); in shouldKeepSubprogramDIE()
613 Unit.addFunctionRange(*LowPc, *HighPc, MyInfo.AddrAdjust); in shouldKeepSubprogramDIE()
620 const DWARFFile &File, CompileUnit &Unit, in shouldKeepDIE() argument
629 return shouldKeepSubprogramDIE(RelocMgr, DIE, File, Unit, MyInfo, Flags); in shouldKeepDIE()
737 !Info.Ctxt->hasCanonicalDIE()) in markODRCanonicalDie()
738 Info.Ctxt->setHasCanonicalDIE(); in markODRCanonicalDie()
750 DWARFUnit &Unit = CU.getOrigUnit(); in lookForRefDIEsToKeep() local
751 DWARFDataExtractor Data = Unit.getDebugInfoExtractor(); in lookForRefDIEsToKeep()
753 uint64_t Offset = Die.getOffset() + getULEB128Size(Abbrev->getCode()); in lookForRefDIEsToKeep()
756 for (const auto &AttrSpec : Abbrev->attributes()) { in lookForRefDIEsToKeep()
761 Unit.getFormParams()); in lookForRefDIEsToKeep()
765 Val.extractValue(Data, &Offset, Unit.getFormParams(), &Unit); in lookForRefDIEsToKeep()
769 CompileUnit::DIEInfo &Info = ReferencedCU->getInfo(RefDie); in lookForRefDIEsToKeep()
774 // FIXME: compatibility with dsymutil-classic. UseODR shouldn't in lookForRefDIEsToKeep()
776 // ReferencedCU->hasODR() && CU.hasODR(). in lookForRefDIEsToKeep()
778 // FIXME: compatibility with dsymutil-classic. There is no in lookForRefDIEsToKeep()
782 Info.Ctxt->hasCanonicalDIE()) in lookForRefDIEsToKeep()
787 Info.Ctxt->hasCanonicalDIE())) in lookForRefDIEsToKeep()
817 DWARFUnit &Unit = CU.getOrigUnit(); in lookForParentDIEsToKeep() local
818 DWARFDie ParentDIE = Unit.getDIEAtIndex(AncestorIdx); in lookForParentDIEsToKeep()
1020 Abbrev.setNumber(InSet->getNumber()); in assignAbbrev()
1026 Abbreviations.back()->AddAttribute(Attr); in assignAbbrev()
1030 Abbreviations.back()->setNumber(Abbreviations.size()); in assignAbbrev()
1051 ObjFile.Addresses->getLibraryInstallName()) { in cloneStringAttribute()
1069 ->sizeOf(U.getFormParams()); in cloneStringAttribute()
1082 CompileUnit &Unit) { in cloneDieReferenceAttribute() argument
1083 const DWARFUnit &U = Unit.getOrigUnit(); in cloneDieReferenceAttribute()
1086 Ref = Val.getUnit()->getOffset() + *Off; in cloneDieReferenceAttribute()
1102 CompileUnit::DIEInfo &RefInfo = RefUnit->getInfo(RefDie); in cloneDieReferenceAttribute()
1107 RefInfo.Ctxt->getCanonicalDIEOffset()) { in cloneDieReferenceAttribute()
1108 assert(RefInfo.Ctxt->hasCanonicalDIE() && in cloneDieReferenceAttribute()
1110 DIEInteger Attr(RefInfo.Ctxt->getCanonicalDIEOffset()); in cloneDieReferenceAttribute()
1125 (Unit.hasODR() && isODRAttribute(AttrSpec.Attr))) { in cloneDieReferenceAttribute()
1128 // to find the unit offset. (We don't have a DwarfDebug) in cloneDieReferenceAttribute()
1135 RefUnit->getStartOffset() + NewRefDie->getOffset(); in cloneDieReferenceAttribute()
1142 Unit.noteForwardReference( in cloneDieReferenceAttribute()
1158 CompileUnit &Unit, SmallVectorImpl<uint8_t> &OutputBuffer, in cloneExpression() argument
1162 uint8_t OrigAddressByteSize = Unit.getOrigUnit().getAddressByteSize(); in cloneExpression()
1167 // DW_OP_const_type is variable-length and has 3 in cloneExpression()
1177 // This code assumes that the other non-typeref operand fits into 1 byte. in cloneExpression()
1179 uint32_t ULEBsize = Op.getEndOffset() - OpOffset - 1; in cloneExpression()
1197 RefOffset += Unit.getOrigUnit().getOffset(); in cloneExpression()
1198 auto RefDie = Unit.getOrigUnit().getDIEForOffset(RefOffset); in cloneExpression()
1199 CompileUnit::DIEInfo &Info = Unit.getInfo(RefDie); in cloneExpression()
1201 Offset = Clone->getOffset(); in cloneExpression()
1218 Unit.getOrigUnit().getAddrOffsetSectionItem( in cloneExpression()
1221 // addresses. Replace DW_OP_addrx with DW_OP_addr here. in cloneExpression()
1225 uint64_t LinkedAddress = SA->Address + AddrRelocAdjustment; in cloneExpression()
1236 Unit.getOrigUnit().getAddrOffsetSectionItem( in cloneExpression()
1239 // addresses. Replace DW_OP_constx with DW_OP_const[*]u here. in cloneExpression()
1259 uint64_t LinkedAddress = SA->Address + AddrRelocAdjustment; in cloneExpression()
1280 CompileUnit &Unit, AttributeSpec AttrSpec, const DWARFFormValue &Val, in cloneBlockAttribute() argument
1296 DWARFUnit &OrigUnit = Unit.getOrigUnit(); in cloneBlockAttribute()
1308 cloneExpression(Data, Expr, File, Unit, Buffer, in cloneBlockAttribute()
1309 Unit.getInfo(InputDIE).AddrAdjust, IsLittleEndian); in cloneBlockAttribute()
1313 Attr->addValue(DIEAlloc, static_cast<dwarf::Attribute>(0), in cloneBlockAttribute()
1318 // Attr->setSize(Bytes.size()). in cloneBlockAttribute()
1320 Loc->setSize(Bytes.size()); in cloneBlockAttribute()
1322 Block->setSize(Bytes.size()); in cloneBlockAttribute()
1341 return Die.addValue(DIEAlloc, Value)->sizeOf(OrigUnit.getFormParams()); in cloneBlockAttribute()
1346 unsigned AttrSize, const DWARFFormValue &Val, const CompileUnit &Unit, in cloneAddressAttribute() argument
1359 // - If high_pc is an address (Dwarf version == 2), then it might have been in cloneAddressAttribute()
1363 // - If address relocated in an inline_subprogram that happens at the in cloneAddressAttribute()
1373 std::optional<uint64_t> Addr = AddrAttribute->getAsAddress(); in cloneAddressAttribute()
1381 if (std::optional<uint64_t> LowPC = Unit.getLowPc()) in cloneAddressAttribute()
1387 if (uint64_t HighPc = Unit.getHighPc()) in cloneAddressAttribute()
1398 return Unit.getOrigUnit().getAddressByteSize(); in cloneAddressAttribute()
1406 ->sizeOf(Unit.getOrigUnit().getFormParams()); in cloneAddressAttribute()
1411 CompileUnit &Unit, AttributeSpec AttrSpec, const DWARFFormValue &Val, in cloneScalarAttribute() argument
1419 const llvm::DWARFDebugMacro *Macro = File.Dwarf->getDebugMacinfo(); in cloneScalarAttribute()
1420 if (Macro == nullptr || !Macro->hasEntryForOffset(*Offset)) in cloneScalarAttribute()
1427 const llvm::DWARFDebugMacro *Macro = File.Dwarf->getDebugMacro(); in cloneScalarAttribute()
1428 if (Macro == nullptr || !Macro->hasEntryForOffset(*Offset)) in cloneScalarAttribute()
1441 ->sizeOf(Unit.getOrigUnit().getFormParams()); in cloneScalarAttribute()
1481 Unit.getOrigUnit().getRnglistOffset(*Index); in cloneScalarAttribute()
1490 AttrSize = Unit.getOrigUnit().getFormParams().getDwarfOffsetByteSize(); in cloneScalarAttribute()
1502 Unit.getOrigUnit().getLoclistOffset(*Index); in cloneScalarAttribute()
1511 AttrSize = Unit.getOrigUnit().getFormParams().getDwarfOffsetByteSize(); in cloneScalarAttribute()
1514 std::optional<uint64_t> LowPC = Unit.getLowPc(); in cloneScalarAttribute()
1518 Value = Unit.getHighPc() - *LowPC; in cloneScalarAttribute()
1537 Unit.noteRangeAttribute(Die, Patch); in cloneScalarAttribute()
1542 Unit.getOrigUnit().getVersion())) { in cloneScalarAttribute()
1544 CompileUnit::DIEInfo &LocationDieInfo = Unit.getInfo(InputDIE); in cloneScalarAttribute()
1545 Unit.noteLocationAttribute({Patch, LocationDieInfo.InDebugMap in cloneScalarAttribute()
1563 CompileUnit &Unit, const DWARFFormValue &Val, const AttributeSpec AttrSpec, in cloneAttribute() argument
1565 const DWARFUnit &U = Unit.getOrigUnit(); in cloneAttribute()
1583 File, Unit); in cloneAttribute()
1589 return cloneBlockAttribute(Die, InputDIE, File, Unit, AttrSpec, Val, in cloneAttribute()
1597 return cloneAddressAttribute(Die, InputDIE, AttrSpec, AttrSize, Val, Unit, in cloneAttribute()
1611 return cloneScalarAttribute(Die, InputDIE, File, Unit, AttrSpec, Val, in cloneAttribute()
1623 void DWARFLinker::DIECloner::addObjCAccelerator(CompileUnit &Unit, in addObjCAccelerator() argument
1632 Unit.addNameAccelerator(Die, StringPool.getEntry(Names->Selector), in addObjCAccelerator()
1634 Unit.addObjCAccelerator(Die, StringPool.getEntry(Names->ClassName), in addObjCAccelerator()
1636 if (Names->ClassNameNoCategory) in addObjCAccelerator()
1637 Unit.addObjCAccelerator( in addObjCAccelerator()
1638 Die, StringPool.getEntry(*Names->ClassNameNoCategory), SkipPubSection); in addObjCAccelerator()
1639 if (Names->MethodNameNoCategory) in addObjCAccelerator()
1640 Unit.addNameAccelerator( in addObjCAccelerator()
1641 Die, StringPool.getEntry(*Names->MethodNameNoCategory), SkipPubSection); in addObjCAccelerator()
1680 const DWARFFile &File, CompileUnit &Unit, in cloneDIE() argument
1684 DWARFUnit &U = Unit.getOrigUnit(); in cloneDIE()
1686 CompileUnit::DIEInfo &Info = Unit.getInfo(Idx); in cloneDIE()
1689 if (!Unit.getInfo(Idx).Keep) in cloneDIE()
1702 assert(Die->getTag() == InputDIE.getTag()); in cloneDIE()
1703 Die->setOffset(OutOffset); in cloneDIE()
1704 if (isODRCanonicalCandidate(InputDIE, Unit) && Info.Ctxt && in cloneDIE()
1705 (Info.Ctxt->getCanonicalDIEOffset() == 0)) { in cloneDIE()
1706 if (!Info.Ctxt->hasCanonicalDIE()) in cloneDIE()
1707 Info.Ctxt->setHasCanonicalDIE(); in cloneDIE()
1711 Info.Ctxt->setCanonicalDIEOffset(OutOffset + Unit.getStartOffset()); in cloneDIE()
1718 // DW_TAG_compile_unit without any children, point to the next unit. in cloneDIE()
1727 SmallString<40> DIECopy(Data.getData().substr(Offset, NextOffset - Offset)); in cloneDIE()
1731 // Modify the copy with relocated addresses. in cloneDIE()
1732 ObjFile.Addresses->applyValidRelocs(DIECopy, Offset, Data.isLittleEndian()); in cloneDIE()
1739 Offset += getULEB128Size(Abbrev->getCode()); in cloneDIE()
1742 if (Die->getTag() == dwarf::DW_TAG_subprogram) in cloneDIE()
1746 if (Abbrev->getTag() == dwarf::DW_TAG_subprogram) { in cloneDIE()
1750 } else if (Abbrev->getTag() == dwarf::DW_TAG_variable) { in cloneDIE()
1751 // Function-local globals could be in the debug map even when the function in cloneDIE()
1763 ObjFile.Addresses->getLibraryInstallName(); in cloneDIE()
1765 for (const auto &AttrSpec : Abbrev->attributes()) { in cloneDIE()
1775 Unit.getStartOffset() + OutOffset - CurAttrFixup.InputAttrStartOffset; in cloneDIE()
1781 AttrSize = Offset - AttrSize; in cloneDIE()
1784 cloneAttribute(*Die, InputDIE, File, Unit, Val, AttrSpec, AttrSize, in cloneDIE()
1786 if (FinalAttrSize != 0 && ObjFile.Addresses->needToSaveValidRelocs()) in cloneDIE()
1793 // Add the DW_AT_APPLE_origin attribute to Compile Unit die if we have in cloneDIE()
1800 Die->addValue(DIEAlloc, dwarf::Attribute(dwarf::DW_AT_APPLE_origin), in cloneDIE()
1815 Unit.addNameAccelerator(Die, AttrInfo.MangledName, in cloneDIE()
1819 Unit.addNameAccelerator(Die, AttrInfo.NameWithoutTemplate, in cloneDIE()
1821 Unit.addNameAccelerator(Die, AttrInfo.Name, in cloneDIE()
1825 addObjCAccelerator(Unit, Die, AttrInfo.Name, DebugStrPool, in cloneDIE()
1831 Unit.addNamespaceAccelerator(Die, AttrInfo.Name); in cloneDIE()
1833 Unit.addNamespaceAccelerator(Die, AttrInfo.Name); in cloneDIE()
1837 uint32_t Hash = hashFullyQualifiedName(InputDIE, Unit, File); in cloneDIE()
1846 Unit.addTypeAccelerator(Die, AttrInfo.Name, ObjCClassIsImplementation, in cloneDIE()
1854 if (Unit.getInfo(Idx).Keep) { in cloneDIE()
1860 if (Unit.getOrigUnit().getVersion() >= 5 && !AttrInfo.AttrStrOffsetBaseSeen && in cloneDIE()
1861 Die->getTag() == dwarf::DW_TAG_compile_unit) { in cloneDIE()
1863 Die->addValue(DIEAlloc, dwarf::DW_AT_str_offsets_base, in cloneDIE()
1868 DIEAbbrev NewAbbrev = Die->generateAbbrev(); in cloneDIE()
1873 Die->setAbbrevNumber(NewAbbrev.getNumber()); in cloneDIE()
1875 uint64_t AbbrevNumberSize = getULEB128Size(Die->getAbbrevNumber()); in cloneDIE()
1885 ObjFile.Addresses->updateAndSaveValidRelocs( in cloneDIE()
1886 Unit.getOrigUnit().getVersion() >= 5, Unit.getOrigUnit().getOffset(), in cloneDIE()
1891 Die->setSize(OutOffset - Die->getOffset()); in cloneDIE()
1897 if (DIE *Clone = cloneDIE(Child, File, Unit, PCOffset, OutOffset, Flags, in cloneDIE()
1899 Die->addChild(Clone); in cloneDIE()
1900 OutOffset = Clone->getOffset() + Clone->getSize(); in cloneDIE()
1907 Die->setSize(OutOffset - Die->getOffset()); in cloneDIE()
1914 void DWARFLinker::generateUnitRanges(CompileUnit &Unit, const DWARFFile &File, in generateUnitRanges() argument
1919 const auto &FunctionRanges = Unit.getFunctionRanges(); in generateUnitRanges()
1921 // Build set of linked address ranges for unit function ranges. in generateUnitRanges()
1929 TheDwarfEmitter->emitDwarfDebugArangesTable(Unit, LinkedFunctionRanges); in generateUnitRanges()
1931 RngListAttributesTy AllRngListAttributes = Unit.getRangesAttributes(); in generateUnitRanges()
1933 Unit.getUnitRangesAttribute(); in generateUnitRanges()
1937 MCSymbol *EndLabel = TheDwarfEmitter->emitDwarfDebugRangeListHeader(Unit); in generateUnitRanges()
1946 Unit.getOrigUnit().findRnglistFromOffset(AttributePatch.get())) { in generateUnitRanges()
1949 if (!CachedRange || !CachedRange->Range.contains(Range.LowPC)) in generateUnitRanges()
1959 LinkedRanges.insert({Range.LowPC + CachedRange->Value, in generateUnitRanges()
1960 Range.HighPC + CachedRange->Value}); in generateUnitRanges()
1968 TheDwarfEmitter->emitDwarfDebugRangeListFragment( in generateUnitRanges()
1969 Unit, LinkedRanges, AttributePatch, AddrPool); in generateUnitRanges()
1972 // Emit ranges for Unit AT_ranges attribute. in generateUnitRanges()
1974 TheDwarfEmitter->emitDwarfDebugRangeListFragment( in generateUnitRanges()
1975 Unit, LinkedFunctionRanges, *UnitRngListAttribute, AddrPool); in generateUnitRanges()
1978 TheDwarfEmitter->emitDwarfDebugRangeListFooter(Unit, EndLabel); in generateUnitRanges()
1983 CompileUnit &Unit, const DWARFFile &File, in generateUnitLocations() argument
1989 Unit.getLocationAttributes(); in generateUnitLocations()
1995 MCSymbol *EndLabel = Emitter->emitDwarfDebugLocListHeader(Unit); in generateUnitLocations()
2001 Unit.getOrigUnit().findLoclistFromOffset(CurLocAttr.get()); in generateUnitLocations()
2016 CurExpression.Range->LowPC + CurLocAttr.RelocAdjustment, in generateUnitLocations()
2017 CurExpression.Range->HighPC + CurLocAttr.RelocAdjustment}; in generateUnitLocations()
2029 Emitter->emitDwarfDebugLocListFragment(Unit, LinkedLocationExpressions, in generateUnitLocations()
2034 Emitter->emitDwarfDebugLocListFooter(Unit, EndLabel); in generateUnitLocations()
2048 CompileUnit &Unit, const uint16_t DwarfVersion) const { in emitDebugAddrSection() argument
2059 MCSymbol *EndLabel = Emitter->emitDwarfDebugAddrsHeader(Unit); in emitDebugAddrSection()
2060 patchAddrBase(*Unit.getOutputUnitDIE(), in emitDebugAddrSection()
2061 DIEInteger(Emitter->getDebugAddrSectionSize())); in emitDebugAddrSection()
2062 Emitter->emitDwarfDebugAddrs(AddrPool.getValues(), in emitDebugAddrSection()
2063 Unit.getOrigUnit().getAddressByteSize()); in emitDebugAddrSection()
2064 Emitter->emitDwarfDebugAddrsFooter(Unit, EndLabel); in emitDebugAddrSection()
2088 if (InsertPoint != Rows.end() && InsertPoint->Address == Front && in insertLineSequence()
2089 InsertPoint->EndSequence) { in insertLineSequence()
2109 void DWARFLinker::DIECloner::rememberUnitForMacroOffset(CompileUnit &Unit) { in rememberUnitForMacroOffset() argument
2110 DWARFUnit &OrigUnit = Unit.getOrigUnit(); in rememberUnitForMacroOffset()
2115 UnitMacroMap.insert(std::make_pair(*MacroAttr, &Unit)); in rememberUnitForMacroOffset()
2121 UnitMacroMap.insert(std::make_pair(*MacroAttr, &Unit)); in rememberUnitForMacroOffset()
2126 void DWARFLinker::DIECloner::generateLineTableForUnit(CompileUnit &Unit) { in generateLineTableForUnit() argument
2131 DWARFDie CUDie = Unit.getOrigUnit().getUnitDIE(); in generateLineTableForUnit()
2137 if (auto *OutputDIE = Unit.getOutputUnitDIE()) in generateLineTableForUnit()
2138 patchStmtList(*OutputDIE, DIEInteger(Emitter->getLineSectionSize())); in generateLineTableForUnit()
2141 ObjFile.Dwarf->getLineTableForUnit(&Unit.getOrigUnit())) { in generateLineTableForUnit()
2146 LineTable.Prologue = LT->Prologue; in generateLineTableForUnit()
2150 LineTable.Rows = LT->Rows; in generateLineTableForUnit()
2156 LineTable.Sequences = LT->Sequences; in generateLineTableForUnit()
2160 NewRows.reserve(LT->Rows.size()); in generateLineTableForUnit()
2166 const auto &FunctionRanges = Unit.getFunctionRanges(); in generateLineTableForUnit()
2180 for (DWARFDebugLine::Row Row : LT->Rows) { in generateLineTableForUnit()
2182 // half-open, but consider accept the end address of the range if in generateLineTableForUnit()
2186 if (!CurrRange || !CurrRange->Range.contains(Row.Address.Address)) { in generateLineTableForUnit()
2190 CurrRange ? CurrRange->Range.end() + CurrRange->Value : -1ULL; in generateLineTableForUnit()
2192 if (StopAddress != -1ULL && !Seq.empty()) { in generateLineTableForUnit()
2214 Row.Address.Address += CurrRange->Value; in generateLineTableForUnit()
2224 Emitter->emitLineTableForUnit(LineTable, Unit, DebugStrPool, in generateLineTableForUnit()
2230 void DWARFLinker::emitAcceleratorEntriesForUnit(CompileUnit &Unit) { in emitAcceleratorEntriesForUnit() argument
2235 for (const auto &Namespace : Unit.getNamespaces()) in emitAcceleratorEntriesForUnit()
2236 AppleNamespaces.addName(Namespace.Name, Namespace.Die->getOffset() + in emitAcceleratorEntriesForUnit()
2237 Unit.getStartOffset()); in emitAcceleratorEntriesForUnit()
2239 for (const auto &Pubname : Unit.getPubnames()) in emitAcceleratorEntriesForUnit()
2241 Pubname.Die->getOffset() + Unit.getStartOffset()); in emitAcceleratorEntriesForUnit()
2243 for (const auto &Pubtype : Unit.getPubtypes()) in emitAcceleratorEntriesForUnit()
2245 Pubtype.Name, Pubtype.Die->getOffset() + Unit.getStartOffset(), in emitAcceleratorEntriesForUnit()
2246 Pubtype.Die->getTag(), in emitAcceleratorEntriesForUnit()
2251 for (const auto &ObjC : Unit.getObjC()) in emitAcceleratorEntriesForUnit()
2253 ObjC.Die->getOffset() + Unit.getStartOffset()); in emitAcceleratorEntriesForUnit()
2256 TheDwarfEmitter->emitPubNamesForUnit(Unit); in emitAcceleratorEntriesForUnit()
2257 TheDwarfEmitter->emitPubTypesForUnit(Unit); in emitAcceleratorEntriesForUnit()
2260 for (const auto &Namespace : Unit.getNamespaces()) in emitAcceleratorEntriesForUnit()
2262 Namespace.Name, Namespace.Die->getOffset(), in emitAcceleratorEntriesForUnit()
2264 Namespace.Die->getTag(), Unit.getUniqueID(), in emitAcceleratorEntriesForUnit()
2265 Unit.getTag() == dwarf::DW_TAG_type_unit); in emitAcceleratorEntriesForUnit()
2266 for (const auto &Pubname : Unit.getPubnames()) in emitAcceleratorEntriesForUnit()
2268 Pubname.Name, Pubname.Die->getOffset(), in emitAcceleratorEntriesForUnit()
2270 Pubname.Die->getTag(), Unit.getUniqueID(), in emitAcceleratorEntriesForUnit()
2271 Unit.getTag() == dwarf::DW_TAG_type_unit); in emitAcceleratorEntriesForUnit()
2272 for (const auto &Pubtype : Unit.getPubtypes()) in emitAcceleratorEntriesForUnit()
2274 Pubtype.Name, Pubtype.Die->getOffset(), in emitAcceleratorEntriesForUnit()
2276 Pubtype.Die->getTag(), Unit.getUniqueID(), in emitAcceleratorEntriesForUnit()
2277 Unit.getTag() == dwarf::DW_TAG_type_unit); in emitAcceleratorEntriesForUnit()
2288 /// is to patch the addresses in the headers.
2298 for (std::unique_ptr<CompileUnit> &Unit : Context.CompileUnits) { in patchFrameInfoForObject()
2299 for (auto CurRange : Unit->getFunctionRanges()) in patchFrameInfoForObject()
2321 // The -4 is to account for the CIEId we just read. in patchFrameInfoForObject()
2322 InputOffset += InitialLength - 4; in patchFrameInfoForObject()
2350 std::make_pair(CIEData, TheDwarfEmitter->getFrameSectionSize())); in patchFrameInfoForObject()
2353 LastCIEOffset = TheDwarfEmitter->getFrameSectionSize(); in patchFrameInfoForObject()
2354 IteratorInserted.first->getValue() = LastCIEOffset; in patchFrameInfoForObject()
2355 TheDwarfEmitter->emitCIE(CIEData); in patchFrameInfoForObject()
2361 unsigned FDERemainingBytes = InitialLength - (4 + SrcAddrSize); in patchFrameInfoForObject()
2362 TheDwarfEmitter->emitFDE(IteratorInserted.first->getValue(), SrcAddrSize, in patchFrameInfoForObject()
2363 Loc + Range->Value, in patchFrameInfoForObject()
2386 if (!Ref->isFormClass(DWARFFormValue::FC_Reference)) in hashFullyQualifiedName()
2393 OrigUnit = &RefCU->getOrigUnit(); in hashFullyQualifiedName()
2398 unsigned Idx = OrigUnit->getDIEIndex(DIE); in hashFullyQualifiedName()
2402 if (CU->getInfo(Idx).ParentIdx == 0 || in hashFullyQualifiedName()
2403 // FIXME: dsymutil-classic compatibility. Ignore modules. in hashFullyQualifiedName()
2404 CU->getOrigUnit().getDIEAtIndex(CU->getInfo(Idx).ParentIdx).getTag() == in hashFullyQualifiedName()
2408 DWARFDie Die = OrigUnit->getDIEAtIndex(CU->getInfo(Idx).ParentIdx); in hashFullyQualifiedName()
2480 if (!Quiet && Options.Verbose && (Cached->second != DwoId)) in isClangModuleRef()
2535 // Don't use the cached binary holder because we have no thread-safety in loadClangModule()
2548 std::unique_ptr<CompileUnit> Unit; in loadClangModule() local
2549 for (const auto &CU : ErrOrObj->Dwarf->compile_units()) { in loadClangModule()
2552 auto ChildCUDie = CU->getUnitDIE(); in loadClangModule()
2557 if (Unit) { in loadClangModule()
2560 ": Clang modules are expected to have exactly 1 compile unit.\n"); in loadClangModule()
2580 Unit = std::make_unique<CompileUnit>(*CU, UniqueUnitID++, !Options.NoODR, in loadClangModule()
2585 if (Unit) in loadClangModule()
2586 Context.ModuleUnits.emplace_back(RefModuleUnit{*ErrOrObj, std::move(Unit)}); in loadClangModule()
2594 (Emitter == nullptr) ? 0 : Emitter->getDebugInfoSectionSize(); in cloneAllCompileUnits()
2598 const uint16_t DwarfVersion = CurrentUnit->getOrigUnit().getVersion(); in cloneAllCompileUnits()
2600 auto InputDIE = CurrentUnit->getOrigUnit().getUnitDIE(); in cloneAllCompileUnits()
2601 CurrentUnit->setStartOffset(OutputDebugInfoSize); in cloneAllCompileUnits()
2603 OutputDebugInfoSize = CurrentUnit->computeNextUnitOffset(DwarfVersion); in cloneAllCompileUnits()
2606 if (CurrentUnit->getInfo(0).Keep) { in cloneAllCompileUnits()
2607 // Clone the InputDIE into your Unit DIE in our compile unit since it in cloneAllCompileUnits()
2609 CurrentUnit->createOutputDIE(); in cloneAllCompileUnits()
2612 0, IsLittleEndian, CurrentUnit->getOutputUnitDIE()); in cloneAllCompileUnits()
2615 OutputDebugInfoSize = CurrentUnit->computeNextUnitOffset(DwarfVersion); in cloneAllCompileUnits()
2631 DWARFUnit &OrigUnit = CurrentUnit->getOrigUnit(); in cloneAllCompileUnits()
2649 Emitter->emitMacroTables(File.Dwarf.get(), UnitMacroMap, DebugStrPool); in cloneAllCompileUnits()
2651 // Emit all the compile unit's debug information. in cloneAllCompileUnits()
2653 CurrentUnit->fixupForwardReferences(); in cloneAllCompileUnits()
2655 if (!CurrentUnit->getOutputUnitDIE()) in cloneAllCompileUnits()
2658 unsigned DwarfVersion = CurrentUnit->getOrigUnit().getVersion(); in cloneAllCompileUnits()
2660 assert(Emitter->getDebugInfoSectionSize() == in cloneAllCompileUnits()
2661 CurrentUnit->getStartOffset()); in cloneAllCompileUnits()
2662 Emitter->emitCompileUnitHeader(*CurrentUnit, DwarfVersion); in cloneAllCompileUnits()
2663 Emitter->emitDIE(*CurrentUnit->getOutputUnitDIE()); in cloneAllCompileUnits()
2664 assert(Emitter->getDebugInfoSectionSize() == in cloneAllCompileUnits()
2665 CurrentUnit->computeNextUnitOffset(DwarfVersion)); in cloneAllCompileUnits()
2669 return OutputDebugInfoSize - StartOutputDebugInfoSize; in cloneAllCompileUnits()
2673 TheDwarfEmitter->emitSectionContents(Dwarf.getDWARFObj().getLocSection().Data, in copyInvariantDebugSection()
2675 TheDwarfEmitter->emitSectionContents( in copyInvariantDebugSection()
2678 TheDwarfEmitter->emitSectionContents( in copyInvariantDebugSection()
2680 TheDwarfEmitter->emitSectionContents(Dwarf.getDWARFObj().getArangesSection(), in copyInvariantDebugSection()
2682 TheDwarfEmitter->emitSectionContents( in copyInvariantDebugSection()
2684 TheDwarfEmitter->emitSectionContents( in copyInvariantDebugSection()
2687 TheDwarfEmitter->emitSectionContents( in copyInvariantDebugSection()
2698 ObjectContexts.back().File.Dwarf->compile_units()) { in addObjectFile()
2699 DWARFDie CUDie = CU->getUnitDIE(); in addObjectFile()
2746 !OptContext.File.Addresses->hasValidRelocs()) { in link()
2761 if (!OptContext.File.Dwarf->types_section_units().empty()) { in link()
2772 OptContext.File.Dwarf->getNumCompileUnits()); in link()
2773 for (const auto &CU : OptContext.File.Dwarf->compile_units()) { in link()
2774 auto CUDie = CU->getUnitDIE(/*ExtractUnitDIEOnly=*/true); in link()
2776 outs() << "Input compilation unit:"; in link()
2798 : TheDwarfEmitter->getDebugInfoSectionSize(); in link()
2807 // parallel with emitting the previous compile unit. in link()
2814 for (const auto &CU : Context.File.Dwarf->compile_units()) { in link()
2815 // Previously we only extracted the unit DIEs. We need the full debug info in link()
2817 auto CUDie = CU->getUnitDIE(/*ExtractUnitDIEOnly=*/false); in link()
2829 auto CUDie = CurrentUnit->getOrigUnit().getUnitDIE(); in link()
2832 analyzeContextInfo(CurrentUnit->getOrigUnit().getUnitDIE(), 0, in link()
2856 // cross-cu references require the ParentIdx to be setup for every CU in in link()
2860 CurrentUnit->markEverythingAsKept(); in link()
2864 lookForDIEsToKeep(*OptContext.File.Addresses, OptContext.CompileUnits, in link()
2865 CurrentUnit->getOrigUnit().getUnitDIE(), in link()
2876 if (OptContext.File.Addresses->hasValidRelocs() || in link()
2885 OptContext.File.Dwarf->isLittleEndian()); in link()
2891 // Clean-up before starting working on the next object. in link()
2898 TheDwarfEmitter->emitAbbrevs(Abbreviations, Options.TargetDWARFVersion); in link()
2899 TheDwarfEmitter->emitStrings(DebugStrPool); in link()
2900 TheDwarfEmitter->emitStringOffsets(StringOffsetPool.getValues(), in link()
2902 TheDwarfEmitter->emitLineStrings(DebugLineStrPool); in link()
2906 TheDwarfEmitter->emitAppleNamespaces(AppleNamespaces); in link()
2907 TheDwarfEmitter->emitAppleNames(AppleNames); in link()
2908 TheDwarfEmitter->emitAppleTypes(AppleTypes); in link()
2909 TheDwarfEmitter->emitAppleObjc(AppleObjc); in link()
2916 TheDwarfEmitter->emitDebugNames(DebugNames); in link()
2973 auto ComputePercentange = [](int64_t Input, int64_t Output) -> float { in link()
2974 const float Difference = Output - Input; in link()
2983 const char *FormatStr = "{0,-45} {1,10}b {2,10}b {3,8:P}\n"; in link()
2987 outs() << "----------------------------------------------------------------" in link()
2988 "---------------\n"; in link()
2991 outs() << "----------------------------------------------------------------" in link()
2992 "---------------\n"; in link()
3003 outs() << "----------------------------------------------------------------" in link()
3004 "---------------\n"; in link()
3007 outs() << "----------------------------------------------------------------" in link()
3008 "---------------\n\n"; in link()
3014 Error DWARFLinker::cloneModuleUnit(LinkContext &Context, RefModuleUnit &Unit, in cloneModuleUnit() argument
3020 assert(Unit.Unit.get() != nullptr); in cloneModuleUnit()
3022 if (!Unit.Unit->getOrigUnit().getUnitDIE().hasChildren()) in cloneModuleUnit()
3027 outs() << "cloning .debug_info from " << Unit.File.FileName << "\n"; in cloneModuleUnit()
3031 analyzeContextInfo(Unit.Unit->getOrigUnit().getUnitDIE(), 0, *(Unit.Unit), in cloneModuleUnit()
3038 Unit.Unit->markEverythingAsKept(); in cloneModuleUnit()
3040 // Clone unit. in cloneModuleUnit()
3042 CompileUnits.emplace_back(std::move(Unit.Unit)); in cloneModuleUnit()
3044 DIECloner(*this, TheDwarfEmitter, Unit.File, DIEAlloc, CompileUnits, in cloneModuleUnit()
3046 .cloneAllCompileUnits(*Unit.File.Dwarf, Unit.File, in cloneModuleUnit()
3047 Unit.File.Dwarf->isLittleEndian()); in cloneModuleUnit()
3057 if (!File.Dwarf->verify(OS, DumpOpts.noImplicitRecursion())) { in verifyInput()