[all-commits] [llvm/llvm-project] cd93ab: DWARFVerifier: Don't parse all units twice

David Blaikie via All-commits all-commits at lists.llvm.org
Wed Nov 24 14:05:47 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: cd93ab8947a88470b3e1ef738a2947c0bfda667f
      https://github.com/llvm/llvm-project/commit/cd93ab8947a88470b3e1ef738a2947c0bfda667f
  Author: David Blaikie <dblaikie at gmail.com>
  Date:   2021-11-24 (Wed, 24 Nov 2021)

  Changed paths:
    M llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h
    M llvm/include/llvm/DebugInfo/DWARF/DWARFVerifier.h
    M llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
    M llvm/test/DebugInfo/X86/skeleton-unit-verify.s
    M llvm/test/tools/llvm-dwarfdump/X86/verify_curanges_incomplete.yaml
    M llvm/test/tools/llvm-dwarfdump/X86/verify_debug_info.s
    M llvm/test/tools/llvm-dwarfdump/X86/verify_die_ranges.yaml
    M llvm/test/tools/llvm-dwarfdump/X86/verify_invalid_cu_ref.yaml
    M llvm/test/tools/llvm-dwarfdump/X86/verify_invalid_die_range.yaml
    M llvm/test/tools/llvm-dwarfdump/X86/verify_invalid_ranges.yaml
    M llvm/test/tools/llvm-dwarfdump/X86/verify_invalid_ref_addr.yaml
    M llvm/test/tools/llvm-dwarfdump/X86/verify_invalid_ref_addr_between.yaml
    M llvm/test/tools/llvm-dwarfdump/X86/verify_invalid_rnglists.yaml
    M llvm/test/tools/llvm-dwarfdump/X86/verify_invalid_stmt_list.yaml
    M llvm/test/tools/llvm-dwarfdump/X86/verify_invalid_strp.yaml
    M llvm/test/tools/llvm-dwarfdump/X86/verify_lexical_block_ranges.yaml
    M llvm/test/tools/llvm-dwarfdump/X86/verify_overlapping_cu_ranges.yaml
    M llvm/test/tools/llvm-dwarfdump/X86/verify_overlapping_function_ranges.yaml
    M llvm/test/tools/llvm-dwarfdump/X86/verify_overlapping_lexical_block_ranges.yaml
    M llvm/test/tools/llvm-dwarfdump/X86/verify_unit_header_chain.s

  Log Message:
  -----------
  DWARFVerifier: Don't parse all units twice

Introduced/discussed in https://reviews.llvm.org/D38719

The header validation logic was also explicitly building the DWARFUnits
to validate. But then other calls, like "Units.getUnitForOffset" creates
the DWARFUnits again in the DWARFContext proper - so, let's avoid
creating the DWARFUnits twice by walking the DWARFContext's units rather
than building a new list explicitly.

This does reduce some verifier power - it means that any unit with a
header parsing failure won't get further validation, whereas the
verifier-created units were getting some further validation despite
invalid headers. I don't think this is a great loss/seems "right" in
some ways to me that if the header's invalid we should stop there.

Exposing the raw DWARFUnitVectors from DWARFContext feels a bit
sub-optimal, but gave simple access to the getUnitForOffset to keep the
rest of the code fairly similar.




More information about the All-commits mailing list