diff options
author | Alexander Yermolovich <ayermolo@fb.com> | 2021-09-01 11:13:34 -0700 |
---|---|---|
committer | Alexander Yermolovich <ayermolo@fb.com> | 2021-09-01 11:49:55 -0700 |
commit | 779d24e151ded2bd55096acb9c96c2d69bdf4eeb (patch) | |
tree | 1a276bba0793c77224c3966684fc544070e4affa /llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp | |
parent | 0173e024fd9e779a94503040a532bcf125277f86 (diff) | |
download | llvm-779d24e151ded2bd55096acb9c96c2d69bdf4eeb.zip llvm-779d24e151ded2bd55096acb9c96c2d69bdf4eeb.tar.gz llvm-779d24e151ded2bd55096acb9c96c2d69bdf4eeb.tar.bz2 |
[DWARF] Find offset of attribute.
This is used by BOLT to do patching of DebugInfo section, and Line Table. Directly by using find, and through getAttrFieldOffsetForUnit.
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D107874
Diffstat (limited to 'llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp')
-rw-r--r-- | llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp b/llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp index 9073a3f..5560e7e 100644 --- a/llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp +++ b/llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp @@ -1783,6 +1783,14 @@ TEST(DWARFDebugInfo, TestImplicitConstAbbrevs) { auto A = it->getAttrByIndex(0); EXPECT_EQ(A, Attr); + Optional<uint32_t> AttrIndex = it->findAttributeIndex(A); + EXPECT_TRUE((bool)AttrIndex); + EXPECT_EQ(*AttrIndex, 0u); + uint64_t OffsetVal = + it->getAttributeOffsetFromIndex(*AttrIndex, /* offset */ 0, *U); + EXPECT_TRUE( + it->getAttributeValueFromOffset(*AttrIndex, OffsetVal, *U).hasValue()); + auto FormValue = it->getAttributeValue(/* offset */ 0, A, *U); EXPECT_TRUE((bool)FormValue); EXPECT_EQ(FormValue->getForm(), dwarf::DW_FORM_implicit_const); |