Previously, the debug line parser would keep attempting to read data even if it had run out of data to read. This meant errors in parsing would often end up being reported as something else, such as an unknown version or malformed directory/filename table. This patch fixes the issues by using the Cursor API to capture errors.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp | ||
---|---|---|
404–407 | Maybe DebugLineData.getU8(Cursor, StandardOpcodeLengths.begin(), OpcodeBase-1) |
llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp | ||
---|---|---|
404–407 | 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. |
llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp | ||
---|---|---|
404–407 | 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. |
llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp | ||
---|---|---|
404–407 | Sounds good. |
Maybe DebugLineData.getU8(Cursor, StandardOpcodeLengths.begin(), OpcodeBase-1)