14using namespace dwarf_linker;
15using namespace dwarf_linker::parallel;
23 DIEAbbrev *InSet = AbbreviationsSet.FindNodeOrInsertPos(
ID, InsertToken);
30 Abbreviations.push_back(
32 for (
const auto &Attr : Abbrev.
getData())
33 Abbreviations.back()->AddAttribute(Attr);
34 AbbreviationsSet.InsertNode(Abbreviations.back().get(), InsertToken);
37 Abbreviations.back()->setNumber(Abbreviations.size());
42 const std::vector<std::unique_ptr<DIEAbbrev>> &Abbrevs = getAbbreviations();
47 getOrCreateSectionDescriptor(DebugSectionKind::DebugAbbrev);
50 for (
const auto &Abbrev : Abbrevs)
51 emitDwarfAbbrevEntry(*Abbrev, AbbrevSection);
81 if (AttrData.getForm() == dwarf::DW_FORM_implicit_const)
91 DIE *OutUnitDIE = getOutUnitDIE();
92 if (OutUnitDIE ==
nullptr)
99 getOrCreateSectionDescriptor(DebugSectionKind::DebugInfo);
105 Emitter.emitCompileUnitHeader(*
this);
106 size_t OffsetToAbbreviationTableOffset =
107 (getFormParams().Version >= 5) ? 8 : 6;
109 OffsetToAbbreviationTableOffset,
110 &getOrCreateSectionDescriptor(DebugSectionKind::DebugAbbrev)});
125 return DebugLineEmitter.
emit(OutLineTable);
129 if (getVersion() < 5)
132 if (DebugStringIndexMap.empty())
136 getOrCreateSectionDescriptor(DebugSectionKind::DebugStrOffsets);
142 uint64_t OffsetAfterSectionLength = OutDebugStrOffsetsSection.
OS.
tell();
153 OutDebugStrOffsetsSection.notePatch(
157 OutDebugStrOffsetsSection.
emitOffset(0xBADDEF);
161 OutDebugStrOffsetsSection.
apply(
162 OffsetAfterSectionLength -
164 dwarf::DW_FORM_sec_offset,
165 OutDebugStrOffsetsSection.
OS.
tell() - OffsetAfterSectionLength);
172std::optional<uint64_t>
175 std::optional<uint64_t> LengthOffset) {
180 LengthOffset = OutSection.
OS.
tell();
186 &getOrCreateSectionDescriptor(DebugSectionKind::DebugInfo)});
201 std::optional<uint64_t> NamesLengthOffset;
202 std::optional<uint64_t> TypesLengthOffset;
205 if (
Info.AvoidForPubSections)
209 case DwarfUnit::AccelType::Name: {
210 NamesLengthOffset = emitPubAcceleratorEntry(
211 getOrCreateSectionDescriptor(DebugSectionKind::DebugPubNames), Info,
214 case DwarfUnit::AccelType::Type: {
215 TypesLengthOffset = emitPubAcceleratorEntry(
216 getOrCreateSectionDescriptor(DebugSectionKind::DebugPubTypes), Info,
225 if (NamesLengthOffset) {
227 getOrCreateSectionDescriptor(DebugSectionKind::DebugPubNames);
230 OutSection.
apply(*NamesLengthOffset -
232 dwarf::DW_FORM_sec_offset,
233 OutSection.
OS.
tell() - *NamesLengthOffset);
236 if (TypesLengthOffset) {
238 getOrCreateSectionDescriptor(DebugSectionKind::DebugPubTypes);
241 OutSection.
apply(*TypesLengthOffset -
243 dwarf::DW_FORM_sec_offset,
244 OutSection.
OS.
tell() - *TypesLengthOffset);
Analysis containing CSE Info
dxil DXContainer Global Emitter
Dwarf abbreviation data, describes one attribute of a Dwarf abbreviation.
Dwarf abbreviation, describes the organization of a debug information object.
unsigned getNumber() const
const SmallVectorImpl< DIEAbbrevData > & getData() const
dwarf::Tag getTag() const
Accessors.
void setNumber(unsigned N)
void Profile(FoldingSetNodeID &ID) const
Used to gather unique data for the abbreviation folding set.
A structured debug information entry.
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
FoldingSetNodeID - This class is used to gather all the unique data bits of a node.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
StringMapEntry - This is used to represent one value that is inserted into a StringMap.
Triple - Helper class for working with autoconf configuration names.
This class emits specified line table into the .debug_line section.
Error emit(const DWARFDebugLine::LineTable &LineTable)
This class emits DWARF data to the output stream.
void assignAbbrev(DIEAbbrev &Abbrev)
Adds Abbrev into unit`s abbreviation table.
std::optional< uint64_t > emitPubAcceleratorEntry(SectionDescriptor &OutSection, const AccelInfo &Info, std::optional< uint64_t > LengthOffset)
Emit single pubnames/pubtypes accelerator entry.
void emitDwarfAbbrevEntry(const DIEAbbrev &Abbrev, SectionDescriptor &AbbrevSection)
Emit single abbreviation entry.
uint64_t tell() const
tell - Return the current offset with the file.
Error emitDebugInfo(const Triple &TargetTriple)
Emit .debug_info section for unit DIEs.
Error emitDebugStringOffsetSection()
Emit the .debug_str_offsets section for current unit.
void emitPubAccelerators()
Emit .debug_pubnames and .debug_pubtypes for Unit.
Error emitAbbreviations()
Error emitDebugLine(const Triple &TargetTriple, const DWARFDebugLine::LineTable &OutLineTable)
Emit .debug_line section.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
uint8_t getDwarfOffsetByteSize(DwarfFormat Format)
The size of a reference determined by the DWARF 32/64-bit format.
@ DW_PUBNAMES_VERSION
Section version number for .debug_pubnames.
This is an optimization pass for GlobalISel generic memory operations.
unsigned encodeSLEB128(int64_t Value, raw_ostream &OS, unsigned PadTo=0)
Utility function to encode a SLEB128 value to an output stream.
unsigned encodeULEB128(uint64_t Value, raw_ostream &OS, unsigned PadTo=0)
Utility function to encode a ULEB128 value to an output stream.
This structure is used to update strings offsets into .debug_str.
This structure keeps fields which would be used for creating accelerator table.
dwarf::FormParams getFormParams() const
Returns FormParams used by section.
This structure is used to keep data of the concrete section.
raw_svector_ostream OS
Stream which stores data to the Contents.
void setSizesForSectionCreatedByAsmPrinter()
Some sections are emitted using AsmPrinter.
void emitUnitLength(uint64_t Length)
Emit unit length into the current section contents.
void emitOffset(uint64_t Val)
Emit specified offset value into the current section contents.
void emitIntVal(uint64_t Val, unsigned Size)
Emit specified integer value into the current section contents.
void apply(uint64_t PatchOffset, dwarf::Form AttrForm, uint64_t Val)
Write specified Value of AttrForm to the PatchOffset.
void emitInplaceString(StringRef String)
Emit specified inplace string value into the current section contents.