[PATCH] D82868: [DebugInfo/DWARF] - Test invalid CFI opcodes properly and refine related `CFIProgram::parse` code.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 30 05:23:21 PDT 2020


grimar created this revision.
grimar added reviewers: jhenderson, MaskRay, aprantl, probinson.
Herald added a subscriber: hiraditya.
Herald added a project: LLVM.

There are following issues with `CFIProgram::parse` code:

1. Invalid CFI opcodes were never tested. And currently a test would fail

when the `LLVM_ENABLE_ABI_BREAKING_CHECKS` is enabled. It happens because
the `DataExtractor::Cursor C` remains unchecked when the
"Invalid extended CFI opcode" error is reported:

  .eh_frame section at offset 0x1128 address 0x0:
  Program aborted due to an unhandled Error:
  Error value was Success. (Note: Success values must still be checked prior to being destroyed).



2. It is impossible to reach the "Invalid primary CFI opcode" error with the current code.

There are 3 possible primary opcode values and all of them are handled. Hence this error
should be replaced with llvm_unreachable.

3. Errors currently reported are upper-case.

This patch refines the code in the `CFIProgram::parse` method to fix all issues mentioned
and adds unit tests for all possible invalid extended CFI opcodes.


https://reviews.llvm.org/D82868

Files:
  llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp
  llvm/unittests/DebugInfo/DWARF/DWARFDebugFrameTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D82868.274429.patch
Type: text/x-patch
Size: 12375 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200630/4052aaeb/attachment-0001.bin>


More information about the llvm-commits mailing list