diff options
author | Keith Walker <kwalker@arm.com> | 2015-05-12 15:25:08 +0000 |
---|---|---|
committer | Keith Walker <kwalker@arm.com> | 2015-05-12 15:25:08 +0000 |
commit | ea9483f8473c6c6d86b226d69fe314d45a14b34b (patch) | |
tree | eeaa28b55784c3e6bb403229c204fdd56a9ba97c /llvm/lib/DebugInfo | |
parent | 7713e6849dd18dbafee5c7f1f231ccbe34b95ac6 (diff) | |
download | bcm5719-llvm-ea9483f8473c6c6d86b226d69fe314d45a14b34b.tar.gz bcm5719-llvm-ea9483f8473c6c6d86b226d69fe314d45a14b34b.zip |
[DWARF] Add CIE header fields address_size and segment_size when generating dwarf-4
The DWARF-4 specification added 2 new fields in the CIE header called
address_size and segment_size.
Create these 2 new fields when generating dwarf-4 CIE entries, print out
the new fields when dumping the CIE and update tests
Differential Revision: http://reviews.llvm.org/D9558
llvm-svn: 237145
Diffstat (limited to 'llvm/lib/DebugInfo')
-rw-r--r-- | llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp index 784652927ec..1aa31be71fe 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp @@ -189,10 +189,13 @@ public: // CIEs (and FDEs) are simply container classes, so the only sensible way to // create them is by providing the full parsed contents in the constructor. CIE(uint64_t Offset, uint64_t Length, uint8_t Version, - SmallString<8> Augmentation, uint64_t CodeAlignmentFactor, + SmallString<8> Augmentation, uint8_t AddressSize, + uint8_t SegmentDescriptorSize, uint64_t CodeAlignmentFactor, int64_t DataAlignmentFactor, uint64_t ReturnAddressRegister) : FrameEntry(FK_CIE, Offset, Length), Version(Version), Augmentation(std::move(Augmentation)), + AddressSize(AddressSize), + SegmentDescriptorSize(SegmentDescriptorSize), CodeAlignmentFactor(CodeAlignmentFactor), DataAlignmentFactor(DataAlignmentFactor), ReturnAddressRegister(ReturnAddressRegister) {} @@ -208,6 +211,12 @@ public: << "\n"; OS << format(" Version: %d\n", Version); OS << " Augmentation: \"" << Augmentation << "\"\n"; + if (Version >= 4) { + OS << format(" Address size: %u\n", + (uint32_t)AddressSize); + OS << format(" Segment desc size: %u\n", + (uint32_t)SegmentDescriptorSize); + } OS << format(" Code alignment factor: %u\n", (uint32_t)CodeAlignmentFactor); OS << format(" Data alignment factor: %d\n", @@ -222,9 +231,11 @@ public: } private: - /// The following fields are defined in section 6.4.1 of the DWARF standard v3 + /// The following fields are defined in section 6.4.1 of the DWARF standard v4 uint8_t Version; SmallString<8> Augmentation; + uint8_t AddressSize; + uint8_t SegmentDescriptorSize; uint64_t CodeAlignmentFactor; int64_t DataAlignmentFactor; uint64_t ReturnAddressRegister; @@ -461,18 +472,18 @@ void DWARFDebugFrame::parse(DataExtractor Data) { bool IsCIE = ((IsDWARF64 && Id == DW64_CIE_ID) || Id == DW_CIE_ID); if (IsCIE) { - // Note: this is specifically DWARFv3 CIE header structure. It was - // changed in DWARFv4. We currently don't support reading DWARFv4 - // here because LLVM itself does not emit it (and LLDB doesn't - // support it either). uint8_t Version = Data.getU8(&Offset); const char *Augmentation = Data.getCStr(&Offset); + uint8_t AddressSize = Version < 4 ? Data.getAddressSize() : Data.getU8(&Offset); + Data.setAddressSize(AddressSize); + uint8_t SegmentDescriptorSize = Version < 4 ? 0 : Data.getU8(&Offset); uint64_t CodeAlignmentFactor = Data.getULEB128(&Offset); int64_t DataAlignmentFactor = Data.getSLEB128(&Offset); uint64_t ReturnAddressRegister = Data.getULEB128(&Offset); auto Cie = make_unique<CIE>(StartOffset, Length, Version, - StringRef(Augmentation), CodeAlignmentFactor, + StringRef(Augmentation), AddressSize, + SegmentDescriptorSize, CodeAlignmentFactor, DataAlignmentFactor, ReturnAddressRegister); CIEs[StartOffset] = Cie.get(); Entries.emplace_back(std::move(Cie)); |