LLVM 20.0.0git
Functions
DWARFEmitter.cpp File Reference

The DWARF component of yaml2obj. More...

#include "llvm/ObjectYAML/DWARFEmitter.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/ObjectYAML/DWARFYAML.h"
#include "llvm/Support/Errc.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/LEB128.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/SourceMgr.h"
#include "llvm/Support/SwapByteOrder.h"
#include "llvm/Support/YAMLTraits.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/TargetParser/Host.h"
#include <cassert>
#include <cstddef>
#include <cstdint>
#include <memory>
#include <optional>
#include <string>
#include <vector>

Go to the source code of this file.

Functions

template<typename T >
static void writeInteger (T Integer, raw_ostream &OS, bool IsLittleEndian)
 
static Error writeVariableSizedInteger (uint64_t Integer, size_t Size, raw_ostream &OS, bool IsLittleEndian)
 
static void ZeroFillBytes (raw_ostream &OS, size_t Size)
 
static void writeInitialLength (const dwarf::DwarfFormat Format, const uint64_t Length, raw_ostream &OS, bool IsLittleEndian)
 
static void writeDWARFOffset (uint64_t Offset, dwarf::DwarfFormat Format, raw_ostream &OS, bool IsLittleEndian)
 
static Error emitPubSection (raw_ostream &OS, const DWARFYAML::PubSection &Sect, bool IsLittleEndian, bool IsGNUPubSec=false)
 
static Expected< uint64_twriteDIE (const DWARFYAML::Data &DI, uint64_t CUIndex, uint64_t AbbrevTableID, const dwarf::FormParams &Params, const DWARFYAML::Entry &Entry, raw_ostream &OS, bool IsLittleEndian)
 
static void emitFileEntry (raw_ostream &OS, const DWARFYAML::File &File)
 
static void writeExtendedOpcode (const DWARFYAML::LineTableOpcode &Op, uint8_t AddrSize, bool IsLittleEndian, raw_ostream &OS)
 
static void writeLineTableOpcode (const DWARFYAML::LineTableOpcode &Op, uint8_t OpcodeBase, uint8_t AddrSize, raw_ostream &OS, bool IsLittleEndian)
 
static std::vector< uint8_tgetStandardOpcodeLengths (uint16_t Version, std::optional< uint8_t > OpcodeBase)
 
static Error checkOperandCount (StringRef EncodingString, ArrayRef< yaml::Hex64 > Values, uint64_t ExpectedOperands)
 
static Error writeListEntryAddress (StringRef EncodingName, raw_ostream &OS, uint64_t Addr, uint8_t AddrSize, bool IsLittleEndian)
 
static Expected< uint64_twriteDWARFExpression (raw_ostream &OS, const DWARFYAML::DWARFOperation &Operation, uint8_t AddrSize, bool IsLittleEndian)
 
static Expected< uint64_twriteListEntry (raw_ostream &OS, const DWARFYAML::RnglistEntry &Entry, uint8_t AddrSize, bool IsLittleEndian)
 
static Expected< uint64_twriteListEntry (raw_ostream &OS, const DWARFYAML::LoclistEntry &Entry, uint8_t AddrSize, bool IsLittleEndian)
 
template<typename EntryType >
static Error writeDWARFLists (raw_ostream &OS, ArrayRef< DWARFYAML::ListTable< EntryType > > Tables, bool IsLittleEndian, bool Is64BitAddrSize)
 
static Error emitDebugSectionImpl (const DWARFYAML::Data &DI, StringRef Sec, StringMap< std::unique_ptr< MemoryBuffer > > &OutputBuffers)
 

Detailed Description

The DWARF component of yaml2obj.

Provided as library code for tests.

Definition in file DWARFEmitter.cpp.

Function Documentation

◆ checkOperandCount()

static Error checkOperandCount ( StringRef  EncodingString,
ArrayRef< yaml::Hex64 >  Values,
uint64_t  ExpectedOperands 
)
static

◆ emitDebugSectionImpl()

static Error emitDebugSectionImpl ( const DWARFYAML::Data DI,
StringRef  Sec,
StringMap< std::unique_ptr< MemoryBuffer > > &  OutputBuffers 
)
static

◆ emitFileEntry()

static void emitFileEntry ( raw_ostream OS,
const DWARFYAML::File File 
)
static

◆ emitPubSection()

static Error emitPubSection ( raw_ostream OS,
const DWARFYAML::PubSection Sect,
bool  IsLittleEndian,
bool  IsGNUPubSec = false 
)
static

◆ getStandardOpcodeLengths()

static std::vector< uint8_t > getStandardOpcodeLengths ( uint16_t  Version,
std::optional< uint8_t OpcodeBase 
)
static

Definition at line 586 of file DWARFEmitter.cpp.

References llvm::Version.

Referenced by llvm::DWARFYAML::emitDebugLine().

◆ writeDIE()

static Expected< uint64_t > writeDIE ( const DWARFYAML::Data DI,
uint64_t  CUIndex,
uint64_t  AbbrevTableID,
const dwarf::FormParams Params,
const DWARFYAML::Entry Entry,
raw_ostream OS,
bool  IsLittleEndian 
)
static

◆ writeDWARFExpression()

static Expected< uint64_t > writeDWARFExpression ( raw_ostream OS,
const DWARFYAML::DWARFOperation Operation,
uint8_t  AddrSize,
bool  IsLittleEndian 
)
static

◆ writeDWARFLists()

template<typename EntryType >
static Error writeDWARFLists ( raw_ostream OS,
ArrayRef< DWARFYAML::ListTable< EntryType > >  Tables,
bool  IsLittleEndian,
bool  Is64BitAddrSize 
)
static

◆ writeDWARFOffset()

static void writeDWARFOffset ( uint64_t  Offset,
dwarf::DwarfFormat  Format,
raw_ostream OS,
bool  IsLittleEndian 
)
static

◆ writeExtendedOpcode()

static void writeExtendedOpcode ( const DWARFYAML::LineTableOpcode Op,
uint8_t  AddrSize,
bool  IsLittleEndian,
raw_ostream OS 
)
static

◆ writeInitialLength()

static void writeInitialLength ( const dwarf::DwarfFormat  Format,
const uint64_t  Length,
raw_ostream OS,
bool  IsLittleEndian 
)
static

◆ writeInteger()

template<typename T >
static void writeInteger ( T  Integer,
raw_ostream OS,
bool  IsLittleEndian 
)
static

◆ writeLineTableOpcode()

static void writeLineTableOpcode ( const DWARFYAML::LineTableOpcode Op,
uint8_t  OpcodeBase,
uint8_t  AddrSize,
raw_ostream OS,
bool  IsLittleEndian 
)
static

◆ writeListEntry() [1/2]

static Expected< uint64_t > writeListEntry ( raw_ostream OS,
const DWARFYAML::LoclistEntry Entry,
uint8_t  AddrSize,
bool  IsLittleEndian 
)
static

◆ writeListEntry() [2/2]

static Expected< uint64_t > writeListEntry ( raw_ostream OS,
const DWARFYAML::RnglistEntry Entry,
uint8_t  AddrSize,
bool  IsLittleEndian 
)
static

◆ writeListEntryAddress()

static Error writeListEntryAddress ( StringRef  EncodingName,
raw_ostream OS,
uint64_t  Addr,
uint8_t  AddrSize,
bool  IsLittleEndian 
)
static

◆ writeVariableSizedInteger()

static Error writeVariableSizedInteger ( uint64_t  Integer,
size_t  Size,
raw_ostream OS,
bool  IsLittleEndian 
)
static

◆ ZeroFillBytes()

static void ZeroFillBytes ( raw_ostream OS,
size_t  Size 
)
static