[all-commits] [llvm/llvm-project] bee8cd: [DebugInfo/DWARF] - Test invalid CFI opcodes prope...

Georgii Rymar via All-commits all-commits at lists.llvm.org
Wed Jul 8 02:18:16 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: bee8cdcabd2b3931be3f240e70b0b04e766ea4fe
      https://github.com/llvm/llvm-project/commit/bee8cdcabd2b3931be3f240e70b0b04e766ea4fe
  Author: Georgii Rymar <grimar at accesssoftek.com>
  Date:   2020-07-08 (Wed, 08 Jul 2020)

  Changed paths:
    M llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp
    M llvm/unittests/DebugInfo/DWARF/DWARFDebugFrameTest.cpp

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

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.

Differential revision: https://reviews.llvm.org/D82868




More information about the All-commits mailing list