41 OS.
write(reinterpret_cast<char *>(&Integer),
sizeof(
T));
55 assert(
false &&
"Invalid integer write size.");
59 std::vector<uint8_t> FillData;
60 FillData.insert(FillData.begin(),
Size, 0);
61 OS.
write(reinterpret_cast<char *>(FillData.data()), Size);
73 OS.
write(Str.data(), Str.size());
82 OS.
write(AbbrevDecl.Children);
83 for (
auto Attr : AbbrevDecl.Attributes) {
86 if (Attr.Form == dwarf::DW_FORM_implicit_const)
96 auto HeaderStart = OS.
tell();
107 for (
auto Descriptor : Range.Descriptors) {
119 bool IsLittleEndian) {
158 void onValue(
const uint8_t U)
override {
162 void onValue(
const uint16_t U)
override {
166 void onValue(
const uint32_t U)
override {
170 void onValue(
const uint64_t U,
const bool LEB =
false)
override {
177 void onValue(
const int64_t S,
const bool LEB =
false)
override {
201 Visitor.traverseDebugInfo();
231 OS.
write(IncludeDir.data(), IncludeDir.size());
242 if (
Op.Opcode == 0) {
245 switch (
Op.SubOpcode) {
246 case dwarf::DW_LNE_set_address:
247 case dwarf::DW_LNE_set_discriminator:
251 case dwarf::DW_LNE_define_file:
254 case dwarf::DW_LNE_end_sequence:
257 for (
auto OpByte :
Op.UnknownOpcodeData)
262 case dwarf::DW_LNS_copy:
263 case dwarf::DW_LNS_negate_stmt:
264 case dwarf::DW_LNS_set_basic_block:
265 case dwarf::DW_LNS_const_add_pc:
266 case dwarf::DW_LNS_set_prologue_end:
267 case dwarf::DW_LNS_set_epilogue_begin:
270 case dwarf::DW_LNS_advance_pc:
271 case dwarf::DW_LNS_set_file:
272 case dwarf::DW_LNS_set_column:
273 case dwarf::DW_LNS_set_isa:
277 case dwarf::DW_LNS_advance_line:
281 case dwarf::DW_LNS_fixed_advance_pc:
286 for (
auto OpData :
Op.StandardOpcodeData) {
300 StringMap<std::unique_ptr<MemoryBuffer>> &OutputBuffers) {
303 EmitFunc(DebugInfoStream, DI);
304 DebugInfoStream.
flush();
319 Length = CU.
Version >= 5 ? 8 : 7;
330 virtual void onValue(
const uint8_t U) { Length += 1; }
331 virtual void onValue(
const uint16_t U) { Length += 2; }
332 virtual void onValue(
const uint32_t U) { Length += 4; }
333 virtual void onValue(
const uint64_t U,
const bool LEB =
false) {
339 virtual void onValue(
const int64_t S,
const bool LEB =
false) {
355 bool IsLittleEndian) {
356 yaml::Input YIn(YAMLString);
365 DIEFixupVisitor DIFixer(DI);
366 DIFixer.traverseDebugInfo();
380 return std::move(DebugSections);
void swapByteOrder(T &Value)
This class represents lattice values for constants.
void EmitDebugInfo(raw_ostream &OS, const Data &DI)
llvm::dwarf::UnitType Type
void EmitDebugAranges(raw_ostream &OS, const Data &DI)
std::vector< Abbrev > AbbrevDecls
static void ZeroFillBytes(raw_ostream &OS, size_t Size)
std::vector< uint8_t > StandardOpcodeLengths
std::vector< PubEntry > Entries
static void writeInteger(T Integer, raw_ostream &OS, bool IsLittleEndian)
static void writeInitialLength(const DWARFYAML::InitialLength &Length, raw_ostream &OS, bool IsLittleEndian)
Expected< StringMap< std::unique_ptr< MemoryBuffer > > > EmitDebugSections(StringRef YAMLString, bool ApplyFixups=false, bool IsLittleEndian=sys::IsLittleEndianHost)
Tagged union holding either a T or a Error.
std::vector< ARange > ARanges
void EmitDebugAbbrev(raw_ostream &OS, const Data &DI)
static const bool IsLittleEndianHost
std::vector< Unit > CompileUnits
LLVM_NODISCARD size_t size() const
size - Get the string size.
std::vector< File > Files
size_t getBufferSize() const
std::vector< LineTable > DebugLines
Instrumentation for Order File
Error errorCodeToError(std::error_code EC)
Helper for converting an std::error_code to a Error.
A structured debug information entry.
std::vector< StringRef > IncludeDirs
static void writeVariableSizedInteger(uint64_t Integer, size_t Size, raw_ostream &OS, bool IsLittleEndian)
unsigned getULEB128Size(uint64_t Value)
Utility function to get the size of the ULEB128-encoded value.
raw_ostream & write(unsigned char C)
void EmitPubSection(raw_ostream &OS, const PubSection &Sect, bool IsLittleEndian)
static void EmitFileEntry(raw_ostream &OS, const DWARFYAML::File &File)
unsigned encodeULEB128(uint64_t Value, raw_ostream &OS, unsigned PadTo=0)
Utility function to encode a ULEB128 value to an output stream.
unsigned encodeSLEB128(int64_t Value, raw_ostream &OS, unsigned PadTo=0)
Utility function to encode a SLEB128 value to an output stream.
void(*)(raw_ostream &, const DWARFYAML::Data &) EmitFuncType
std::vector< StringRef > DebugStrings
llvm::yaml::Hex32 AbbrCode
static void EmitDebugSectionImpl(const DWARFYAML::Data &DI, EmitFuncType EmitFunc, StringRef Sec, StringMap< std::unique_ptr< MemoryBuffer >> &OutputBuffers)
StringMap - This is an unconventional map that is specialized for handling keys that are "strings"...
static std::unique_ptr< MemoryBuffer > getMemBufferCopy(StringRef InputData, const Twine &BufferName="")
Open the specified memory range as a MemoryBuffer, copying the contents and taking ownership of it...
uint64_t alignTo(uint64_t Size, Align A)
Returns a multiple of A needed to store Size bytes.
This file declares classes for handling the YAML representation of DWARF Debug Info.
std::vector< LineTableOpcode > Opcodes
Common declarations for yaml2obj.
void EmitDebugStr(raw_ostream &OS, const Data &DI)
unsigned getSLEB128Size(int64_t Value)
Utility function to get the size of the SLEB128-encoded value.
LLVM_NODISCARD const char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
void setLength(uint64_t Len)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
const char * getBufferStart() const
A raw_ostream that writes to an std::string.
uint64_t tell() const
tell - Return the current offset with the file.
This class implements an extremely fast bulk output stream that can only output to a stream...
StringRef - Represent a constant reference to a string, i.e.
void EmitDebugLine(raw_ostream &OS, const Data &DI)