diff options
author | Wolfgang Pieb <Wolfgang.Pieb@sony.com> | 2017-06-21 19:37:44 +0000 |
---|---|---|
committer | Wolfgang Pieb <Wolfgang.Pieb@sony.com> | 2017-06-21 19:37:44 +0000 |
commit | 258927e3da21c393dda09a6173dbf2912e3f81cd (patch) | |
tree | 179767ae0afe50e7523eb1790044c8cfd6c6cc09 /llvm/lib | |
parent | fd048cc0ec2bb8d12d081258aab79bad495e7ae5 (diff) | |
download | bcm5719-llvm-258927e3da21c393dda09a6173dbf2912e3f81cd.tar.gz bcm5719-llvm-258927e3da21c393dda09a6173dbf2912e3f81cd.zip |
[DWARF] Support for DW_FORM_strx3 and complete support for DW_FORM_strx{1,2,4}
(consumer).
Reviewer: aprantl
Differential Revision: https://reviews.llvm.org/D34418
llvm-svn: 305944
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp | 18 | ||||
-rw-r--r-- | llvm/lib/Support/DataExtractor.cpp | 7 |
2 files changed, 24 insertions, 1 deletions
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp b/llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp index ed1f5f46dcf..39c1f5fd5c5 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp @@ -138,6 +138,9 @@ static Optional<uint8_t> getFixedByteSize(dwarf::Form Form, const T *U) { case DW_FORM_addrx2: return 2; + case DW_FORM_strx3: + return 3; + case DW_FORM_data4: case DW_FORM_ref4: case DW_FORM_ref_sup4: @@ -302,6 +305,10 @@ bool DWARFFormValue::isFormClass(DWARFFormValue::FormClass FC) const { case DW_FORM_GNU_str_index: case DW_FORM_GNU_strp_alt: case DW_FORM_strx: + case DW_FORM_strx1: + case DW_FORM_strx2: + case DW_FORM_strx3: + case DW_FORM_strx4: return (FC == FC_String); case DW_FORM_implicit_const: return (FC == FC_Constant); @@ -368,6 +375,9 @@ bool DWARFFormValue::extractValue(const DataExtractor &Data, case DW_FORM_addrx2: Value.uval = Data.getU16(OffsetPtr); break; + case DW_FORM_strx3: + Value.uval = Data.getU24(OffsetPtr); + break; case DW_FORM_data4: case DW_FORM_ref4: case DW_FORM_ref_sup4: @@ -545,6 +555,10 @@ void DWARFFormValue::dump(raw_ostream &OS) const { dumpString(OS); break; case DW_FORM_strx: + case DW_FORM_strx1: + case DW_FORM_strx2: + case DW_FORM_strx3: + case DW_FORM_strx4: case DW_FORM_GNU_str_index: OS << format(" indexed (%8.8x) string = ", (uint32_t)UValue); dumpString(OS); @@ -623,7 +637,9 @@ Optional<const char *> DWARFFormValue::getAsCString() const { if (Form == DW_FORM_GNU_strp_alt || U == nullptr) return None; uint32_t Offset = Value.uval; - if (Form == DW_FORM_GNU_str_index || Form == DW_FORM_strx) { + if (Form == DW_FORM_GNU_str_index || Form == DW_FORM_strx || + Form == DW_FORM_strx1 || Form == DW_FORM_strx2 || Form == DW_FORM_strx3 || + Form == DW_FORM_strx4) { uint64_t StrOffset; if (!U->getStringOffsetSectionItem(Offset, StrOffset)) return None; diff --git a/llvm/lib/Support/DataExtractor.cpp b/llvm/lib/Support/DataExtractor.cpp index 53c10bcc562..0199b300ba7 100644 --- a/llvm/lib/Support/DataExtractor.cpp +++ b/llvm/lib/Support/DataExtractor.cpp @@ -68,6 +68,13 @@ uint16_t *DataExtractor::getU16(uint32_t *offset_ptr, uint16_t *dst, Data.data()); } +uint32_t DataExtractor::getU24(uint32_t *offset_ptr) const { + uint24_t ExtractedVal = + getU<uint24_t>(offset_ptr, this, IsLittleEndian, Data.data()); + // The 3 bytes are in the correct byte order for the host. + return ExtractedVal.getAsUint32(sys::IsLittleEndianHost); +} + uint32_t DataExtractor::getU32(uint32_t *offset_ptr) const { return getU<uint32_t>(offset_ptr, this, IsLittleEndian, Data.data()); } |