42 OS.
write(reinterpret_cast<char *>(&Integer),
sizeof(
T));
56 assert(
false &&
"Invalid integer write size.");
60 std::vector<uint8_t> FillData;
61 FillData.insert(FillData.begin(),
Size, 0);
62 OS.
write(reinterpret_cast<char *>(FillData.data()), Size);
66 bool IsLittleEndian) {
74 OS.
write(Str.data(), Str.size());
83 OS.
write(AbbrevDecl.Children);
84 for (
auto Attr : AbbrevDecl.Attributes) {
87 if (Attr.Form == dwarf::DW_FORM_implicit_const)
97 auto HeaderStart = OS.
tell();
104 auto HeaderSize = OS.
tell() - HeaderStart;
105 auto FirstDescriptor =
alignTo(HeaderSize, Range.AddrSize * 2);
108 for (
auto Descriptor : Range.Descriptors) {
120 bool IsLittleEndian) {
171 void onValue(
const uint64_t U,
const bool LEB =
false)
override {
178 void onValue(
const int64_t S,
const bool LEB =
false)
override {
186 OS.write(String.
data(), String.
size());
196 : DWARFYAML::ConstVisitor(DI), OS(Out) {}
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();
311 bool IsLittleEndian) {
332 return std::move(DebugSections);
void swapByteOrder(T &Value)
void EmitDebugInfo(raw_ostream &OS, const Data &DI)
llvm::dwarf::UnitType Type
void EmitDebugAranges(raw_ostream &OS, const Data &DI)
std::vector< Abbrev > AbbrevDecls
const char * getBufferStart() const
uint64_t alignTo(uint64_t Value, uint64_t Align, uint64_t Skew=0)
Returns the next integer (mod 2**64) that is greater than or equal to Value and is a multiple of Alig...
static void ZeroFillBytes(raw_ostream &OS, size_t Size)
std::vector< uint8_t > StandardOpcodeLengths
std::vector< PubEntry > Entries
DumpVisitor(const DWARFYAML::Data &DI, raw_ostream &Out)
static void writeInteger(T Integer, raw_ostream &OS, bool IsLittleEndian)
An extension of the DWARFYAML::ConstVisitor which writes compile units and DIEs to a stream...
Tagged union holding either a T or a Error.
void onValue(const MemoryBufferRef MBR) override
uint64_t tell() const
tell - Return the current offset with the file.
std::vector< ARange > ARanges
void EmitDebugAbbrev(raw_ostream &OS, const Data &DI)
static const bool IsLittleEndianHost
Expected< StringMap< std::unique_ptr< MemoryBuffer > > > EmitDebugSections(StringRef YAMLString, bool IsLittleEndian=sys::IsLittleEndianHost)
std::vector< Unit > CompileUnits
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t size() const
size - Get the string size.
void onStartCompileUnit(const DWARFYAML::Unit &CU) override
Const Visitor Functions.
std::vector< File > Files
std::vector< LineTable > DebugLines
void writeInitialLength(const DWARFYAML::InitialLength &Length, raw_ostream &OS, bool IsLittleEndian)
Error errorCodeToError(std::error_code EC)
Helper for converting an std::error_code to a Error.
void onValue(const int64_t S, const bool LEB=false) override
A structured debug information entry.
void onValue(const uint16_t U) override
std::vector< StringRef > IncludeDirs
static void writeVariableSizedInteger(uint64_t Integer, size_t Size, raw_ostream &OS, bool IsLittleEndian)
raw_ostream & write(unsigned char C)
size_t getBufferSize() const
void EmitPubSection(raw_ostream &OS, const PubSection &Sect, bool IsLittleEndian)
static void EmitFileEntry(raw_ostream &OS, const DWARFYAML::File &File)
void onValue(const uint32_t U) override
void(*)(raw_ostream &, const DWARFYAML::Data &) EmitFuncType
std::vector< StringRef > DebugStrings
llvm::yaml::Hex32 AbbrCode
void onValue(const StringRef String) override
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...
constexpr char Size[]
Key for Kernel::Arg::Metadata::mSize.
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)
void encodeSLEB128(int64_t Value, raw_ostream &OS, unsigned Padding=0)
Utility function to encode a SLEB128 value to an output stream.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
A raw_ostream that writes to an std::string.
void onValue(const uint8_t U) override
Value visitors.
void onStartDIE(const DWARFYAML::Unit &CU, const DWARFYAML::Entry &DIE) override
This class implements an extremely fast bulk output stream that can only output to a stream...
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE const char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
void encodeULEB128(uint64_t Value, raw_ostream &OS, unsigned Padding=0)
Utility function to encode a ULEB128 value to an output stream.
StringRef - Represent a constant reference to a string, i.e.
void onValue(const uint64_t U, const bool LEB=false) override
void EmitDebugLine(raw_ostream &OS, const Data &DI)