This is an archive of the discontinued LLVM Phabricator instance.

[DebugInfo] Return an error from DWARFUnitHeader::applyIndexEntry
AcceptedPublic

Authored by bulbazord on Jun 1 2023, 1:52 PM.

Details

Summary

I'm in the process of converting LLDB to use LLVM's DWARFUnitHeader
instead of its own implementation. One big difference between the two is
that LLDB actually provides an error when applying an index entry to a
DWARFHeaderUnit in a DWO context. LLVM's implementation would be more
useful if it did the same.

Diff Detail

Event Timeline

bulbazord created this revision.Jun 1 2023, 1:52 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 1 2023, 1:52 PM
bulbazord requested review of this revision.Jun 1 2023, 1:52 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 1 2023, 1:52 PM

I realize this should have a test as well. I didn't find any existing tests that I could easily extend so if anybody has any suggestions for a way to construct a test, please let me know!

aprantl accepted this revision.Jun 1 2023, 2:34 PM
aprantl added inline comments.
llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp
358

Are these actually specific to DWP files or should the error messages be more generic?

This revision is now accepted and ready to land.Jun 1 2023, 2:34 PM
bulbazord added inline comments.Jun 1 2023, 2:36 PM
llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp
358

These error messages are inspired by the equivalent ones in LLDB, but I'm not entirely sure. My understanding is that this code only executes in the context of DWO, so if it's specific to DWP I wouldn't be surprised. Maybe somebody else can chime in and give some better context.

I realize this should have a test as well. I didn't find any existing tests that I could easily extend so if anybody has any suggestions for a way to construct a test, please let me know!

Yeah, would be good to have test coverage. I'd start by adding an assert(false) to the function you're modifying (or maybe just to one of the error paths, though it's likely they're not so well tested/might not have coverage) - to identify some test cases that exercise this code,t hen maybe you can extend those tests or create new ones inspired by the existing ones?