LLVM  14.0.0git
Functions
DWARFEmitter.cpp File Reference
#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/Host.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 <algorithm>
#include <cassert>
#include <cstddef>
#include <cstdint>
#include <memory>
#include <string>
#include <vector>
Include dependency graph for DWARFEmitter.cpp:

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_t > getStandardOpcodeLengths (uint16_t Version, 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

Definition at line 1035 of file DWARFEmitter.cpp.

References llvm::Data, and llvm::DWARFYAML::getDWARFEmitterByName.

◆ 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,
Optional< uint8_t >  OpcodeBase 
)
static

Definition at line 555 of file DWARFEmitter.cpp.

References llvm::IndexedInstrProf::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

Definition at line 264 of file DWARFEmitter.cpp.

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

◆ 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

Definition at line 910 of file DWARFEmitter.cpp.

References List, llvm::raw_ostream::tell(), and UINT64_MAX.

◆ 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

Definition at line 812 of file DWARFEmitter.cpp.

◆ writeListEntry() [2/2]

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

Definition at line 751 of file DWARFEmitter.cpp.

◆ writeListEntryAddress()

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

Definition at line 706 of file DWARFEmitter.cpp.

◆ 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