forked from OSchip/llvm-project
[DebugInfo] Add a DWARFDataExtractor constructor that takes ArrayRef<uint8_t>
Similar to D67797 (DataExtractor).
This commit is contained in:
parent
312a9d1b83
commit
512c03bac4
|
@ -23,8 +23,7 @@ DWARFDataExtractor::GetDWARFOffset(lldb::offset_t *offset_ptr) const {
|
|||
|
||||
llvm::DWARFDataExtractor DWARFDataExtractor::GetAsLLVM() const {
|
||||
return llvm::DWARFDataExtractor(
|
||||
llvm::StringRef(reinterpret_cast<const char *>(GetDataStart()),
|
||||
GetByteSize()),
|
||||
llvm::makeArrayRef(GetDataStart(), GetByteSize()),
|
||||
GetByteOrder() == lldb::eByteOrderLittle, GetAddressByteSize());
|
||||
}
|
||||
} // namespace lldb_private
|
||||
|
|
|
@ -468,8 +468,8 @@ void DWARFUnit::SetLoclistsBase(dw_addr_t loclists_base) {
|
|||
std::unique_ptr<llvm::DWARFLocationTable>
|
||||
DWARFUnit::GetLocationTable(const DataExtractor &data) const {
|
||||
llvm::DWARFDataExtractor llvm_data(
|
||||
toStringRef(data.GetData()),
|
||||
data.GetByteOrder() == lldb::eByteOrderLittle, data.GetAddressByteSize());
|
||||
data.GetData(), data.GetByteOrder() == lldb::eByteOrderLittle,
|
||||
data.GetAddressByteSize());
|
||||
|
||||
if (m_is_dwo || GetVersion() >= 5)
|
||||
return std::make_unique<llvm::DWARFDebugLoclists>(llvm_data, GetVersion());
|
||||
|
|
|
@ -32,6 +32,11 @@ public:
|
|||
/// Constructor for cases when there are no relocations.
|
||||
DWARFDataExtractor(StringRef Data, bool IsLittleEndian, uint8_t AddressSize)
|
||||
: DataExtractor(Data, IsLittleEndian, AddressSize) {}
|
||||
DWARFDataExtractor(ArrayRef<uint8_t> Data, bool IsLittleEndian,
|
||||
uint8_t AddressSize)
|
||||
: DataExtractor(
|
||||
StringRef(reinterpret_cast<const char *>(Data.data()), Data.size()),
|
||||
IsLittleEndian, AddressSize) {}
|
||||
|
||||
/// Extracts a value and applies a relocation to the result if
|
||||
/// one exists for the given offset.
|
||||
|
|
|
@ -109,7 +109,7 @@ DWARFLocationInterpreter::Interpret(const DWARFLocationEntry &E) {
|
|||
static void dumpExpression(raw_ostream &OS, ArrayRef<uint8_t> Data,
|
||||
bool IsLittleEndian, unsigned AddressSize,
|
||||
const MCRegisterInfo *MRI, DWARFUnit *U) {
|
||||
DWARFDataExtractor Extractor(toStringRef(Data), IsLittleEndian, AddressSize);
|
||||
DWARFDataExtractor Extractor(Data, IsLittleEndian, AddressSize);
|
||||
DWARFExpression(Extractor, AddressSize).print(OS, MRI, U);
|
||||
}
|
||||
|
||||
|
|
|
@ -186,12 +186,9 @@ void PrinterContext<ELFT>::printEHFrame(
|
|||
if (Error E = Result.takeError())
|
||||
reportError(std::move(E), ObjF->getFileName());
|
||||
|
||||
auto Contents = Result.get();
|
||||
DWARFDataExtractor DE(
|
||||
StringRef(reinterpret_cast<const char *>(Contents.data()),
|
||||
Contents.size()),
|
||||
ELFT::TargetEndianness == support::endianness::little,
|
||||
ELFT::Is64Bits ? 8 : 4);
|
||||
DWARFDataExtractor DE(*Result,
|
||||
ELFT::TargetEndianness == support::endianness::little,
|
||||
ELFT::Is64Bits ? 8 : 4);
|
||||
DWARFDebugFrame EHFrame(Triple::ArchType(ObjF->getArch()), /*IsEH=*/true,
|
||||
/*EHFrameAddress=*/Address);
|
||||
EHFrame.parse(DE);
|
||||
|
|
Loading…
Reference in New Issue