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);
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();
108 for (
auto Descriptor : Range.Descriptors) {
120 bool IsLittleEndian) {
159 void onValue(
const uint8_t U)
override {
163 void onValue(
const uint16_t U)
override {
167 void onValue(
const uint32_t U)
override {
171 void onValue(
const uint64_t U,
const bool LEB =
false)
override {
178 void onValue(
const int64_t S,
const bool LEB =
false)
override {
202 Visitor.traverseDebugInfo();
232 OS.
write(IncludeDir.data(), IncludeDir.size());
243 if (
Op.Opcode == 0) {
246 switch (
Op.SubOpcode) {
247 case dwarf::DW_LNE_set_address:
248 case dwarf::DW_LNE_set_discriminator:
252 case dwarf::DW_LNE_define_file:
255 case dwarf::DW_LNE_end_sequence:
258 for (
auto OpByte :
Op.UnknownOpcodeData)
263 case dwarf::DW_LNS_copy:
264 case dwarf::DW_LNS_negate_stmt:
265 case dwarf::DW_LNS_set_basic_block:
266 case dwarf::DW_LNS_const_add_pc:
267 case dwarf::DW_LNS_set_prologue_end:
268 case dwarf::DW_LNS_set_epilogue_begin:
271 case dwarf::DW_LNS_advance_pc:
272 case dwarf::DW_LNS_set_file:
273 case dwarf::DW_LNS_set_column:
274 case dwarf::DW_LNS_set_isa:
278 case dwarf::DW_LNS_advance_line:
282 case dwarf::DW_LNS_fixed_advance_pc:
287 for (
auto OpData :
Op.StandardOpcodeData) {
301 StringMap<std::unique_ptr<MemoryBuffer>> &OutputBuffers) {
304 EmitFunc(DebugInfoStream, DI);
305 DebugInfoStream.
flush();
328 virtual void onValue(
const uint8_t U) { Length += 1; }
329 virtual void onValue(
const uint16_t U) { Length += 2; }
330 virtual void onValue(
const uint32_t U) { Length += 4; }
331 virtual void onValue(
const uint64_t U,
const bool LEB =
false) {
337 virtual void onValue(
const int64_t S,
const bool LEB =
false) {
353 bool IsLittleEndian) {
354 yaml::Input YIn(YAMLString);
363 DIEFixupVisitor DIFixer(DI);
364 DIFixer.traverseDebugInfo();
378 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)
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t size() const
size - Get the string size.
std::vector< Abbrev > AbbrevDecls
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
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).
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
std::vector< File > Files
size_t getBufferSize() const
std::vector< LineTable > DebugLines
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...
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.
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)