[PATCH] D72154: [DebugInfo] Make debug line address size mismatch non-fatal to parsing

Igor Kudrin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 9 04:52:12 PST 2020


ikudrin added inline comments.


================
Comment at: llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp:597
         // from the size of the operand.
-        if (DebugLineData.getAddressSize() == 0)
-          DebugLineData.setAddressSize(Len - 1);
-        else if (DebugLineData.getAddressSize() != Len - 1) {
-          return createStringError(errc::invalid_argument,
-                             "mismatching address size at offset 0x%8.8" PRIx64
-                             " expected 0x%2.2" PRIx8 " found 0x%2.2" PRIx64,
-                             ExtOffset, DebugLineData.getAddressSize(),
-                             Len - 1);
+        {
+          uint8_t ExtractorAddressSize = DebugLineData.getAddressSize();
----------------
I find these lines a bit hard to follow, without prior understanding of the whole idea. I would suggest reorganize them like this:
```
uint8_t ExtractorAddressSize = DebugLineData.getAddressSize();
if (ExtractorAddressSize != Len - 1) {
  RecoverableErrorCallback(...);
}
// Assuming that the line table is correct, temporarily override the address size.
DebugLineData.setAddressSize(Len - 1);
State.Row.Address.Address = ...
// Restore the address size if the extractor already had it.
if (ExtractorAddressSize != 0)
  DebugLineData.setAddressSize(ExtractorAddressSize);
```
What do you think?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72154





More information about the llvm-commits mailing list