[all-commits] [llvm/llvm-project] 715726: [DebugInfo] Add error-handling to DWARFAbbreviatio...

Alex via All-commits all-commits at lists.llvm.org
Thu Jun 8 11:17:05 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 715726429ec4fc4f0f5f0f2e3dc6c3c31ce8f3a6
      https://github.com/llvm/llvm-project/commit/715726429ec4fc4f0f5f0f2e3dc6c3c31ce8f3a6
  Author: Alex Langford <alangford at apple.com>
  Date:   2023-06-08 (Thu, 08 Jun 2023)

  Changed paths:
    M llvm/include/llvm/DebugInfo/DWARF/DWARFDebugAbbrev.h
    M llvm/lib/DebugInfo/DWARF/DWARFDebugAbbrev.cpp
    M llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
    M llvm/test/DebugInfo/ARM/dwarfdump-rela.yaml
    M llvm/test/DebugInfo/X86/dwarfdump-header-64.s
    M llvm/test/DebugInfo/X86/dwarfdump-rela-dwo.s
    R llvm/test/tools/dsymutil/Inputs/empty-CU.o
    M llvm/test/tools/dsymutil/Inputs/empty-CU.s
    M llvm/test/tools/dsymutil/Inputs/swift-interface.s
    M llvm/test/tools/dsymutil/X86/empty-CU.test
    M llvm/test/tools/llvm-dwarfdump/X86/debug-abbrev.s
    M llvm/test/tools/llvm-dwarfdump/X86/no_debug_addr.s
    M llvm/test/tools/llvm-dwarfdump/X86/verify_strings.s
    M llvm/test/tools/llvm-dwarfdump/X86/verify_unit_header_chain.s
    M llvm/unittests/DebugInfo/DWARF/DWARFDebugAbbrevTest.cpp

  Log Message:
  -----------
  [DebugInfo] Add error-handling to DWARFAbbreviationDeclarationSet

This commit aims to improve error handling in the
DWARFAbbreviationDeclarationSet class. Specifically, we change the return type
of DWARFAbbreviationDeclarationSet::extract to an llvm::Error. In doing
so, we propagate the error from DWARFAbbreviationDeclaration::extract
another layer upward.

I have built on the previous unittest for DWARFDebugAbbrev that I
wrote a few days prior.
Namely, I am verifying that the following should give an error:
- An invalid tag following a non-null code
- An invalid attribute with a valid form
- A valid attribute with an invalid form
- An incorrectly terminated DWARFAbbreviationDeclaration

Additionally, I uncovered some invalid DWARF in an unrelated dsymutil
test. Namely the last Abbreviation Decl was missing a code.
This test has been updated accordingly. However, this commit does
not fix the underlying issue: llvm-dwarfdump does not correctly
verify the debug abbreviation section to catch these kinds of
mistakes. I have updated DWARFVerifier to not dereference a
pointer without first checking it and left a FIXME for future
contributors.

Differential Revision: https://reviews.llvm.org/D151353




More information about the All-commits mailing list