DWARFYAML supports generating the .debug_loclists section. We can use it
to simplify tests.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Generally looks good for my eyes.
nit: I think the comment about intentionally missing end_of_list is better to be preserved.
llvm/unittests/DebugInfo/DWARF/DWARFDieTest.cpp | ||
---|---|---|
78 | // end_of_list intentionally missing I think this comment was useful. |
Address comments.
llvm/unittests/DebugInfo/DWARF/DWARFDieTest.cpp | ||
---|---|---|
78 | Done. Thanks for reviewing! |
LGTM, but please wait for someone's else approvement too.
llvm/unittests/DebugInfo/DWARF/DWARFDieTest.cpp | ||
---|---|---|
64 | nit: no full stop after "missing". |
@Higuoxing There's undef sanitizer warnings after this patch: http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/44524/
I haven't been able to repro but by inspection it looks like DI.Is64BitAddrSize has an undefined value:
Error DWARFYAML::emitDebugLoclists(raw_ostream &OS, const Data &DI) { assert(DI.DebugLoclists && "unexpected emitDebugRnglists() call"); return writeDWARFLists<DWARFYAML::LoclistEntry>( OS, *DI.DebugLoclists, DI.IsLittleEndian, DI.Is64BitAddrSize); }
/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/ObjectYAML/DWARFEmitter.cpp:900:52: runtime error: load of value 200, which is not a valid value for type 'bool' #0 0x1951b19 in llvm::DWARFYAML::emitDebugLoclists(llvm::raw_ostream&, llvm::DWARFYAML::Data const&) /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/ObjectYAML/DWARFEmitter.cpp:900:52 #1 0x1956ff3 in std::_Function_handler<llvm::Error (llvm::raw_ostream&, llvm::DWARFYAML::Data const&), llvm::Error (*)(llvm::raw_ostream&, llvm::DWARFYAML::Data const&)>::_M_invoke(std::_Any_data const&, llvm::raw_ostream&, llvm::DWARFYAML::Data const&) /usr/lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/std_function.h:282:9 #2 0x1954f91 in std::function<llvm::Error (llvm::raw_ostream&, llvm::DWARFYAML::Data const&)>::operator()(llvm::raw_ostream&, llvm::DWARFYAML::Data const&) const /usr/lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/std_function.h:687:14 #3 0x1953465 in emitDebugSectionImpl /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/ObjectYAML/DWARFEmitter.cpp:938:19 #4 0x1953465 in llvm::DWARFYAML::emitDebugSections(llvm::StringRef, bool) /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/ObjectYAML/DWARFEmitter.cpp:969:22 #5 0x541abd in (anonymous namespace)::DWARFDie_getLocations_Test::TestBody() /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/unittests/DebugInfo/DWARF/DWARFDieTest.cpp:67:7 #6 0x1af4529 in testing::Test::Run() /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/utils/unittest/googletest/src/gtest.cc:2474:5 #7 0x1af5481 in testing::TestInfo::Run() /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/utils/unittest/googletest/src/gtest.cc:2656:11 #8 0x1af5dd2 in testing::TestCase::Run() /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/utils/unittest/googletest/src/gtest.cc:2774:28 #9 0x1afc443 in testing::internal::UnitTestImpl::RunAllTests() /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/utils/unittest/googletest/src/gtest.cc:4649:43 #10 0x1afbed5 in testing::UnitTest::Run() /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/utils/unittest/googletest/src/gtest.cc:4257:10 #11 0x1aedfc3 in RUN_ALL_TESTS /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/utils/unittest/googletest/include/gtest/gtest.h:2233:46 #12 0x1aedfc3 in main /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/utils/unittest/UnitTestMain/TestMain.cpp:50:10 #13 0x7f47dc44a09a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2409a) #14 0x455839 in _start (/b/sanitizer-x86_64-linux-fast/build/llvm_build_ubsan/unittests/DebugInfo/DWARF/DebugInfoDWARFTests+0x455839) SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/ObjectYAML/DWARFEmitter.cpp:900:52 in
Hi @RKSimon, It was fixed in 12605bfd1ff5c6316e74587be1b41d24abd893fc
The CI is green again, http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/44538
Thanks!
nit: no full stop after "missing".