9#ifndef LLVM_DWARFLINKER_DWARFSTREAMER_H
10#define LLVM_DWARFLINKER_DWARFSTREAMER_H
24template <
typename DataT>
class AccelTable;
47 : OutFile(OutFile), OutFileType(OutFileType), Translator(Translator),
72 void emitAbbrevs(
const std::vector<std::unique_ptr<DIEAbbrev>> &Abbrevs,
73 unsigned DwarfVersion)
override;
84 uint16_t TargetDWARFVersion)
override;
118 uint8_t AddrSize)
override;
141 return RngListsSectionSize;
187 return DebugInfoSectionSize;
191 return MacInfoSectionSize;
195 return MacroSectionSize;
199 return LocListsSectionSize;
211 WarningHandler(
Warning, Context,
nullptr);
214 void emitMacroTableImpl(
const DWARFDebugMacro *MacroTable,
219 void emitDwarfDebugRangesTableFragment(
const CompileUnit &Unit,
220 const AddressRanges &LinkedRanges,
221 PatchLocation Patch);
224 void emitDwarfDebugRngListsTableFragment(
const CompileUnit &Unit,
225 const AddressRanges &LinkedRanges,
227 DebugDieValuePool &AddrPool);
230 void emitDwarfDebugLocTableFragment(
231 const CompileUnit &Unit,
233 PatchLocation Patch);
236 void emitDwarfDebugLocListsTableFragment(
237 const CompileUnit &Unit,
239 PatchLocation Patch, DebugDieValuePool &AddrPool);
243 void emitLineTablePrologue(
const DWARFDebugLine::Prologue &
P,
246 void emitLineTableString(
const DWARFDebugLine::Prologue &
P,
247 const DWARFFormValue &
String,
250 void emitLineTableProloguePayload(
const DWARFDebugLine::Prologue &
P,
253 void emitLineTablePrologueV2IncludeAndFileTable(
256 void emitLineTablePrologueV5IncludeAndFileTable(
259 void emitLineTableRows(
const DWARFDebugLine::LineTable &LineTable,
260 MCSymbol *LineEndSym,
unsigned AddressByteSize);
263 void emitLabelDifference(
const MCSymbol *
Hi,
const MCSymbol *
Lo,
269 std::unique_ptr<MCRegisterInfo> MRI;
270 std::unique_ptr<MCAsmInfo> MAI;
271 std::unique_ptr<MCObjectFileInfo> MOFI;
272 std::unique_ptr<MCContext> MC;
274 std::unique_ptr<MCInstrInfo> MII;
275 std::unique_ptr<MCSubtargetInfo> MSTI;
279 std::unique_ptr<TargetMachine> TM;
280 std::unique_ptr<AsmPrinter> Asm;
284 raw_pwrite_stream &OutFile;
286 std::function<StringRef(StringRef Input)> Translator;
303 MCSymbol *LabelBegin;
305 std::vector<EmittedUnit> EmittedUnits;
309 void emitPubSectionForUnit(MCSection *Sec, StringRef
Name,
310 const CompileUnit &Unit,
311 const std::vector<CompileUnit::AccelInfo> &Names);
This class holds an abstract representation of an Accelerator Table, consisting of a sequence of buck...
The AddressRanges class helps normalize address range collections.
This class is intended to be used as a driving class for all asm writers.
Stores all information relating to a compile unit, be it in its original instance in the object file ...
A structured debug information entry.
DWARFContext This data structure is the top level entity that deals with dwarf debug information pars...
OutputFileType
Type of output file.
std::function< void(const Twine &Warning, StringRef Context, const DWARFDie *DIE)> messageHandler
DwarfEmitter presents interface to generate all debug info tables.
The Dwarf streaming logic.
void emitMacroTables(DWARFContext *Context, const Offset2UnitMap &UnitMacroMap, OffsetsStringPool &StringPool) override
Emit all available macro tables(DWARFv4 and DWARFv5).
uint64_t getDebugMacroSectionSize() const override
Returns size of generated .debug_macro section.
uint64_t getFrameSectionSize() const override
Returns size of generated .debug_frame section.
void emitAppleNamespaces(AccelTable< AppleAccelTableStaticOffsetData > &Table) override
Emit Apple namespaces accelerator table.
void emitStrings(const NonRelocatableStringpool &Pool) override
Emit the string table described by Pool into .debug_str table.
void emitAppleNames(AccelTable< AppleAccelTableStaticOffsetData > &Table) override
Emit Apple names accelerator table.
void emitDwarfDebugArangesTable(const CompileUnit &Unit, const AddressRanges &LinkedRanges) override
Emit .debug_aranges entries for Unit.
uint64_t getDebugInfoSectionSize() const override
Returns size of generated .debug_info section.
void finish() override
Dump the file to the disk.
void emitDwarfDebugRangeListFragment(const CompileUnit &Unit, const AddressRanges &LinkedRanges, PatchLocation Patch, DebugDieValuePool &AddrPool) override
Emit debug ranges(.debug_ranges, .debug_rnglists) fragment.
uint64_t getLocListsSectionSize() const override
Returns size of generated .debug_loclists section.
void emitAppleObjc(AccelTable< AppleAccelTableStaticOffsetData > &Table) override
Emit Apple Objective-C accelerator table.
void emitStringOffsets(const SmallVector< uint64_t > &StringOffset, uint16_t TargetDWARFVersion) override
Emit the debug string offset table described by StringOffsets into the .debug_str_offsets table.
void emitDwarfDebugRangeListFooter(const CompileUnit &Unit, MCSymbol *EndLabel) override
Emit debug ranges(.debug_ranges, .debug_rnglists) footer.
void emitAppleTypes(AccelTable< AppleAccelTableStaticTypeData > &Table) override
Emit Apple type accelerator table.
void emitSectionContents(StringRef SecData, StringRef SecName) override
Emit contents of section SecName From Obj.
void emitDwarfDebugLocListFragment(const CompileUnit &Unit, const DWARFLocationExpressionsVector &LinkedLocationExpression, PatchLocation Patch, DebugDieValuePool &AddrPool) override
Emit debug ranges(.debug_loc, .debug_loclists) fragment.
void emitPubNamesForUnit(const CompileUnit &Unit) override
Emit the .debug_pubnames contribution for Unit.
void emitDwarfDebugAddrs(const SmallVector< uint64_t > &Addrs, uint8_t AddrSize) override
Emit the addresses described by Addrs into .debug_addr table.
void emitCIE(StringRef CIEBytes) override
Emit a CIE.
void emitDIE(DIE &Die) override
Recursively emit the DIE tree rooted at Die.
void emitDwarfDebugAddrsFooter(const CompileUnit &Unit, MCSymbol *EndLabel) override
Emit .debug_addr footer.
void emitDwarfDebugLocListFooter(const CompileUnit &Unit, MCSymbol *EndLabel) override
Emit debug ranges(.debug_loc, .debug_loclists) footer.
uint64_t getLineSectionSize() const override
Returns size of generated .debug_line section.
void emitLineStrings(const NonRelocatableStringpool &Pool) override
Emit the string table described by Pool into .debug_line_str table.
void emitSwiftReflectionSection(llvm::binaryformat::Swift5ReflectionSectionKind ReflSectionKind, StringRef Buffer, uint32_t Alignment, uint32_t Size) override
Emit the swift reflection section stored in Buffer.
void emitCompileUnitHeader(CompileUnit &Unit, unsigned DwarfVersion) override
Emit the compilation unit header for Unit in the debug_info section.
MCSymbol * emitDwarfDebugLocListHeader(const CompileUnit &Unit) override
Emit debug locations(.debug_loc, .debug_loclists) header.
uint64_t getDebugMacInfoSectionSize() const override
Returns size of generated .debug_macinfo section.
void emitPubTypesForUnit(const CompileUnit &Unit) override
Emit the .debug_pubtypes contribution for Unit.
void emitLineTableForUnit(const DWARFDebugLine::LineTable &LineTable, const CompileUnit &Unit, OffsetsStringPool &DebugStrPool, OffsetsStringPool &DebugLineStrPool) override
Emit .debug_line table entry for specified LineTable.
uint64_t getRngListsSectionSize() const override
Returns size of generated .debug_rnglists section.
void emitAbbrevs(const std::vector< std::unique_ptr< DIEAbbrev > > &Abbrevs, unsigned DwarfVersion) override
Emit the abbreviation table Abbrevs to the debug_abbrev section.
uint64_t getDebugAddrSectionSize() const override
Returns size of generated .debug_addr section.
AsmPrinter & getAsmPrinter() const override
Returns underlying AsmPrinter.
MCSymbol * emitDwarfDebugAddrsHeader(const CompileUnit &Unit) override
Emit .debug_addr header.
void emitSwiftAST(StringRef Buffer) override
Emit the swift_ast section stored in Buffer.
MCSymbol * emitDwarfDebugRangeListHeader(const CompileUnit &Unit) override
Emit debug ranges(.debug_ranges, .debug_rnglists) header.
Error init(Triple TheTriple, StringRef Swift5ReflectionSegmentName)
DwarfStreamer(DWARFLinker::OutputFileType OutFileType, raw_pwrite_stream &OutFile, std::function< StringRef(StringRef Input)> Translator, DWARFLinker::messageHandler Warning)
uint64_t getRangesSectionSize() const override
Returns size of generated .debug_ranges section.
void switchToDebugInfoSection(unsigned DwarfVersion)
Set the current output section to debug_info and change the MC Dwarf version to DwarfVersion.
void emitDebugNames(AccelTable< DWARF5AccelTableStaticData > &Table) override
Emit DWARF debug names.
void emitFDE(uint32_t CIEOffset, uint32_t AddreSize, uint64_t Address, StringRef Bytes) override
Emit an FDE with data Bytes.
Lightweight error class with error context and mandatory checking.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
A string table that doesn't need relocations.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - Represent a constant reference to a string, i.e.
Helper for making strong types.
Triple - Helper class for working with autoconf configuration names.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
An abstract base class for streams implementations that also support a pwrite operation.
DwarfFormat
Constants that define the DWARF format as 32 or 64 bit.
This is an optimization pass for GlobalISel generic memory operations.
std::vector< DWARFLocationExpression > DWARFLocationExpressionsVector
Represents a set of absolute location expressions.
StrongType< NonRelocatableStringpool, OffsetsTag > OffsetsStringPool
DenseMap< uint64_t, CompileUnit * > Offset2UnitMap