Lines Matching refs:Unit
166 /// Get the child of \a Context described by \a DIE in \a Unit. The
176 const DWARFDebugInfoEntryMinimal *DIE, CompileUnit &Unit,
182 /// \brief Stores all information relating to a compile unit, be it in
260 /// Mark every DIE in this unit as kept. This function also
265 /// \brief Compute the end offset for this unit. Must be
267 /// \returns the next unit offset (which is also the current
356 /// functions in this unit, associated with the PC offset to apply
361 /// all the unit's function addresses.
373 /// \brief Accelerator entries for the unit, both for the pub*
383 /// Is this unit subject to the ODR rule?
399 // The root DIE might be null, meaning that the Unit had nothing to
401 // unit header without any actual DIE.
407 /// \brief Keep track of a forward cross-cu reference from this unit
490 /// Unit into \p Sec. The data is provided in \p Names.
492 const CompileUnit &Unit,
511 /// \brief Emit the compilation unit header for \p Unit in the
516 void emitCompileUnitHeader(CompileUnit &Unit);
536 /// \brief Emit debug_aranges entries for \p Unit and if \p
539 void emitUnitRangesEntries(CompileUnit &Unit, bool DoRangesSection);
543 /// \brief Emit the debug_loc contribution for \p Unit by copying
546 void emitLocationsForUnit(const CompileUnit &Unit, DWARFContext &Dwarf);
557 /// \brief Emit the .debug_pubnames contribution for \p Unit.
558 void emitPubNamesForUnit(const CompileUnit &Unit);
560 /// \brief Emit the .debug_pubtypes contribution for \p Unit.
561 void emitPubTypesForUnit(const CompileUnit &Unit);
662 /// \brief Emit the compilation unit header for \p Unit in the
666 /// uint32_t Unit length (omiting this field)
672 void DwarfStreamer::emitCompileUnitHeader(CompileUnit &Unit) {
673 unsigned Version = Unit.getOrigUnit().getVersion();
679 Asm->EmitInt32(Unit.getNextUnitOffset() - Unit.getStartOffset() - 4);
684 Asm->EmitInt8(Unit.getOrigUnit().getAddressByteSize());
748 /// \brief Emit the debug_aranges contribution of a unit and
752 /// Just aggregate all the ranges gathered inside that unit.
753 void DwarfStreamer::emitUnitRangesEntries(CompileUnit &Unit,
755 unsigned AddressSize = Unit.getOrigUnit().getAddressByteSize();
760 const auto &FunctionRanges = Unit.getFunctionRanges();
789 Asm->EmitInt32(Unit.getStartOffset()); // Corresponding unit's offset
815 int64_t PcOffset = -Unit.getLowPc();
831 /// \brief Emit location lists for \p Unit and update attribtues to
833 void DwarfStreamer::emitLocationsForUnit(const CompileUnit &Unit,
835 const auto &Attributes = Unit.getLocationAttributes();
842 unsigned AddressSize = Unit.getOrigUnit().getAddressByteSize();
845 DWARFUnit &OrigUnit = Unit.getOrigUnit();
851 UnitPcOffset = int64_t(OrigLowPc) - Unit.getLowPc();
892 // compilation unit (not including these 4 bytes for the length).
1026 /// Unit into \p Sec. The data is provided in \p Names.
1028 MCSection *Sec, StringRef SecName, const CompileUnit &Unit,
1039 // Emit the pubnames for this compilation unit.
1049 Asm->EmitInt32(Unit.getStartOffset()); // Unit offset
1050 Asm->EmitInt32(Unit.getNextUnitOffset() - Unit.getStartOffset()); // Size
1064 /// \brief Emit .debug_pubnames for \p Unit.
1065 void DwarfStreamer::emitPubNamesForUnit(const CompileUnit &Unit) {
1067 "names", Unit, Unit.getPubnames());
1070 /// \brief Emit .debug_pubtypes for \p Unit.
1071 void DwarfStreamer::emitPubTypesForUnit(const CompileUnit &Unit) {
1073 "types", Unit, Unit.getPubtypes());
1121 void reportWarning(const Twine &Warning, const DWARFUnit *Unit = nullptr,
1202 /// If this compile unit is really a skeleton CU that points to a
1209 const DWARFUnit &Unit, DebugMap &ModuleMap,
1239 CompileUnit &Unit, CompileUnit::DIEInfo &MyInfo,
1244 CompileUnit &Unit,
1249 CompileUnit &Unit,
1282 /// compile unit.
1338 const DWARFFormValue &Val, CompileUnit &Unit);
1351 const CompileUnit &Unit,
1383 /// \brief Compute and emit debug_ranges section for \p Unit, and
1385 void patchRangesForUnit(const CompileUnit &Unit, DWARFContext &Dwarf) const;
1389 void generateUnitRanges(CompileUnit &Unit) const;
1394 void patchLineTableForUnit(CompileUnit &Unit, DWARFContext &OrigDwarf);
1396 /// \brief Emit the accelerator entries for \p Unit.
1397 void emitAcceleratorEntriesForUnit(CompileUnit &Unit);
1430 unsigned UnitID; ///< A unique ID that identifies each compile unit.
1481 const DWARFFormValue &RefValue, const DWARFUnit &Unit,
1484 uint64_t RefOffset = *RefValue.getAsReference(&Unit);
1490 Linker.reportWarning("could not find referenced DIE", &Unit, &DIE);
1726 void DwarfLinker::reportWarning(const Twine &Warning, const DWARFUnit *Unit,
1737 DIE->dump(errs(), const_cast<DWARFUnit *>(Unit), 0 /* RecurseDepth */,
1750 /// gather the child->parent relationships in the original compile unit.
1841 // unit, with 2 notable differences:
1842 // - obviously this one is global, while the other ones are per-unit.
2007 unsigned Offset, const DWARFUnit &Unit) {
2008 DataExtractor Data = Unit.getDebugInfoExtractor();
2011 DWARFFormValue::skipValue(Abbrev->getFormByIndex(i), Data, &Offset, &Unit);
2014 DWARFFormValue::skipValue(Abbrev->getFormByIndex(Idx), Data, &End, &Unit);
2023 CompileUnit &Unit,
2040 const DWARFUnit &OrigUnit = Unit.getOrigUnit();
2064 const DWARFDebugInfoEntryMinimal &DIE, CompileUnit &Unit,
2075 const DWARFUnit &OrigUnit = Unit.getOrigUnit();
2109 Unit.addFunctionRange(LowPc, HighPc, MyInfo.AddrAdjust);
2117 CompileUnit &Unit,
2123 return shouldKeepVariableDIE(RelocMgr, DIE, Unit, MyInfo, Flags);
2125 return shouldKeepSubprogramDIE(RelocMgr, DIE, Unit, MyInfo, Flags);
2150 const DWARFUnit &Unit = CU.getOrigUnit();
2157 lookForDIEsToKeep(RelocMgr, *Unit.getDIEAtIndex(AncestorIdx), DMO, CU,
2164 DataExtractor Data = Unit.getDebugInfoExtractor();
2173 DWARFFormValue::skipValue(AttrSpec.Form, Data, &Offset, &Unit);
2177 Val.extractValue(Data, &Offset, &Unit);
2181 Unit, Die, ReferencedCU)) {
2309 CompileUnit &Unit) {
2310 const DWARFUnit &U = Unit.getOrigUnit();
2347 (Unit.hasODR() && isODRAttribute(AttrSpec.Attr))) {
2350 // to find the unit offset. (We don't have a DwarfDebug)
2364 Unit.noteForwardReference(
2422 const CompileUnit &Unit, AttributesInfo &Info) {
2423 uint64_t Addr = *Val.getAsAddress(&Unit.getOrigUnit());
2434 Addr = Unit.getLowPc();
2441 if (uint64_t HighPc = Unit.getHighPc())
2454 return Unit.getOrigUnit().getAddressByteSize();
2458 DIE &Die, const DWARFDebugInfoEntryMinimal &InputDIE, CompileUnit &Unit,
2464 if (Unit.getLowPc() == -1ULL)
2467 Value = Unit.getHighPc() - Unit.getLowPc();
2477 &Unit.getOrigUnit(), &InputDIE);
2484 Unit.noteRangeAttribute(Die, Patch);
2491 Unit.noteLocationAttribute(Patch, Info.PCOffset);
2502 DIE &Die, const DWARFDebugInfoEntryMinimal &InputDIE, CompileUnit &Unit,
2505 const DWARFUnit &U = Unit.getOrigUnit();
2517 Unit);
2525 return cloneAddressAttribute(Die, AttrSpec, Val, Unit, Info);
2535 return cloneScalarAttribute(Die, InputDIE, Unit, AttrSpec, Val, AttrSize,
2649 const DWARFDebugInfoEntryMinimal &InputDIE, CompileUnit &Unit,
2651 DWARFUnit &U = Unit.getOrigUnit();
2653 CompileUnit::DIEInfo &Info = Unit.getInfo(Idx);
2656 if (!Unit.getInfo(Idx).Keep)
2667 if ((Unit.hasODR() || Unit.isClangModule()) &&
2669 Info.Ctxt != Unit.getInfo(Info.ParentIdx).Ctxt &&
2674 Info.Ctxt->setCanonicalDIEOffset(OutOffset + Unit.getStartOffset());
2681 // DW_TAG_compile_unit without any children, point to the next unit.
2738 copyAbbrev(*InputDIE.getAbbreviationDeclarationPtr(), Unit.hasODR());
2750 cloneAttribute(*Die, InputDIE, Unit, Val, AttrSpec, AttrSize, AttrInfo);
2760 getDIENames(InputDIE, Unit.getOrigUnit(), AttrInfo)) {
2762 Unit.addNameAccelerator(Die, AttrInfo.MangledName,
2766 Unit.addNameAccelerator(Die, AttrInfo.Name, AttrInfo.NameOffset,
2769 getDIENames(InputDIE, Unit.getOrigUnit(), AttrInfo)) {
2770 Unit.addTypeAccelerator(Die, AttrInfo.Name, AttrInfo.NameOffset);
2778 if (Unit.getInfo(Idx).Keep) {
2803 if (DIE *Clone = cloneDIE(*Child, Unit, PCOffset, OutOffset, Flags)) {
2819 void DwarfLinker::patchRangesForUnit(const CompileUnit &Unit,
2822 const auto &FunctionRanges = Unit.getFunctionRanges();
2823 unsigned AddressSize = Unit.getOrigUnit().getAddressByteSize();
2827 DWARFUnit &OrigUnit = Unit.getOrigUnit();
2831 // Ranges addresses are based on the unit's low_pc. Compute the
2832 // offset we need to apply to adapt to the new unit's low_pc.
2835 UnitPcOffset = int64_t(OrigLowPc) - Unit.getLowPc();
2837 for (const auto &RangeAttribute : Unit.getRangesAttributes()) {
2862 /// \brief Generate the debug_aranges entries for \p Unit and if the
2863 /// unit has a DW_AT_ranges attribute, also emit the debug_ranges
2868 void DwarfLinker::generateUnitRanges(CompileUnit &Unit) const {
2869 auto Attr = Unit.getUnitRangesAttribute();
2872 Streamer->emitUnitRangesEntries(Unit, static_cast<bool>(Attr));
2919 /// \brief Extract the line table for \p Unit from \p OrigDwarf, and
2922 void DwarfLinker::patchLineTableForUnit(CompileUnit &Unit,
2924 const DWARFDebugInfoEntryMinimal *CUDie = Unit.getOrigUnit().getUnitDIE();
2926 &Unit.getOrigUnit(), dwarf::DW_AT_stmt_list, -1ULL);
2931 if (auto *OutputDIE = Unit.getOutputUnitDIE())
2934 // Parse the original line info for the unit.
2939 Unit.getOrigUnit().getAddressByteSize());
2950 const auto &FunctionRanges = Unit.getFunctionRanges();
3047 Unit.getOrigUnit().getAddressByteSize());
3051 void DwarfLinker::emitAcceleratorEntriesForUnit(CompileUnit &Unit) {
3052 Streamer->emitPubNamesForUnit(Unit);
3053 Streamer->emitPubTypesForUnit(Unit);
3157 const DWARFUnit &Unit) {
3159 CUDie.getAttributeValueAsUnsignedConstant(&Unit, dwarf::DW_AT_dwo_id, 0);
3161 DwoId = CUDie.getAttributeValueAsUnsignedConstant(&Unit,
3167 const DWARFDebugInfoEntryMinimal &CUDie, const DWARFUnit &Unit,
3170 CUDie.getAttributeValueAsString(&Unit, dwarf::DW_AT_dwo_name, "");
3173 CUDie.getAttributeValueAsString(&Unit, dwarf::DW_AT_GNU_dwo_name, "");
3179 CUDie.getAttributeValueAsString(&Unit, dwarf::DW_AT_comp_dir, "");
3180 uint64_t DwoId = getDwoId(CUDie, Unit);
3183 CUDie.getAttributeValueAsString(&Unit, dwarf::DW_AT_name, "");
3245 std::unique_ptr<CompileUnit> Unit;
3254 if (Unit) {
3256 << " 1 compile unit.\n";
3265 Unit = llvm::make_unique<CompileUnit>(*CU, UnitID++, !Options.NoODR,
3267 Unit->setHasInterestingContent();
3268 analyzeContextInfo(CUDie, 0, *Unit, &ODRContexts.getRoot(), StringPool,
3271 Unit->markEverythingAsKept();
3279 DIECloner(*this, RelocMgr, DIEAlloc, MutableArrayRef<CompileUnit>(*Unit),
3293 11 /* Unit Header size */, 0);
3299 // an empty line table for the unit, even if the unit doesn't
3312 // Emit all the compile unit's debug information.
3330 // A unique ID that identifies each compile unit.
3359 outs() << "Input compilation unit:";