[PATCH] D73040: [DWARF] Get rid of DWARFDebugNames::HeaderPOD. NFC.

Igor Kudrin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 21 16:58:31 PST 2020


ikudrin marked an inline comment as done.
ikudrin added inline comments.


================
Comment at: llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp:394
   // Check that we can read the fixed-size part.
-  if (!AS.isValidOffset(*Offset + sizeof(HeaderPOD) - 1))
+  if (!AS.isValidOffsetForDataOfSize(*Offset, DWARF32HeaderFixedPartSize))
     return createStringError(errc::illegal_byte_sequence,
----------------
JDevlieghere wrote:
> 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? 
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`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73040/new/

https://reviews.llvm.org/D73040





More information about the llvm-commits mailing list