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);
73 for (
unsigned i = 0,
N =
Data.size(); i <
N; ++i) {
83 if (AttrData.
getForm() == dwarf::DW_FORM_implicit_const)
93 DIE *OutUnitDIE = getOutUnitDIE();
94 if (OutUnitDIE ==
nullptr)
101 getOrCreateSectionDescriptor(DebugSectionKind::DebugInfo);
107 Emitter.emitCompileUnitHeader(*
this);
108 size_t OffsetToAbbreviationTableOffset =
109 (getFormParams().Version >= 5) ? 8 : 6;
111 OffsetToAbbreviationTableOffset,
112 &getOrCreateSectionDescriptor(DebugSectionKind::DebugAbbrev)});
127 return DebugLineEmitter.
emit(OutLineTable);
131 if (getVersion() < 5)
134 if (DebugStringIndexMap.empty())
138 getOrCreateSectionDescriptor(DebugSectionKind::DebugStrOffsets);
144 uint64_t OffsetAfterSectionLength = OutDebugStrOffsetsSection.
OS.
tell();
155 OutDebugStrOffsetsSection.notePatch(
159 OutDebugStrOffsetsSection.
emitOffset(0xBADDEF);
163 OutDebugStrOffsetsSection.
apply(
164 OffsetAfterSectionLength -
166 dwarf::DW_FORM_sec_offset,
167 OutDebugStrOffsetsSection.
OS.
tell() - OffsetAfterSectionLength);
174std::optional<uint64_t>
177 std::optional<uint64_t> LengthOffset) {
182 LengthOffset = OutSection.
OS.
tell();
188 &getOrCreateSectionDescriptor(DebugSectionKind::DebugInfo)});
203 std::optional<uint64_t> NamesLengthOffset;
204 std::optional<uint64_t> TypesLengthOffset;
207 if (
Info.AvoidForPubSections)
211 case DwarfUnit::AccelType::Name: {
212 NamesLengthOffset = emitPubAcceleratorEntry(
213 getOrCreateSectionDescriptor(DebugSectionKind::DebugPubNames), Info,
216 case DwarfUnit::AccelType::Type: {
217 TypesLengthOffset = emitPubAcceleratorEntry(
218 getOrCreateSectionDescriptor(DebugSectionKind::DebugPubTypes), Info,
227 if (NamesLengthOffset) {
229 getOrCreateSectionDescriptor(DebugSectionKind::DebugPubNames);
232 OutSection.
apply(*NamesLengthOffset -
234 dwarf::DW_FORM_sec_offset,
235 OutSection.
OS.
tell() - *NamesLengthOffset);
238 if (TypesLengthOffset) {
240 getOrCreateSectionDescriptor(DebugSectionKind::DebugPubTypes);
243 OutSection.
apply(*TypesLengthOffset -
245 dwarf::DW_FORM_sec_offset,
246 OutSection.
OS.
tell() - *TypesLengthOffset);
Analysis containing CSE Info
dxil DXContainer Global Emitter
Dwarf abbreviation data, describes one attribute of a Dwarf abbreviation.
dwarf::Form getForm() const
dwarf::Attribute getAttribute() const
Accessors.
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.