9#ifndef LLVM_DWARFLINKER_CLASSIC_DWARFSTREAMER_H
10#define LLVM_DWARFLINKER_CLASSIC_DWARFSTREAMER_H
24template <
typename DataT>
class AccelTable;
29namespace dwarf_linker {
49 : OutFile(OutFile), OutFileType(OutFileType), WarningHandler(
Warning) {}
78 void emitAbbrevs(
const std::vector<std::unique_ptr<DIEAbbrev>> &Abbrevs,
79 unsigned DwarfVersion)
override;
91 uint16_t TargetDWARFVersion)
override;
125 uint8_t AddrSize)
override;
148 return RngListsSectionSize;
194 return DebugInfoSectionSize;
198 return MacInfoSectionSize;
202 return MacroSectionSize;
206 return LocListsSectionSize;
218 WarningHandler(
Warning, Context,
nullptr);
228 void emitDwarfDebugRangesTableFragment(
const CompileUnit &Unit,
233 void emitDwarfDebugRngListsTableFragment(
const CompileUnit &Unit,
239 void emitDwarfDebugLocTableFragment(
245 void emitDwarfDebugLocListsTableFragment(
262 void emitLineTablePrologueV2IncludeAndFileTable(
265 void emitLineTablePrologueV5IncludeAndFileTable(
269 MCSymbol *LineEndSym,
unsigned AddressByteSize);
278 std::unique_ptr<MCRegisterInfo> MRI;
279 std::unique_ptr<MCAsmInfo> MAI;
280 std::unique_ptr<MCObjectFileInfo> MOFI;
281 std::unique_ptr<MCContext> MC;
283 std::unique_ptr<MCInstrInfo> MII;
284 std::unique_ptr<MCSubtargetInfo> MSTI;
288 std::unique_ptr<TargetMachine> TM;
289 std::unique_ptr<AsmPrinter> Asm;
313 std::vector<EmittedUnit> EmittedUnits;
319 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.
A structured debug information entry.
DWARFContext This data structure is the top level entity that deals with dwarf debug information pars...
Lightweight error class with error context and mandatory checking.
Tagged union holding either a T or a Error.
Generic interface to target specific assembler backends.
MCCodeEmitter - Generic instruction encoding interface.
This is an instance of a target assembly language printer that converts an MCInst to valid target ass...
Instances of this class represent a uniqued identifier for a section in the current translation unit.
Streaming machine code generation interface.
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...
std::function< void(const Twine &Warning, StringRef Context, const DWARFDie *DIE)> MessageHandlerTy
OutputFileType
Type of output file.
Stores all information relating to a compile unit, be it in its original instance in the object file ...
DwarfEmitter presents interface to generate all debug info tables.
User of DwarfStreamer should call initialization code for AsmPrinter:
uint64_t getDebugInfoSectionSize() const override
Returns size of generated .debug_info section.
uint64_t getRangesSectionSize() const override
Returns size of generated .debug_ranges section.
void emitDwarfDebugAddrsFooter(const CompileUnit &Unit, MCSymbol *EndLabel) override
Emit .debug_addr footer.
void emitDwarfDebugArangesTable(const CompileUnit &Unit, const AddressRanges &LinkedRanges) override
Emit .debug_aranges entries for Unit.
void emitAppleTypes(AccelTable< AppleAccelTableStaticTypeData > &Table) override
Emit Apple type accelerator table.
DwarfStreamer(DWARFLinkerBase::OutputFileType OutFileType, raw_pwrite_stream &OutFile, DWARFLinkerBase::MessageHandlerTy Warning)
void emitDIE(DIE &Die) override
Recursively emit the DIE tree rooted at Die.
virtual ~DwarfStreamer()=default
uint64_t getDebugMacroSectionSize() const override
Returns size of generated .debug_macro section.
void emitDwarfDebugLocListFragment(const CompileUnit &Unit, const DWARFLocationExpressionsVector &LinkedLocationExpression, PatchLocation Patch, DebugDieValuePool &AddrPool) override
Emit debug ranges(.debug_loc, .debug_loclists) fragment.
void emitStrings(const NonRelocatableStringpool &Pool) override
Emit the string table described by Pool into .debug_str table.
static Expected< std::unique_ptr< DwarfStreamer > > createStreamer(const Triple &TheTriple, DWARFLinkerBase::OutputFileType FileType, raw_pwrite_stream &OutFile, DWARFLinkerBase::MessageHandlerTy Warning)
void emitDebugNames(DWARF5AccelTable &Table) override
Emit DWARF debug names.
uint64_t getLineSectionSize() const override
Returns size of generated .debug_line section.
uint64_t getDebugAddrSectionSize() const override
Returns size of generated .debug_addr section.
void emitDwarfDebugLocListFooter(const CompileUnit &Unit, MCSymbol *EndLabel) override
Emit debug ranges(.debug_loc, .debug_loclists) footer.
MCSymbol * emitDwarfDebugAddrsHeader(const CompileUnit &Unit) override
Emit .debug_addr header.
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 emitLineStrings(const NonRelocatableStringpool &Pool) override
Emit the string table described by Pool into .debug_line_str table.
Error init(Triple TheTriple, StringRef Swift5ReflectionSegmentName)
void emitSwiftReflectionSection(llvm::binaryformat::Swift5ReflectionSectionKind ReflSectionKind, StringRef Buffer, uint32_t Alignment, uint32_t Size)
Emit the swift reflection section stored in Buffer.
MCSymbol * emitDwarfDebugRangeListHeader(const CompileUnit &Unit) override
Emit debug ranges(.debug_ranges, .debug_rnglists) header.
uint64_t getRngListsSectionSize() const override
Returns size of generated .debug_rnglists section.
void emitCIE(StringRef CIEBytes) override
Emit a CIE.
uint64_t getLocListsSectionSize() const override
Returns size of generated .debug_loclists section.
void emitSectionContents(StringRef SecData, DebugSectionKind SecKind) override
Emit contents of section SecName From Obj.
void emitAppleNames(AccelTable< AppleAccelTableStaticOffsetData > &Table) override
Emit Apple names accelerator table.
void finish() override
Dump the file to the disk.
void emitAbbrevs(const std::vector< std::unique_ptr< DIEAbbrev > > &Abbrevs, unsigned DwarfVersion) override
Emit the abbreviation table Abbrevs to the debug_abbrev section.
MCSymbol * emitDwarfDebugLocListHeader(const CompileUnit &Unit) override
Emit debug locations(.debug_loc, .debug_loclists) header.
void emitFDE(uint32_t CIEOffset, uint32_t AddreSize, uint64_t Address, StringRef Bytes) override
Emit an FDE with data Bytes.
void emitPubNamesForUnit(const CompileUnit &Unit) override
Emit the .debug_pubnames contribution for Unit.
uint64_t getDebugMacInfoSectionSize() const override
Returns size of generated .debug_macinfo section.
void emitDwarfDebugRangeListFragment(const CompileUnit &Unit, const AddressRanges &LinkedRanges, PatchLocation Patch, DebugDieValuePool &AddrPool) override
Emit debug ranges(.debug_ranges, .debug_rnglists) fragment.
void emitPubTypesForUnit(const CompileUnit &Unit) override
Emit the .debug_pubtypes contribution for Unit.
AsmPrinter & getAsmPrinter() const
void emitLineTableForUnit(const DWARFDebugLine::LineTable &LineTable, const CompileUnit &Unit, OffsetsStringPool &DebugStrPool, OffsetsStringPool &DebugLineStrPool) override
Emit .debug_line table entry for specified LineTable.
void emitDwarfDebugAddrs(const SmallVector< uint64_t > &Addrs, uint8_t AddrSize) override
Emit the addresses described by Addrs into .debug_addr table.
void emitAppleObjc(AccelTable< AppleAccelTableStaticOffsetData > &Table) override
Emit Apple Objective-C accelerator table.
void emitAppleNamespaces(AccelTable< AppleAccelTableStaticOffsetData > &Table) override
Emit Apple namespaces accelerator table.
void emitMacroTables(DWARFContext *Context, const Offset2UnitMap &UnitMacroMap, OffsetsStringPool &StringPool) override
Emit all available macro tables(DWARFv4 and DWARFv5).
void switchToDebugInfoSection(unsigned DwarfVersion)
Set the current output section to debug_info and change the MC Dwarf version to DwarfVersion.
void emitCompileUnitHeader(CompileUnit &Unit, unsigned DwarfVersion) override
Emit the compilation unit header for Unit in the debug_info section.
uint64_t getFrameSectionSize() const override
Returns size of generated .debug_frame section.
void emitSwiftAST(StringRef Buffer)
Emit the swift_ast section stored in Buffer.
void emitDwarfDebugRangeListFooter(const CompileUnit &Unit, MCSymbol *EndLabel) override
Emit debug ranges(.debug_ranges, .debug_rnglists) footer.
An abstract base class for streams implementations that also support a pwrite operation.
DebugSectionKind
List of tracked debug tables.
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.