[PATCH] D83043: [DebugInfo] Use Cursor to detect errors in debug line prologue parser

Pavel Labath via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 3 06:58:17 PDT 2020


labath added inline comments.


================
Comment at: llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp:404-407
     for (uint32_t I = 1; I < OpcodeBase; ++I) {
-      uint8_t OpLen = DebugLineData.getU8(OffsetPtr);
+      uint8_t OpLen = DebugLineData.getU8(Cursor);
       StandardOpcodeLengths.push_back(OpLen);
     }
----------------
jhenderson wrote:
> jhenderson wrote:
> > labath wrote:
> > > Maybe `DebugLineData.getU8(Cursor, StandardOpcodeLengths.begin(), OpcodeBase-1)`
> > That didn't quite work. I think the signature requires either a `SmallVector` or a pre-sized vector and `.data()`. I'll make some changes for this in a separate change.
> I looked at this again, and it is trivial to change the function signature of the `getU8` function to allow any vector type, via templating it, but having done that, I realised there was a behaviour change, which I don't believe to be beneficial, so I haven't adopted this suggestion.
> 
> Without using this function, those operand lengths that could be read were printed. With the function, if the whole array can't be read, none of it is. I think the old behaviour is more useful, since it allows users to read a slightly broken prologue to see what could be salvaged from it.
Sounds good.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83043





More information about the llvm-commits mailing list