mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 03:02:36 +01:00
Recommit "[DWARFv5] Dump an MD5 checksum in the line-table header."
Adds missing support for DW_FORM_data16. Update of r320852/r320886, fixing the unittest again, this time use a raw char string for the test data. Differential Revision: https://reviews.llvm.org/D41090 llvm-svn: 321011
This commit is contained in:
parent
4212c01ddc
commit
6c98a1197f
@ -15,6 +15,7 @@
|
|||||||
#include "llvm/DebugInfo/DWARF/DWARFDataExtractor.h"
|
#include "llvm/DebugInfo/DWARF/DWARFDataExtractor.h"
|
||||||
#include "llvm/DebugInfo/DWARF/DWARFFormValue.h"
|
#include "llvm/DebugInfo/DWARF/DWARFFormValue.h"
|
||||||
#include "llvm/DebugInfo/DWARF/DWARFRelocMap.h"
|
#include "llvm/DebugInfo/DWARF/DWARFRelocMap.h"
|
||||||
|
#include "llvm/Support/MD5.h"
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
@ -34,6 +35,7 @@ public:
|
|||||||
uint64_t DirIdx = 0;
|
uint64_t DirIdx = 0;
|
||||||
uint64_t ModTime = 0;
|
uint64_t ModTime = 0;
|
||||||
uint64_t Length = 0;
|
uint64_t Length = 0;
|
||||||
|
MD5::MD5Result Checksum;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Prologue {
|
struct Prologue {
|
||||||
@ -46,11 +48,11 @@ public:
|
|||||||
/// parameters affect interpretation of forms (used in the directory and
|
/// parameters affect interpretation of forms (used in the directory and
|
||||||
/// file tables starting with v5).
|
/// file tables starting with v5).
|
||||||
DWARFFormParams FormParams;
|
DWARFFormParams FormParams;
|
||||||
/// In v5, size in bytes of a segment selector.
|
|
||||||
uint8_t SegSelectorSize;
|
|
||||||
/// The number of bytes following the prologue_length field to the beginning
|
/// The number of bytes following the prologue_length field to the beginning
|
||||||
/// of the first byte of the statement program itself.
|
/// of the first byte of the statement program itself.
|
||||||
uint64_t PrologueLength;
|
uint64_t PrologueLength;
|
||||||
|
/// In v5, size in bytes of a segment selector.
|
||||||
|
uint8_t SegSelectorSize;
|
||||||
/// The size in bytes of the smallest target machine instruction. Statement
|
/// The size in bytes of the smallest target machine instruction. Statement
|
||||||
/// program opcodes that alter the address register first multiply their
|
/// program opcodes that alter the address register first multiply their
|
||||||
/// operands by this value.
|
/// operands by this value.
|
||||||
@ -66,6 +68,8 @@ public:
|
|||||||
uint8_t LineRange;
|
uint8_t LineRange;
|
||||||
/// The number assigned to the first special opcode.
|
/// The number assigned to the first special opcode.
|
||||||
uint8_t OpcodeBase;
|
uint8_t OpcodeBase;
|
||||||
|
/// For v5, whether filename entries provide an MD5 checksum.
|
||||||
|
bool HasMD5;
|
||||||
std::vector<uint8_t> StandardOpcodeLengths;
|
std::vector<uint8_t> StandardOpcodeLengths;
|
||||||
std::vector<StringRef> IncludeDirectories;
|
std::vector<StringRef> IncludeDirectories;
|
||||||
std::vector<FileNameEntry> FileNames;
|
std::vector<FileNameEntry> FileNames;
|
||||||
|
@ -777,6 +777,7 @@ void DIEBlock::EmitValue(const AsmPrinter *Asm, dwarf::Form Form) const {
|
|||||||
case dwarf::DW_FORM_block2: Asm->EmitInt16(Size); break;
|
case dwarf::DW_FORM_block2: Asm->EmitInt16(Size); break;
|
||||||
case dwarf::DW_FORM_block4: Asm->EmitInt32(Size); break;
|
case dwarf::DW_FORM_block4: Asm->EmitInt32(Size); break;
|
||||||
case dwarf::DW_FORM_block: Asm->EmitULEB128(Size); break;
|
case dwarf::DW_FORM_block: Asm->EmitULEB128(Size); break;
|
||||||
|
case dwarf::DW_FORM_data16: break;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const auto &V : values())
|
for (const auto &V : values())
|
||||||
@ -791,6 +792,7 @@ unsigned DIEBlock::SizeOf(const AsmPrinter *AP, dwarf::Form Form) const {
|
|||||||
case dwarf::DW_FORM_block2: return Size + sizeof(int16_t);
|
case dwarf::DW_FORM_block2: return Size + sizeof(int16_t);
|
||||||
case dwarf::DW_FORM_block4: return Size + sizeof(int32_t);
|
case dwarf::DW_FORM_block4: return Size + sizeof(int32_t);
|
||||||
case dwarf::DW_FORM_block: return Size + getULEB128Size(Size);
|
case dwarf::DW_FORM_block: return Size + getULEB128Size(Size);
|
||||||
|
case dwarf::DW_FORM_data16: return 16;
|
||||||
default: llvm_unreachable("Improper form for block");
|
default: llvm_unreachable("Improper form for block");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,6 +48,7 @@ void DWARFDebugLine::Prologue::clear() {
|
|||||||
MinInstLength = MaxOpsPerInst = DefaultIsStmt = LineBase = LineRange = 0;
|
MinInstLength = MaxOpsPerInst = DefaultIsStmt = LineBase = LineRange = 0;
|
||||||
OpcodeBase = 0;
|
OpcodeBase = 0;
|
||||||
FormParams = DWARFFormParams({0, 0, DWARF32});
|
FormParams = DWARFFormParams({0, 0, DWARF32});
|
||||||
|
HasMD5 = false;
|
||||||
StandardOpcodeLengths.clear();
|
StandardOpcodeLengths.clear();
|
||||||
IncludeDirectories.clear();
|
IncludeDirectories.clear();
|
||||||
FileNames.clear();
|
FileNames.clear();
|
||||||
@ -78,15 +79,23 @@ void DWARFDebugLine::Prologue::dump(raw_ostream &OS) const {
|
|||||||
<< IncludeDirectories[I] << "'\n";
|
<< IncludeDirectories[I] << "'\n";
|
||||||
|
|
||||||
if (!FileNames.empty()) {
|
if (!FileNames.empty()) {
|
||||||
OS << " Dir Mod Time File Len File Name\n"
|
if (HasMD5)
|
||||||
<< " ---- ---------- ---------- -----------"
|
OS << " Dir MD5 Checksum File Name\n"
|
||||||
"----------------\n";
|
<< " ---- -------------------------------- -----------"
|
||||||
|
"---------------\n";
|
||||||
|
else
|
||||||
|
OS << " Dir Mod Time File Len File Name\n"
|
||||||
|
<< " ---- ---------- ---------- -----------"
|
||||||
|
"----------------\n";
|
||||||
for (uint32_t I = 0; I != FileNames.size(); ++I) {
|
for (uint32_t I = 0; I != FileNames.size(); ++I) {
|
||||||
const FileNameEntry &FileEntry = FileNames[I];
|
const FileNameEntry &FileEntry = FileNames[I];
|
||||||
OS << format("file_names[%3u] %4" PRIu64 " ", I + 1, FileEntry.DirIdx)
|
OS << format("file_names[%3u] %4" PRIu64 " ", I + 1, FileEntry.DirIdx);
|
||||||
<< format("0x%8.8" PRIx64 " 0x%8.8" PRIx64 " ", FileEntry.ModTime,
|
if (HasMD5)
|
||||||
FileEntry.Length)
|
OS << FileEntry.Checksum.digest();
|
||||||
<< FileEntry.Name << '\n';
|
else
|
||||||
|
OS << format("0x%8.8" PRIx64 " 0x%8.8" PRIx64, FileEntry.ModTime,
|
||||||
|
FileEntry.Length);
|
||||||
|
OS << ' ' << FileEntry.Name << '\n';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -122,7 +131,7 @@ parseV2DirFileTables(const DWARFDataExtractor &DebugLineData,
|
|||||||
// ran off the end of the prologue.
|
// ran off the end of the prologue.
|
||||||
static ContentDescriptors
|
static ContentDescriptors
|
||||||
parseV5EntryFormat(const DWARFDataExtractor &DebugLineData, uint32_t *OffsetPtr,
|
parseV5EntryFormat(const DWARFDataExtractor &DebugLineData, uint32_t *OffsetPtr,
|
||||||
uint64_t EndPrologueOffset) {
|
uint64_t EndPrologueOffset, bool *HasMD5) {
|
||||||
ContentDescriptors Descriptors;
|
ContentDescriptors Descriptors;
|
||||||
int FormatCount = DebugLineData.getU8(OffsetPtr);
|
int FormatCount = DebugLineData.getU8(OffsetPtr);
|
||||||
bool HasPath = false;
|
bool HasPath = false;
|
||||||
@ -135,6 +144,8 @@ parseV5EntryFormat(const DWARFDataExtractor &DebugLineData, uint32_t *OffsetPtr,
|
|||||||
Descriptor.Form = dwarf::Form(DebugLineData.getULEB128(OffsetPtr));
|
Descriptor.Form = dwarf::Form(DebugLineData.getULEB128(OffsetPtr));
|
||||||
if (Descriptor.Type == dwarf::DW_LNCT_path)
|
if (Descriptor.Type == dwarf::DW_LNCT_path)
|
||||||
HasPath = true;
|
HasPath = true;
|
||||||
|
else if (Descriptor.Type == dwarf::DW_LNCT_MD5 && HasMD5)
|
||||||
|
*HasMD5 = true;
|
||||||
Descriptors.push_back(Descriptor);
|
Descriptors.push_back(Descriptor);
|
||||||
}
|
}
|
||||||
return HasPath ? Descriptors : ContentDescriptors();
|
return HasPath ? Descriptors : ContentDescriptors();
|
||||||
@ -144,11 +155,11 @@ static bool
|
|||||||
parseV5DirFileTables(const DWARFDataExtractor &DebugLineData,
|
parseV5DirFileTables(const DWARFDataExtractor &DebugLineData,
|
||||||
uint32_t *OffsetPtr, uint64_t EndPrologueOffset,
|
uint32_t *OffsetPtr, uint64_t EndPrologueOffset,
|
||||||
const DWARFFormParams &FormParams, const DWARFUnit *U,
|
const DWARFFormParams &FormParams, const DWARFUnit *U,
|
||||||
std::vector<StringRef> &IncludeDirectories,
|
bool &HasMD5, std::vector<StringRef> &IncludeDirectories,
|
||||||
std::vector<DWARFDebugLine::FileNameEntry> &FileNames) {
|
std::vector<DWARFDebugLine::FileNameEntry> &FileNames) {
|
||||||
// Get the directory entry description.
|
// Get the directory entry description.
|
||||||
ContentDescriptors DirDescriptors =
|
ContentDescriptors DirDescriptors =
|
||||||
parseV5EntryFormat(DebugLineData, OffsetPtr, EndPrologueOffset);
|
parseV5EntryFormat(DebugLineData, OffsetPtr, EndPrologueOffset, nullptr);
|
||||||
if (DirDescriptors.empty())
|
if (DirDescriptors.empty())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -174,7 +185,7 @@ parseV5DirFileTables(const DWARFDataExtractor &DebugLineData,
|
|||||||
|
|
||||||
// Get the file entry description.
|
// Get the file entry description.
|
||||||
ContentDescriptors FileDescriptors =
|
ContentDescriptors FileDescriptors =
|
||||||
parseV5EntryFormat(DebugLineData, OffsetPtr, EndPrologueOffset);
|
parseV5EntryFormat(DebugLineData, OffsetPtr, EndPrologueOffset, &HasMD5);
|
||||||
if (FileDescriptors.empty())
|
if (FileDescriptors.empty())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -201,7 +212,11 @@ parseV5DirFileTables(const DWARFDataExtractor &DebugLineData,
|
|||||||
case DW_LNCT_size:
|
case DW_LNCT_size:
|
||||||
FileEntry.Length = Value.getAsUnsignedConstant().getValue();
|
FileEntry.Length = Value.getAsUnsignedConstant().getValue();
|
||||||
break;
|
break;
|
||||||
// FIXME: Add MD5
|
case DW_LNCT_MD5:
|
||||||
|
assert(Value.getAsBlock().getValue().size() == 16);
|
||||||
|
std::uninitialized_copy_n(Value.getAsBlock().getValue().begin(), 16,
|
||||||
|
FileEntry.Checksum.Bytes.begin());
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -253,7 +268,7 @@ bool DWARFDebugLine::Prologue::parse(const DWARFDataExtractor &DebugLineData,
|
|||||||
|
|
||||||
if (getVersion() >= 5) {
|
if (getVersion() >= 5) {
|
||||||
if (!parseV5DirFileTables(DebugLineData, OffsetPtr, EndPrologueOffset,
|
if (!parseV5DirFileTables(DebugLineData, OffsetPtr, EndPrologueOffset,
|
||||||
getFormParams(), U, IncludeDirectories,
|
getFormParams(), U, HasMD5, IncludeDirectories,
|
||||||
FileNames)) {
|
FileNames)) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"warning: parsing line table prologue at 0x%8.8" PRIx64
|
"warning: parsing line table prologue at 0x%8.8" PRIx64
|
||||||
|
@ -186,6 +186,7 @@ bool DWARFFormValue::skipValue(dwarf::Form Form, DataExtractor DebugInfoData,
|
|||||||
case DW_FORM_data2:
|
case DW_FORM_data2:
|
||||||
case DW_FORM_data4:
|
case DW_FORM_data4:
|
||||||
case DW_FORM_data8:
|
case DW_FORM_data8:
|
||||||
|
case DW_FORM_data16:
|
||||||
case DW_FORM_flag:
|
case DW_FORM_flag:
|
||||||
case DW_FORM_ref1:
|
case DW_FORM_ref1:
|
||||||
case DW_FORM_ref2:
|
case DW_FORM_ref2:
|
||||||
@ -339,6 +340,11 @@ bool DWARFFormValue::extractValue(const DWARFDataExtractor &Data,
|
|||||||
case DW_FORM_ref_sup8:
|
case DW_FORM_ref_sup8:
|
||||||
Value.uval = Data.getU64(OffsetPtr);
|
Value.uval = Data.getU64(OffsetPtr);
|
||||||
break;
|
break;
|
||||||
|
case DW_FORM_data16:
|
||||||
|
// Treat this like a 16-byte block.
|
||||||
|
Value.uval = 16;
|
||||||
|
IsBlock = true;
|
||||||
|
break;
|
||||||
case DW_FORM_sdata:
|
case DW_FORM_sdata:
|
||||||
Value.sval = Data.getSLEB128(OffsetPtr);
|
Value.sval = Data.getSLEB128(OffsetPtr);
|
||||||
break;
|
break;
|
||||||
@ -432,6 +438,9 @@ void DWARFFormValue::dump(raw_ostream &OS, DIDumpOptions DumpOpts) const {
|
|||||||
case DW_FORM_data8:
|
case DW_FORM_data8:
|
||||||
OS << format("0x%016" PRIx64, UValue);
|
OS << format("0x%016" PRIx64, UValue);
|
||||||
break;
|
break;
|
||||||
|
case DW_FORM_data16:
|
||||||
|
OS << format_bytes(ArrayRef<uint8_t>(Value.data, 16), None, 16, 16);
|
||||||
|
break;
|
||||||
case DW_FORM_string:
|
case DW_FORM_string:
|
||||||
OS << '"';
|
OS << '"';
|
||||||
OS.write_escaped(Value.cstr);
|
OS.write_escaped(Value.cstr);
|
||||||
@ -651,7 +660,8 @@ Optional<int64_t> DWARFFormValue::getAsSignedConstant() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Optional<ArrayRef<uint8_t>> DWARFFormValue::getAsBlock() const {
|
Optional<ArrayRef<uint8_t>> DWARFFormValue::getAsBlock() const {
|
||||||
if (!isFormClass(FC_Block) && !isFormClass(FC_Exprloc))
|
if (!isFormClass(FC_Block) && !isFormClass(FC_Exprloc) &&
|
||||||
|
Form != DW_FORM_data16)
|
||||||
return None;
|
return None;
|
||||||
return makeArrayRef(Value.data, Value.uval);
|
return makeArrayRef(Value.data, Value.uval);
|
||||||
}
|
}
|
||||||
|
@ -298,25 +298,23 @@ LH_5_params:
|
|||||||
.long str_LT_5a
|
.long str_LT_5a
|
||||||
.long str_LT_5b
|
.long str_LT_5b
|
||||||
# File table format
|
# File table format
|
||||||
.byte 4 # Four elements per file entry
|
.byte 3 # Three elements per file entry
|
||||||
.byte 1 # DW_LNCT_path
|
.byte 1 # DW_LNCT_path
|
||||||
.byte 0x08 # DW_FORM_string
|
.byte 0x08 # DW_FORM_string
|
||||||
.byte 2 # DW_LNCT_directory_index
|
.byte 2 # DW_LNCT_directory_index
|
||||||
.byte 0x0b # DW_FORM_data1
|
.byte 0x0b # DW_FORM_data1
|
||||||
.byte 3 # DW_LNCT_timestamp
|
.byte 5 # DW_LNCT_MD5
|
||||||
.byte 0x0f # DW_FORM_udata
|
.byte 0x1e # DW_FORM_data16
|
||||||
.byte 4 # DW_LNCT_size
|
|
||||||
.byte 0x0f # DW_FORM_udata
|
|
||||||
# File table entries
|
# File table entries
|
||||||
.byte 2 # Two files
|
.byte 2 # Two files
|
||||||
.asciz "File5a"
|
.asciz "File5a"
|
||||||
.byte 1
|
.byte 1
|
||||||
.byte 0x51
|
.quad 0x7766554433221100
|
||||||
.byte 0x52
|
.quad 0xffeeddccbbaa9988
|
||||||
.asciz "File5b"
|
.asciz "File5b"
|
||||||
.byte 2
|
.byte 2
|
||||||
.byte 0x53
|
.quad 0x8899aabbccddeeff
|
||||||
.byte 0x54
|
.quad 0x0011223344556677
|
||||||
LH_5_header_end:
|
LH_5_header_end:
|
||||||
# Line number program, which is empty.
|
# Line number program, which is empty.
|
||||||
LH_5_end:
|
LH_5_end:
|
||||||
@ -329,8 +327,9 @@ LH_5_end:
|
|||||||
# CHECK: include_directories[ 1] = 'Directory5a'
|
# CHECK: include_directories[ 1] = 'Directory5a'
|
||||||
# CHECK: include_directories[ 2] = 'Directory5b'
|
# CHECK: include_directories[ 2] = 'Directory5b'
|
||||||
# CHECK-NOT: include_directories
|
# CHECK-NOT: include_directories
|
||||||
# CHECK: file_names[ 1] 1 0x00000051 0x00000052 File5a{{$}}
|
# CHECK: MD5 Checksum
|
||||||
# CHECK: file_names[ 2] 2 0x00000053 0x00000054 File5b{{$}}
|
# CHECK: file_names[ 1] 1 00112233445566778899aabbccddeeff File5a{{$}}
|
||||||
|
# CHECK: file_names[ 2] 2 ffeeddccbbaa99887766554433221100 File5b{{$}}
|
||||||
# CHECK-NOT: file_names
|
# CHECK-NOT: file_names
|
||||||
|
|
||||||
.section .debug_line.dwo,"",@progbits
|
.section .debug_line.dwo,"",@progbits
|
||||||
|
@ -82,6 +82,8 @@ void TestAllForms() {
|
|||||||
const uint32_t Data4 = 0x6789abcdU;
|
const uint32_t Data4 = 0x6789abcdU;
|
||||||
const uint64_t Data8 = 0x0011223344556677ULL;
|
const uint64_t Data8 = 0x0011223344556677ULL;
|
||||||
const uint64_t Data8_2 = 0xAABBCCDDEEFF0011ULL;
|
const uint64_t Data8_2 = 0xAABBCCDDEEFF0011ULL;
|
||||||
|
const uint8_t Data16[16] = {1, 2, 3, 4, 5, 6, 7, 8,
|
||||||
|
9, 10, 11, 12, 13, 14, 15, 16};
|
||||||
const int64_t SData = INT64_MIN;
|
const int64_t SData = INT64_MIN;
|
||||||
const int64_t ICSData = INT64_MAX; // DW_FORM_implicit_const SData
|
const int64_t ICSData = INT64_MAX; // DW_FORM_implicit_const SData
|
||||||
const uint64_t UData[] = {UINT64_MAX - 1, UINT64_MAX - 2, UINT64_MAX - 3,
|
const uint64_t UData[] = {UINT64_MAX - 1, UINT64_MAX - 2, UINT64_MAX - 3,
|
||||||
@ -120,6 +122,11 @@ void TestAllForms() {
|
|||||||
const auto Attr_DW_FORM_block4 = static_cast<dwarf::Attribute>(Attr++);
|
const auto Attr_DW_FORM_block4 = static_cast<dwarf::Attribute>(Attr++);
|
||||||
CUDie.addAttribute(Attr_DW_FORM_block4, DW_FORM_block4, BlockData, BlockSize);
|
CUDie.addAttribute(Attr_DW_FORM_block4, DW_FORM_block4, BlockData, BlockSize);
|
||||||
|
|
||||||
|
// We handle data16 as a block form.
|
||||||
|
const auto Attr_DW_FORM_data16 = static_cast<dwarf::Attribute>(Attr++);
|
||||||
|
if (Version >= 5)
|
||||||
|
CUDie.addAttribute(Attr_DW_FORM_data16, DW_FORM_data16, Data16, 16);
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
// Test data forms
|
// Test data forms
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
@ -276,6 +283,17 @@ void TestAllForms() {
|
|||||||
EXPECT_EQ(ExtractedBlockData.size(), BlockSize);
|
EXPECT_EQ(ExtractedBlockData.size(), BlockSize);
|
||||||
EXPECT_TRUE(memcmp(ExtractedBlockData.data(), BlockData, BlockSize) == 0);
|
EXPECT_TRUE(memcmp(ExtractedBlockData.data(), BlockData, BlockSize) == 0);
|
||||||
|
|
||||||
|
// Data16 is handled like a block.
|
||||||
|
if (Version >= 5) {
|
||||||
|
FormValue = DieDG.find(Attr_DW_FORM_data16);
|
||||||
|
EXPECT_TRUE((bool)FormValue);
|
||||||
|
BlockDataOpt = FormValue->getAsBlock();
|
||||||
|
EXPECT_TRUE(BlockDataOpt.hasValue());
|
||||||
|
ExtractedBlockData = BlockDataOpt.getValue();
|
||||||
|
EXPECT_EQ(ExtractedBlockData.size(), 16u);
|
||||||
|
EXPECT_TRUE(memcmp(ExtractedBlockData.data(), Data16, 16) == 0);
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
// Test data forms
|
// Test data forms
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -160,6 +160,18 @@ TEST(DWARFFormValue, SignedConstantForms) {
|
|||||||
EXPECT_EQ(LEBMax.getAsSignedConstant().getValue(), LLONG_MAX);
|
EXPECT_EQ(LEBMax.getAsSignedConstant().getValue(), LLONG_MAX);
|
||||||
EXPECT_EQ(LEB1.getAsSignedConstant().getValue(), -42);
|
EXPECT_EQ(LEB1.getAsSignedConstant().getValue(), -42);
|
||||||
EXPECT_EQ(LEB2.getAsSignedConstant().getValue(), 42);
|
EXPECT_EQ(LEB2.getAsSignedConstant().getValue(), 42);
|
||||||
|
|
||||||
|
// Data16 is a little tricky.
|
||||||
|
char Cksum[16] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
|
||||||
|
DWARFFormValue Data16(DW_FORM_data16);
|
||||||
|
DWARFDataExtractor DE16(StringRef(Cksum, 16), sys::IsLittleEndianHost,
|
||||||
|
sizeof(void *));
|
||||||
|
uint32_t Offset = 0;
|
||||||
|
Data16.extractValue(DE16, &Offset, {0, 0, dwarf::DwarfFormat::DWARF32});
|
||||||
|
SmallString<32> Str;
|
||||||
|
raw_svector_ostream Res(Str);
|
||||||
|
Data16.dump(Res, DIDumpOptions());
|
||||||
|
EXPECT_EQ(memcmp(Str.data(), "000102030405060708090a0b0c0d0e0f", 32), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // end anonymous namespace
|
} // end anonymous namespace
|
||||||
|
Loading…
Reference in New Issue
Block a user