This is an archive of the discontinued LLVM Phabricator instance.

[DWARF] Get rid of DWARFDebugNames::HeaderPOD. NFC.
ClosedPublic

Authored by ikudrin on Jan 20 2020, 5:47 AM.

Details

Summary

This structure was used to get the size of the fixed-size part of a Name Index header for 32-bit DWARF. It is unsuitable for 64-bit DWARF because the size of the unit length field is different.

Diff Detail

Event Timeline

ikudrin created this revision.Jan 20 2020, 5:47 AM

Is there any way we can test this?

llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp
394

How does this solve the issue exactly? Aren't we still checking the DWARF32 case only? I would expect something like

HeaderSize = dwarf::getUnitLengthFieldByteSize(IsDWARF64 ? dwarf::DWARF64 : dwarf::DWARF32) + CommonHeaderSize;

but maybe I'm misunderstanding what's going on here?

ikudrin marked an inline comment as done.Jan 21 2020, 4:57 PM
ikudrin added inline comments.
llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp
394

This is an extract from D72900 where all DWARF64 stuff is added. I made a set of patches so that each of them is more focused. This particular patch merely removes using of sizeof because we have to change the type of the Length to support DWARF64, after which the in-memory structure will anyway not reflect the in-file one.

As for your code sample, we check the remaining length of the section before reading fields, but know the format only after reading the first field, Length.

probinson accepted this revision.Jan 22 2020, 6:55 AM

LGTM.
@JDevlieghere this would be an NFC refactor IMO, so not expecting a test here. The idea is to make D72900 easier to review.

This revision is now accepted and ready to land.Jan 22 2020, 6:55 AM
This revision was automatically updated to reflect the committed changes.